UUM Sport Center provides sport facilities to its customers who are either students, staff or non-UUM (outsiders).
Question:
UUM Sport Center provides sport facilities to its customers who are either students, staff or non-UUM (outsiders). The types of facilities provided and their hourly charges are based on the customer categories as shown below: Charge Per Hour (RM) Type of Facility Student Staff Non-UUM Badminton Free 4.00 8.00 Squash Free 1.00 6.00 Sauna 3.00 5.00 10.00 The sport center wants you to write a program that can be used by its staff to calculate the charge to be paid by its customers. Six sample running of the program's GUI are shown below: This program uses two classes, SportChargeCalculatorUI and Customer, as shown in the UML class diagrams below: The SportChargeCalculatorUI class has GUI components whose names are shown as below: Customer - category : String - facType : String - hours : int + Customer(String category, String facType, int hours) + calculateCharge(): double SportChargeCalculatorUI //GUI components not shown here + SportChargeCalculatorUI () - calcBTNActionPerformed(): void hoursTF calcBTN outputTA studentRB staffRB nonUUMRB typeCB When the calcBTN button is clicked, the handler method calcBTNActionPerformed() will read the three input data (facility type, category and hours), create an object of the Customer class by passing these three data as parameters to the constructor, calculate the charge by calling the calculateCharge()method and display the output containing the customer category, the facility used, the number of hours and the calculated charge in the text area (named outputTA). Based on the provided information above, write the UUM sport center charge calculator program by defining the Customer and SportChargeCalculatorUI classes. NOTE: The files that must be submitted in your compressed file are Customer.java, SportChargeCalculatorUI.java and SportChargeCalculatorUI.form. The incomplete definition of the Customer class is given to you as shown below: Customer.java Possible Solution: public class Customer { private String category; //Customer category private String facType; //type of facility used private int hours; // number of hours used //define the constructor: //define the calculateCharge() method:
Advanced Financial Accounting
ISBN: 978-0078025624
10th edition
Authors: Theodore E. Christensen, David M. Cottrell, Richard E. Baker