(0) SIIMUOW_Z ClasS IS a supTiasS Of SIVUOW_T Class. SiiMiUOW_Z OnJECt nas d name, a gender, a student id and has two area of focus. Don't forget, University gives 5% discount to students who enroll...


(0) SIIMUOW_Z ClasS IS a supTiasS Of SIVUOW_T Class. SiiMiUOW_Z OnJECt nas d name, a gender,<br>a student id and has two area of focus. Don't forget, University gives 5% discount to students who<br>enroll to two area of focus. Override the getPayment method. Refer to the sample output for<br>toString method.<br>(7) SIMUOW_F class is a subclass of SIMUOW_1 class. SIMUOW_F object has a name, a gender, a<br>student id, has only one area of focus and a final year project. You only need to take note of this<br>final year project info when overriding the getPayment method i.e. no additional instance<br>variable to store the info. Refer to the sample output for toString method.<br>(8) To let Java en<br>the polymorphism, in the main method construct a list<br>ent objects.<br>In this list, you need to store objects of the five concrete classes and display the following info:<br>Customer 1 added to list<br>Student 1 added to list<br>Student 2 added to list<br>Student 3 added to list<br>Student 4 added to list<br>assuming that you have constructed five objects and added to the list.<br>(9) In the process list method, you process and display the following information:<br>Name: Customer 1<br>Gender: M<br>NRIC: S8888888H<br>Name: Student 3<br>Gender: F<br>SIMUOW id: 2020003<br>Area Focus 1: BBIS<br>Area Focus 2: MULTIMEDIA<br>Lôân âmount: 50000.00<br>Loan period: 5 years<br>Installment per month: 1125.00 Total program cost: 9500.00<br>I am class LoanLender<br>I am class SIMUOW_2<br>Name: Student 1<br>Gender: F<br>SIMUOW id: 2020001<br>Total program cost: 0.00<br>I am class SIMUOW<br>Name: Student 4<br>Gender: M<br>SIMUOW id: 2020004<br>Area Focus 1: BBIS<br>Total program cost: 15000.00<br>I am class SIMUOW_F<br>Name: Student 2<br>Gender: M<br>SIMUOW id: 2020002<br>Area Focus 1: SECURITY<br>Total program cost: 5000.00<br>I am class SIMUOW_1<br>(10) Finally, in the main method, invoke a call to the method lambdaAnalysis. In this method.<br>includes a few Lambda expression to generate the following summary report for students:<br>Lambda Analysis<br>Total students = 4<br>No of female: 2 student(s)<br>No of male: 2 student (s)<br>Total collections from students: 29500.00<br>Write a complete Java program to drive the whole task. The name of the program MUST BE<br>YourName_Q1.java and upload this Java file.<br>

Extracted text: (0) SIIMUOW_Z ClasS IS a supTiasS Of SIVUOW_T Class. SiiMiUOW_Z OnJECt nas d name, a gender, a student id and has two area of focus. Don't forget, University gives 5% discount to students who enroll to two area of focus. Override the getPayment method. Refer to the sample output for toString method. (7) SIMUOW_F class is a subclass of SIMUOW_1 class. SIMUOW_F object has a name, a gender, a student id, has only one area of focus and a final year project. You only need to take note of this final year project info when overriding the getPayment method i.e. no additional instance variable to store the info. Refer to the sample output for toString method. (8) To let Java en the polymorphism, in the main method construct a list ent objects. In this list, you need to store objects of the five concrete classes and display the following info: Customer 1 added to list Student 1 added to list Student 2 added to list Student 3 added to list Student 4 added to list assuming that you have constructed five objects and added to the list. (9) In the process list method, you process and display the following information: Name: Customer 1 Gender: M NRIC: S8888888H Name: Student 3 Gender: F SIMUOW id: 2020003 Area Focus 1: BBIS Area Focus 2: MULTIMEDIA Lôân âmount: 50000.00 Loan period: 5 years Installment per month: 1125.00 Total program cost: 9500.00 I am class LoanLender I am class SIMUOW_2 Name: Student 1 Gender: F SIMUOW id: 2020001 Total program cost: 0.00 I am class SIMUOW Name: Student 4 Gender: M SIMUOW id: 2020004 Area Focus 1: BBIS Total program cost: 15000.00 I am class SIMUOW_F Name: Student 2 Gender: M SIMUOW id: 2020002 Area Focus 1: SECURITY Total program cost: 5000.00 I am class SIMUOW_1 (10) Finally, in the main method, invoke a call to the method lambdaAnalysis. In this method. includes a few Lambda expression to generate the following summary report for students: Lambda Analysis Total students = 4 No of female: 2 student(s) No of male: 2 student (s) Total collections from students: 29500.00 Write a complete Java program to drive the whole task. The name of the program MUST BE YourName_Q1.java and upload this Java file.
Question 1<br>Question 1 (12 marks)<br>Not yet<br>This question tests your ability to use: Polymorphism and interface<br>answered<br>Marked out of<br><<interface>><br>12.00<br>o Payment<br>P Flag question<br>OExam 1<br><<implements»><br>D - static void constructList(ArrayList<Payment> alist)<br>- static void displayList(ArrayList<Payment> alist)<br>D - static void lambdaAnalysis(ArrayListsPayment> alist)<br>O + static void main(Stringl args)<br><<abstract>><br>O Usefullnfo<br>is<br>O LoanLender<br>O SIMUOW<br>is<br>O SIMUOW_1<br><<enumeration>><br>A AreaFocus<br>A SECURITY<br>A BIGDATA<br>A MULTIMEDIA<br>O SIMUOW F<br>O SIMUOW_2<br>A BBIS<br>In this question, you will explore two un-related tasks. Two types of persons need to make<br>рayment:<br>- Class LoanLender describes a loan. For a loan, we have a maximum limit for example 100K, and<br>an interest rate, for example 7%<br>- Class SIMUOW describes a student who needs to pay school fees depending on the number of<br>areas of focus. Students can take at most two areas of focus. For example, per area of focus cost is<br>5K per term, and project's cost is 10K. The University gives 5% discount to students who register<br>to two areas of focus. Student who has project can only have one area of focus.<br>We now list down the classes that you need to design for this question: Note that all classes<br>designed by you must be complete classes; for example, other constructors including the copy<br>constructor, accessor and mutator methods, toString method must be inside the classes.<br>(1) The interface class called Payment. In this class, you should declare all the constants listed<br>above in it and use them in your design. The interface class has an abstract method called<br>getPayment. Its prototype is specified as<br>public double getPayment ();<br>(2) Usefullnfo class is an abstract class which implements the interface Payment. In this class,<br>you have two final instance variables, name and gender. An exception is thrown if the gender is<br>invalid. Usual info for classes should be defined inside the class. The toString method returns a<br>string with specified format (refer to the sample printing examples in this question, basically is<br>one instance variable per line).<br>(3) LoanLender class is a concrete subclass of Usefullnfo class. A LoanLender object has a name,<br>a gender, an identity number, takıng a loan of certain amount and intends to use a few years to<br>pay by installments, i.e. override the getPayment method. The formula uses to compute the<br>installment per month is<br>Total interest = loan amount * rate * year<br>Installment per month = (loan amount + total interest) / (year *12)<br>Note that you should make sure that the loan amount is in range and the number of years to pay<br>for installments must be at least one year; otherwise throw relevant exceptions. Refer to the sample<br>output for toString method.<br>(4) SIMUOW class is a concrete subclass of Usefullnfo class. A student of SIMUOW has a name,<br>a gender, a student id (you can make use of a static variable to initialize the student id, for<br>example, starting from 2020000). SIMUOW objects derived from this class take no area of focus<br>(You should know what to put in the getPayment method). Refer to the sample output for<br>toString method.<br>(5) SIMUOW_1 class is a subclass of SIMUOW class. SIMUOW_1 object has a name, a gender, a<br>student id and has one area of focus (enum type, see UML diagram). Override the getPayment<br>method. Refer to the sample output for toString method.<br>(6) SIMUOW 2 class is a subclass of SIMUOW 1 class. SIMUOW 2 object has a name, a gender,<br>

Extracted text: Question 1 Question 1 (12 marks) Not yet This question tests your ability to use: Polymorphism and interface answered Marked out of > 12.00 o Payment P Flag question OExam 1 D - static void constructList(ArrayList alist) - static void displayList(ArrayList alist) D - static void lambdaAnalysis(ArrayListsPayment> alist) O + static void main(Stringl args) > O Usefullnfo is O LoanLender O SIMUOW is O SIMUOW_1 > A AreaFocus A SECURITY A BIGDATA A MULTIMEDIA O SIMUOW F O SIMUOW_2 A BBIS In this question, you will explore two un-related tasks. Two types of persons need to make рayment: - Class LoanLender describes a loan. For a loan, we have a maximum limit for example 100K, and an interest rate, for example 7% - Class SIMUOW describes a student who needs to pay school fees depending on the number of areas of focus. Students can take at most two areas of focus. For example, per area of focus cost is 5K per term, and project's cost is 10K. The University gives 5% discount to students who register to two areas of focus. Student who has project can only have one area of focus. We now list down the classes that you need to design for this question: Note that all classes designed by you must be complete classes; for example, other constructors including the copy constructor, accessor and mutator methods, toString method must be inside the classes. (1) The interface class called Payment. In this class, you should declare all the constants listed above in it and use them in your design. The interface class has an abstract method called getPayment. Its prototype is specified as public double getPayment (); (2) Usefullnfo class is an abstract class which implements the interface Payment. In this class, you have two final instance variables, name and gender. An exception is thrown if the gender is invalid. Usual info for classes should be defined inside the class. The toString method returns a string with specified format (refer to the sample printing examples in this question, basically is one instance variable per line). (3) LoanLender class is a concrete subclass of Usefullnfo class. A LoanLender object has a name, a gender, an identity number, takıng a loan of certain amount and intends to use a few years to pay by installments, i.e. override the getPayment method. The formula uses to compute the installment per month is Total interest = loan amount * rate * year Installment per month = (loan amount + total interest) / (year *12) Note that you should make sure that the loan amount is in range and the number of years to pay for installments must be at least one year; otherwise throw relevant exceptions. Refer to the sample output for toString method. (4) SIMUOW class is a concrete subclass of Usefullnfo class. A student of SIMUOW has a name, a gender, a student id (you can make use of a static variable to initialize the student id, for example, starting from 2020000). SIMUOW objects derived from this class take no area of focus (You should know what to put in the getPayment method). Refer to the sample output for toString method. (5) SIMUOW_1 class is a subclass of SIMUOW class. SIMUOW_1 object has a name, a gender, a student id and has one area of focus (enum type, see UML diagram). Override the getPayment method. Refer to the sample output for toString method. (6) SIMUOW 2 class is a subclass of SIMUOW 1 class. SIMUOW 2 object has a name, a gender,
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here