Prog12: Variables and Names
///Name: Ilana Levy
///Period: 5
///Program Name: Variables and Names
///File Name: variables.java
///Date finished: 9/6/2015
public class variables
{
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;
//space_in_a_car is the same for just 4
//there are 100 available cars
cars = 100;
//each car only has 4 available spaces
space_in_a_car = 4;
//there are thirty drivers
drivers = 30;
//and ninety passengers
passengers = 90;
//cars without drivers aren't driven
cars_not_driven = cars - drivers;
//cars that are driven have drivers so number of drivers is the same as number of driveable cars
cars_driven = drivers;
//carpool capacity is the available space per car times the cars driven
carpool_capacity = cars_driven * space_in_a_car;
//the average number of passengers per car is the overall number of passengers divided by the number of 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." );
}
}