Assignemnt #12 and Ninth Program
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Names
/// File Name: Names.java
/// Date Finished: 9/11/2015
class Names {
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;
cars = 100;
//does not need to be a floating point because it is not a decimal
space_in_a_car = 4;
drivers = 30;
passengers = 90;
cars_not_driven = cars - drivers;
cars_driven = drivers;
carpool_capacity = cars_driven * space_in_a_car;
average_passengers_per_car = passengers / cars_driven;
//plugs in info from above and sorts it depending on the task
System.out.println("There are " + cars + " cars available." );
//available drivers
System.out.println( "There are only" + drivers + "drivers available.");
//unused cars
System.out.println( "There will be " + cars_not_driven + "empty cars today.");
//# of people that can go
System.out.println( "We can transport " + carpool_capacity + "people today." );
//# of people that need to go
System.out.println( "We have " + passengers + " to carpool today." );
//# of people per car
System.out.println( "We need to put about" + average_passengers_per_car + "in each car." );
}
}
Picture of the output