Assignment 12
public class VariablesAndNames
{
public static void main( String[] args )
{
//creates variables
int cars, drivers, passengers, cars_not_driven, cars_driven;
double space_in_a_car, carpool_capacity, average_passengers_per_car;
//sets varibale "cars" to 100
cars = 100;
//sets varibale "space_in_a_car" to 4
space_in_a_car = 4;
drivers = 30;
//sets varibale "passengers" to 90
passengers = 90;
//sets varibale "cars_not_driven" to the value of "cars" minus the value of "drivers"
cars_not_driven = cars - drivers;
//sets varibale "cars_driven" to the value of "drivers"
cars_driven = drivers;
//sets varibale "carpool_capacity" to the value of "cars_driven" multiplied by the value of "space_in_a_car"
carpool_capacity = cars_driven * space_in_a_car;
//sets varibale "average_passengers_per_car" to the value of "passengers" divided by "cars_driven"
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." );
}
}