Assignment #12

Code

              /// Name: Jonathan Stine
              /// Period 5
              /// Program Name: VariablesAndNames
              /// File Name: VariablesAndNames.java
              /// Date Finished: 9/10/2015
              
              
              
public class VariablesAndNames
{
    public static void main( String[] args )
    {
        
        // It's not necessary; If 4.0 is changed to 4 nothing changes, the output remains the same.
        //Floating point means that there are no fixed number of digits before and after the decimal point, and also that  
        // the decimal point can move.
        
        int cars, drivers, passengers, cars_not_driven, cars_driven;
        double space_in_a_car, carpool_capacity, average_passengers_per_car;
        
        //These are cars.
        
        cars = 100;
        
        //How much can a car hold?
        
        space_in_a_car = 4;
        
        //How many drivers?
        
        drivers = 30;
        
        //How many people do we need to transport
        
        passengers = 90;
        
       //How many cars are sitting in the lot?
       
        cars_not_driven = cars - drivers;
        
        //One driver per car.
        
        cars_driven = drivers;
        
        //Minus the seat taken by the driver, how many passengers can we take?
        
        carpool_capacity = cars_driven * space_in_a_car;
        
        //How many do we have to put in each 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." );
    }
}
       


    

    

Code Output

PS, Steve jobs invented everything.