Assignment #12 Variables and Names

Code

    /// Name: John Huh
    /// Period: 6
    /// Program Name: Variables and Names
    /// File Name: VariablesAndNames.java
    /// Date Finished: 9/11/2015

        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;
            
                // 4.0 allows the number being presented to be more acurate
                // If the 4 is removed, then the numbers being presented will not have a decimal number
            
                // A floating point is something that gives specifics about a number
            
                // The variables below that have numbers proceeding give that name a value
                cars = 100;
                space_in_a_car = 4.0;
                drivers = 30;
                passengers = 90;
                // These varibles take the previously stated values and apply and calculate them, based on the given equation
                cars_not_driven = cars - drivers;
                cars_driven = drivers;
                carpool_capacity = cars_driven * space_in_a_car;
                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 1