Assignment 12
code
///Name: Mutsu Osoegawa
///Period: 7
///Project Name: Variables and Names
///File Name: VariablesAndNames
///Date:9/15/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;
//gives the word car a value of 100
cars = 100;
//gives the variable space_in_a_car a value of 4
space_in_a_car = 4;
//gives the variable drivers a value of 30
drivers = 30;
//gives the variable passengers a value of 90
passengers = 90;
//the variable cars_not_driven subtracts the value drivers from cars, (100-30)
cars_not_driven = cars - drivers;
//cars_driven is equal to the value of drivers which is 30
cars_driven= drivers;
//carpool_capacity is the product of (cars_driven and space_in_a_car)
carpool_capacity = cars_driven * space_in_a_car;
//average_passengers_per_car is the quotient of values passengers and cars_driven
average_passengers_per_car = passengers / cars_driven;
System.out.println( "There are " + cars + "cars availiable." );
System.out.println( "There are only " + drivers + " drivers availiable." );
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." );
}
}