Assignemnt #12 Assignments and Numbers

Code

    ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: Variables and Names
    ///File Name: VariablesAndNames.java
    ///Date: 9/15/2015
    
    class HelloWorld {
    
public class VariablesAndNames
{
    public static void main( String[] args )
    {
        //creates integer variables with names cars, drivers, passengers, cars_not_driven, and cars_driven
        int cars, drivers, passengers, cars_not_driven, cars_driven;
        // creates double variables with names double space_in_a_car, carpool_capacity, and average_passengers_per_car
        double space_in_a_car, carpool_capacity, average_passengers_per_car;

        // assigns a number to the variable cars
        cars = 100;
        // assigns a number to the variable space_in_a_car
        space_in_a_car = 4.0;
        // assigns a number to the variable drivers
        drivers = 30;
        // assigns a number to the variable passengers
        passengers = 90;
        // subtracts the vlaues in variable drivers from variable cars and assigns the result to the variable cars_not_driven
        cars_not_driven = cars - drivers;
        // assigns the value of drivers to the variable cars_driven
        cars_driven = drivers;
        // multiplies the values in variables cars_driven and space_in_a_car and assigns the result to the variable carpool_capacity
        carpool_capacity = cars_driven * space_in_a_car;
        // divides the value of variable passengers by cars_driven and assigns the number to variable average_passengers_per_car
        average_passengers_per_car = passengers / cars_driven;


        //displays "There are " and the value of cars and " cars available."
        System.out.println( "There are " + cars + " cars available." );
        //displays "There are only " and the value of drivers and " drivers available."
        System.out.println( "There are only " + drivers + " drivers available." );
        //displays "There will be " and the value of cars_not_driven and " empty cars today."
        System.out.println( "There will be " + cars_not_driven + " empty cars today." );
        //displays "We can transport " and the value of carpool_capacity and " people today."
        System.out.println( "We can transport " + carpool_capacity + " people today." );
        //displays "We have " and the value of passengers and " to carpool today."
        System.out.println( "We have " + passengers + " to carpool today." );
        //displays "We need to put about " and the value of average_passengers_per_car and " in each car."
        System.out.println( "We need to put about " + average_passengers_per_car + " in each car." );
    }
}
    

Picture of the output

assignment12