import java.io.*;
import java.text.*;

/*
 *  Assignment 1
 *  Author: Frankie Tanti
 *  Date: 31/10/2002
 *  Vers: 1,0
 *
 */
 
 class MyCarRental
 {
 	public static void main(String[] args) throws IOException
 	{
 	   //-------------------------------------------------------------------
 	   // Variable Declerations
  	   //-------------------------------------------------------------------

 	   String sCompany;          //Company Name

	   int    iNoOfCars = 0;     //Number of cars hired
	   char   cType;             //Type of Car: A, B or C
	   int    iNoOfMiles = 0;    //No. of miles covered

	   double dFixedCharge = 0.0;   //Fixed Charge 
	   double dDepreciation = 0.0;  //Depreciation of Cars
	   double dMaintenance = 0.0;   //Maintenance of Cars
	   double dTravelCosts = 0.0;   //Travel Costs

	   double dRate1 = 0.0;         //Rate for milage travelled
	   double dRate2 = 0.0;
  	   
	   String sMonth;            //Month Name 	   
	   double dProfit = 0.0;     	//Profit made    
       char cContinue;
        	   
 	   //-------------------------------------------------------------------
 	   // Section 1 - Input of Data (1,2 &3)
  	   //-------------------------------------------------------------------
 
       DecimalFormat vFormat = new DecimalFormat("0.00");
       
       BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); 		

	   System.out.print("Please Enter month: ");
	   sMonth = in.readLine();
       System.out.println("--------------------------------------------------");
       
       do
       {
		   dFixedCharge = 0.0;   //Fixed Charge 
		   dDepreciation = 0.0;  //Depreciation of Cars
		   dMaintenance = 0.0;   //Maintenance of Cars
		   dTravelCosts = 0.0;   //Travel Costs
	
	       System.out.print("Enter company name: ");
	       sCompany = in.readLine();
	       
	       System.out.print("Enter no. of cars hired: ");
	       iNoOfCars = Integer.parseInt(in.readLine());
	       
	       if (iNoOfCars <= 5)
	          dFixedCharge = 30 * iNoOfCars;
	       else
	          dFixedCharge = 20 * iNoOfCars;   
	       
	 	   //-------------------------------------------------------------------
	 	   // Section 2 - Processing of Data (4)
	  	   //-------------------------------------------------------------------
	       
	       for (int i = 1; i <= iNoOfCars; i++)
	       {
	       	 System.out.print("Enter Car Type: ");
	         String s = in.readLine();
	         cType = s.charAt(0);
	         //cType = (in.readLine()).charAt(0);
	         
	         System.out.print("Enter no. of miles: ");
	         iNoOfMiles = Integer.parseInt(in.readLine());
	         
	         switch (cType)
	         {
	         	case 'A':
	         	case 'a':  
	         	    dDepreciation += 0.08 * iNoOfMiles; 
	         	    dMaintenance += 0.03 * iNoOfMiles;
	         	    dRate1 = 0.20;
	         	    dRate2 = 0.10;
	         	    break;
	         	    
	         	case 'B':
	            case 'b':         	           
	                dDepreciation += 0.06 * iNoOfMiles; 
	                dMaintenance += 0.02 * iNoOfMiles;
	         	    dRate1 = 0.15;
	         	    dRate2 = 0.08;
	                break;
	                
	         	case 'C':
	         	case 'c':
	         	    dDepreciation += 0.04 * iNoOfMiles; 
	         	    dMaintenance += 0.01 * iNoOfMiles;
	           	    dRate1 = 0.12;
	         	    dRate2 = 0.07;
	         	    break;
	         }
	         
	    	 if (iNoOfMiles <= 100)
	           	dTravelCosts += dRate1 * iNoOfMiles;
	         else
	            dTravelCosts += (dRate1 * 100) + ((iNoOfMiles - 100) * dRate2);
	       }
	       
	       dProfit += dFixedCharge + dTravelCosts - dDepreciation - dMaintenance;
	       
	       //-------------------------------------------------------------------
	 	   // Section 3 - Reports (output)
	  	   //-------------------------------------------------------------------
	  	 
	  	   System.out.println("--------------------------------------------------");  
	  	   System.out.println("Summary for: " + sCompany);
	  	   System.out.println("No of cars hired: " + iNoOfCars);
	  	   System.out.println("Fixed Costs: " + vFormat.format(dFixedCharge));
	 	   System.out.println("Travel Costs: " + dTravelCosts);  	   
	  	   System.out.println("Depreciation: " + dDepreciation);
	  	   System.out.println("Maintenance: " + dMaintenance);
	  	   
	  	   System.out.println("--------------------------------------------------");
	  	   System.out.println("Profit: " + dProfit);
	  	   System.out.println("--------------------------------------------------");
	  	   
	       //-------------------------------------------------------------------
	 	   // Section 4 - Asking the user if he want to enter more companies
	  	   //-------------------------------------------------------------------
	  	   
	  	   System.out.print("Another Company?: ");
	       String s = in.readLine();
	       //s = s.toUpperCase();
	       cContinue = s.charAt(0);
	 	} while (cContinue == 'Y' || cContinue == 'y');
	 } // main
 } //class