QUESTION 3 Given the following template of definition for Cinema class: public class Cinema ( //Attributes: private Stri

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

QUESTION 3 Given the following template of definition for Cinema class: public class Cinema ( //Attributes: private Stri

Post by answerhappygod »

Question 3 Given The Following Template Of Definition For Cinema Class Public Class Cinema Attributes Private Stri 1
Question 3 Given The Following Template Of Definition For Cinema Class Public Class Cinema Attributes Private Stri 1 (39.6 KiB) Viewed 17 times
Question 3 Given The Following Template Of Definition For Cinema Class Public Class Cinema Attributes Private Stri 2
Question 3 Given The Following Template Of Definition For Cinema Class Public Class Cinema Attributes Private Stri 2 (65.8 KiB) Viewed 17 times
QUESTION 3 Given the following template of definition for Cinema class: public class Cinema ( //Attributes: private String custName; // customer name private String icNumber; //ic number, eg 980215-11-6745 private int age; // customer age private boolean isMember; // true or false. private String date; // booking date, format dd/mm/yyyy private String packageType; //PackageA, PackageB or PackageC //Methods: public Cinema () {-} public Cinema (String name, String ic, int ag, boolean member, String dt, String package) (...) public void setCinema (String name, String ic, int ag, boolean member, String dt, String package) (...) public String getName() {} //get customer name public String getIcNum () {...} //get ic number public int getAge() (.) //get customer age public boolean getMember () {...} //get member public String getDate() {...} //booking date public String getType() {...} //get package type public void printCinema () {...} public boolean isDiscount () {-} public double calPrice () {-}
a) Define the following method: i) A processor named isDiscount () that will return true or false based on age; if the customer's age is less than or equal to 12 and age is greater or equal to 60, then return true, otherwise; return false. (3 marks) ii) A processor named calPrice () that will calculate and return the price of the ticket according to the following: Package type Price PackageA RM 75.00 PackageB RM 50.00 RM 30.00 PackageC If the customer is a member, the discount of 15% will be given based on price. The discount of 50% will also being given to child and senior citizen. (Child age is 12 years and below, while senior citizen is 60 and above) (7 marks) b) Assume that there are objects of Cinema type are stored in an array named cinemaArr. Write a fragment of codes in application program for each of the followings: Count and display the information about every customer whose member for the cinema that booked the ticket in the month of December. (You may use the printer method to display information about the object) (5 marks) Calculate and display the total collection (RM) for every package. (5 marks)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply