Assignemnt #12 and Variables and Names

Code

    /// Name: David Shkolnikov
    /// Period: 6
    /// Program Name: Variables And Names
    /// File Name: VariablesAndNames.java
    /// Date Finished: 9/16/2015

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;

        // when cars is printed later it is replaced with 100
        cars = 100;
        // this number fills in the space in car with 4
        space_in_a_car = 4;
        //replaces drivers with 30
        drivers = 30;
        //replaces passengers with 90
        passengers = 90;
        // substitutes amount of cars minus drivers
        cars_not_driven = cars - drivers;
        // same amount of frivers as cars driven
        cars_driven = drivers;
        // substitutes cars driven times space in car
        carpool_capacity = cars_driven * space_in_a_car;
        // substitutes 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." );
    }
}
    

Picture of the output

Assignment 12