Assignment #12 and VariablesAndNames
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: VariablesAndNames
/// File Name: VariablesAndNames.java
/// Date Finished:9/11/15
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;
//I am writing comments aboave each variable assignments.
cars = 100;
//Again.
space_in_a_car = 4.0;
//And again.
drivers = 30;
//And again.
passengers = 90;
//And again.
cars_not_driven = cars - drivers;
//And again.
cars_driven = drivers;
//And again.
carpool_capacity = cars_driven * space_in_a_car;
//So this is it, right?
average_passengers_per_car = passengers / cars_driven;
System.out.println( "There are " + cars + " cars available." );
System.out.println( "There are only " + drivers + " empty cars today." );
System.out.println( "There will be " + cars_not_driven + " people 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.");
}
}
Picture of the output