Assignment #33

Code

      ///Jack Newsom
      ///Period 5
      ///Program Name : WhatIf
      ///filename: WhatIf.java
      //date completed 9/21/15
      package ifStatements;
      
      import java.util.Scanner;
      
      public class WhatIf {
      
      	public static void main(String[] args) {
      		
      		Scanner keyboard = new Scanner(System.in);
      		
      		int people = 20, cats = 20, dogs = 15;
      		//if statements only run if the statement within the parameters is true
      		//the purpose of the curly braces is to contain the contents of the if statement. when the if statement runs, what is inside the curly braces is what is run
      		if (people < cats)
      		{
      			System.out.println("Too many cats! The world is doomed!");
      		}
      		
      		if (people > cats)
      		{
      			System.out.println("Not many cats! The world is saved!");
      		}
      		
      		if ( people < dogs)
      		{
      			System.out.println("The world is drooled on!");
      		}
      		
      		if ( people > dogs)
      		{
      			System.out.println("The world is dry!");
      		}
      		
      		dogs += 5;
      		
      		if (people >= dogs)
      		{
      			System.out.println("People are greater than or equal to dogs.");
      		}
      		
      		if (people <= dogs)
      		{
      			System.out.println("People are less than or equal to dogs.");
      		}
      		
      		if (people == dogs)
      		{
      			System.out.println("People are dogs.");
      		}
      			
      		
      	}
      
      }

    

Picture of the output

Assignment X