Assignemnt 12: Variables and Names

Code

    /// Name: Ryan McAteer
    /// Period: 5
    /// Program Name: Variables and Names
    /// File Name: Assignment12.java
    /// Date Finished: 9/11/15

class Assignment12 
{
      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;

        //The number of cars//
        cars = 100;
        //The number of spaces in one car//
        space_in_a_car = 4.0;
        //The number of drivers//
        drivers = 30;
        //The number of passengers//
        passengers = 90;
        //The number of cars not driven due to the lack of drivers//
        cars_not_driven = cars - drivers;
        //Every car driven needs a driver//
        cars_driven = drivers;
        //The carpool capacity//
        carpool_capacity = cars_driven * space_in_a_car;
        //The average numbers of passengers(basic average add them then divide by # of cars)//
        average_passengers_per_car = passengers / cars_driven;
        //1)Because you used "double" instead of "int" it will not have an effect//
        //2)Floating Point: A number in which its decimal can be placed anywhere relative to the significant digits//
        //4)This is an equals sign (=). It assigns values to variables//
        //5)This is an underscore (_). They are very useful//

        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