Question: in java please complete the code below public static void main(String[] args) { char th_cat = 'A'; int th_OpTime = 30; double hrRate = hourlyRate(th_cat);

in java please

in java please complete the code below public static void main(String[] args){ char th_cat = 'A'; int th_OpTime = 30; double hrRate =

complete the code below

 public static void main(String[] args) { char th_cat = 'A'; int th_OpTime = 30; double hrRate = hourlyRate(th_cat); double opCost = operatingCost(th_cat, th_OpTime); System.out.println("Categoty: " + th_cat); System.out.println("Op. Time: " + th_OpTime); System.out.println("hourly rate: " + hrRate); System.out.println("Op. Cost: " + opCost); double spAmount = sponsorsAmount(th_cat, th_OpTime); double netCost = opCost - spAmount; System.out.println("Sp. Amount: " + spAmount); System.out.println("Net Cost: " + netCost); } public static double hourlyRate(char cat) { switch (cat) { case 'A': return 3500; case 'B': return 2800; case 'C': return 1700; default: return 0; } } public static double operatingCost(char cat, int operatingHrs) { double hrRate = hourlyRate(cat); double normalCost = 0, overCost = 0; if (operatingHrs =5): "); double percent = scan.nextDouble(); while (percent =5): "); percent = scan.nextDouble(); } amount += opCost * percent / 100; } else { System.out.print("Sponsor " + i + ": Enter your fixed amount (>=10000): "); double fix = scan.nextDouble(); while (fix =10000): "); fix = scan.nextDouble(); } amount += fix; } } else { System.out.print("Sponsor " + i + ": Enter your fixed amount (>=5000): "); double fix = scan.nextDouble(); while (fix =5000): "); fix = scan.nextDouble(); } amount += fix; } } return amount; } }

Exercise 2: A company manages many movie theaters. They need to create a Cost Analysis Application. The details of the Java application to be implemented is provided below. A. The theaters have three hourly cost rates depending on their categories. Write a method that takes the theater category as a parameter and returns the hourly rate. Use the switch construct in Java. Category Hourly Rate (dirham) A 3500 B 2800 1700 B. Each theater might operate any number of hours per week. For an hour over 40, the hourly cost rate is doubled. Write a method that takes the hours operated and calculates the operating cost depending on if it is over-worked or not. Return the operating cost from the method. C. Sponsors can support each theater. The sponsors for category A theaters can choose to participate by percentage over 5% from the operating cost or by any fixed amount above 10,000 AED. The sponsors for category B and C theaters can participate by any fixed amount above 5,000 AED. Write a method that takes the theater category as a parameter and asks the user the necessary questions to decide on supporting amounts. The method must return the sponsors amount. (Be aware that the theater can have many sponsors. So, in the beginning, you may ask about the number of sponsors] D. Ask the user to enter the details of all theaters. The details include: Number of Theaters in the main and represent the size of the arrays. Theater ID, Theater Category, and the Operating Time - in the main and each to be saved in a separate array. E. In the main, calculate the following values earlier and save them in separate arrays (the values may need to use the methods created): Hourly rates. Operating cost. Sponsors amount Net Cost (after removing sponsors amount) F. Generate a file that summarizes the details of each theater. Then at the end, the file defines total operating cost and total amount from all sponsors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!