Assignment #12 and Variables and Names

Code

    ///Name: Tim Gibson
    ///Period: 6
    ///Project Name: Variables and Names
    ///File Name: Variables.java
    ///Date Finished: 9/13/15
    
    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;
            
            //assigns value of 100 to cars
            cars = 100;
            //assigns 4.0 to space in a car
            space_in_a_car = 4.0;
            //assign 30 to drivers
            drivers = 30;
            //assigns 90 to passengers
            passengers = 90;
            //sets cars not driven equal to cars minus drivers
            cars_not_driven = cars - drivers;
            //sets cars driven equal to drivers
            cars_driven = drivers;
            // sets carpool capacity equal cars driven times space in a car
            carpool_capacity = cars_driven * space_in_a_car;
            // sets average passengers per car equal to 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

Assignment12