Assignment #12

Code

    /// Name: Ian Stanko
    /// Period: 5
    /// Program Name: VariablesAndNames
    /// File Name: VariablesAndNames.java
    /// Date Finished: 9/21/2015
    
  public class VariablesAndNames
  {
      public static void main( String[] args )
      {
          //Putting 4 instead of 4.0 doesnt change what the output looks like
          //The decimal point can move because there is no fixed numbers before or after it
          int cars, drivers, passengers, cars_not_driven, cars_driven;
          double space_in_a_car, carpool_capacity, average_passengers_per_car;
  
          //This is what cars equals
          cars = 100;
          //This is how much a car can hold
          space_in_a_car = 4.0;
          //This is the number of drivers
          drivers = 30;
          //This is the number of passengers
          passengers = 90;
          //This is how many cars don't have a driver
          cars_not_driven = cars - drivers;
          //This is how many cars have drivers
          cars_driven = drivers;
          //This is how many passengers that can be transported
          carpool_capacity = cars_driven * space_in_a_car;
          //This is how many passengers will be 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." );
      }
  }
    

Picture of the output

Assignment 1