Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 3 Given the following Cinema class: public class Cinema private String cincode; //LFSI, LFS2, LFS3, ... private String movieTitle: //Maleficent, X-Men, private double price
QUESTION 3 Given the following Cinema class: public class Cinema private String cincode; //LFSI, LFS2, LFS3, ... private String movieTitle: //Maleficent, X-Men, private double price private String mode Payment; // Credit Card, Cash private boolean membership 1/definition of methods a) Using the above class, write the definition of the following methods: A parameterizedormal constructor to initialize the object values. (2 marks) ) A mutator and accessor methods for all data members. (4 marks) ill) The method discount() to return the discount rate (after divided by 100) based on the mode of payment and membership of every customer. The range is given based on the following table: Mode of Payment Membership Discount Rate Credit card True 5% False 3% Cash 10% False 0% (4 marks) IV) Atostring() method that will return all the object's properties including the discount rate (after divided by 100) (2 marks) True b) Write a program segment in the main program for each of the following questions, ) Create an array of object named cinViewer and the array size is 100. (1 mark) 1) By assumming that viewer details have been stored in the array object, display the viewer details with total payment that should be paid by each viewer. The formula is: Total payment a price - (price discount) den QUESTION 4 Given the following definition of a class Person: class Person protected String name: protected String ic; protected double salary, //ex: 830110033344 /ormal constructor //accessor //mutator } a) Define the normal constructor, accessors and mutator methods for above class (4 marks) b) Derive a new class Instructor from Person. Instructor has two additional data named field and Level0fExpertise, and has two processor methods named fromKelantan () and detCategory (). Method fromKelantan () will return true if instructor comes from Kelantan based on IC number where 03 (Ex 830110033344) represents Kelantan. Meanwhile detCategory() method determines and returns the category of the instructor. The following table is used to determine the category. Category Field Computer Science Mathematic Business Level Of Expertise 1-3 4-5 1-4 5 B A B A Complete the class Instructor definition by defining all its member methods, including the normal constructor (11.5 marks) C) Manager is another class derived from Person. It has two additional data members named deparment and sales. Define the default constructor for class Manager with the following default values:- name is anonymous ic is xxxxxxxxxxxx salary is 6000.00. department is Financial sales is 10000.00 (1.5 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started