Question: Java please. The exercises in this document reviews basic programming concepts of Conditions, Loops, and Methods in Java. Students are required to individually implement the
Java please.
The exercises in this document reviews basic programming concepts of Conditions, Loops, and Methods in Java. Students are required to individually implement the solutions to each exercise given below. The successful completion of these exercises enables the student to have the working knowledge of how Conditions, Loops, and Methods are used in Java.
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 |
| C | 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
Get step-by-step solutions from verified subject matter experts
