Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 =

image text in transcribedimage text in transcribedcomplete 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; } }

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. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions