/** Login name: cbdreier
    Programmer: Christopher Dreier
    Course: 1214-092
    Lab: 3
    Description: Selection Statements */

import java.io.*;

public class L3

  {

    public static void main(String[] args)

      {        

        PrintInfo();        
        premium(8, false, true);  /* runs method "premium" with values: 8cyl, male, clean driving record*/

      }

    public static void PrintInfo()

      {

        System.out.println( );      

        System.out.println("----------------------------------------------------------------");

        System.out.println("Login name: cbdreier");

        System.out.println("Programmer: Christopher Dreier");

        System.out.println("Course: 1214-092");

        System.out.println("Lab: 3");
  
        System.out.println("Description: Selection Statements");

        System.out.println("----------------------------------------------------------------");

      }

    public static void premium(int cylinders, boolean female, boolean clean)
      
      {    
 
        int premium = 300; 
        

        switch (cylinders)         /* switch statement determines premium only based on # of                                       cylinders*/
          {
            case 4:
              
              if (clean)          /* if statement recalculates premium based on a clean driving                                       record for 4cyls*/
                break;
              else
                premium = ((premium * 12)/10);
          
              break;
            
            case 6:              /* if statement recalculates premium based on a clean driving                                     record for 6cyls */

              if (clean)
                premium = ((premium * 11)/10);
              else
                if (!female)                       /* builds case for a 6cyl, clean record that                                                       is not a female (male) */
                  premium = ((premium * 13)/10);

              break;

            case 8:
  
              if (clean)                            // same as above if's but for 8cyls
                if (female)                         // builds case for each male and female 
                  premium = ((premium * 115)/100);  // driving an 8cyl, clean 
                else
                  premium = ((premium * 12)/10);
              else
                if (female)                         //builds case for each male and female,
                  premium = ((premium * 19)/10);    //8cyl, not clean
                else
                  premium = (premium * 2);        

              break;                               //breaks out of switch statement
              
            default:                               //if none of the cases are met, this is done, 
              System.out.println();              
              System.out.print("Insurance company does not cover "); //basically, the user must                                                                      //have input non-valid 
              System.out.println(+ cylinders + "-cyl cars.");        //information
          }

        if (cylinders == 4 || cylinders == 6 || cylinders == 8)      //Finally, prints out premium for valid cases                                                                      //(4,6,8 cyls)
          {  
            System.out.println();
            System.out.println("Premium is " + premium);
          }        

        System.out.println();

      }

}        