Programming Assignment #12
Code
/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: Numbers with math stuffs
/// File Name: NumbersAndMath.java
/// Date Finished: 9/24/2015
public class VariablesAndNames
{
public static void main( String[] args )
{
int cars, drivers, passengers, cars_not_driven, cars_driven;
double space_in_a_car, carpool_capacity, average_passengers_per_car;
//First comment
cars = 100;
//Putting a 4.0 doesn't change anything in this instance and is not necessary
//A floating point number is a number in which the decimal point can be anywhere within the digits and
//there can be any number of digits before and after. However since it is still an int, I'm fairly certain
//it can only go up to about 9,000,000 and down to -9,000,000.
space_in_a_car = 4;
//Here's a comment
drivers = 30;
//And here's another one
passengers = 90;
//I think these are the variable assignments
cars_not_driven = cars - drivers;
//Because I'm pretty sure the top stuff is initializations
cars_driven = drivers;
//But oh man, this is a lot of comments
carpool_capacity = cars_driven * space_in_a_car;
//And this is the last one.
average_passengers_per_car = passengers / cars_driven;
System.out.println( "There are " + cars + " cars available." );
System.out.println( "There are only " + drivers + " drivers available." );
System.out.println( "There will be " + cars_not_driven + " empty cars today." );
System.out.println( "We can transport " + carpool_capacity + " people today." );
System.out.println( "We have " + passengers + " to carpool today." );
System.out.println( "We need to put about " + average_passengers_per_car + " in each car." );
}
}
Outputs