Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
(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.
expand button
Transcribed Image 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
Question 1 (12 marks)
Not yet
This question tests your ability to use: Polymorphism and interface
answered
Marked out of
<<interface>>
12.00
o Payment
P Flag question
OExam 1
<<implements»>
D - static void constructList(ArrayList<Payment> alist)
- static void displayList(ArrayList<Payment> alist)
D - static void lambdaAnalysis(ArrayListsPayment> alist)
O + static void main(Stringl args)
<<abstract>>
O Usefullnfo
is
O LoanLender
O SIMUOW
is
O SIMUOW_1
<<enumeration>>
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,
expand button
Transcribed Image Text:Question 1 Question 1 (12 marks) Not yet This question tests your ability to use: Polymorphism and interface answered Marked out of <<interface>> 12.00 o Payment P Flag question OExam 1 <<implements»> D - static void constructList(ArrayList<Payment> alist) - static void displayList(ArrayList<Payment> alist) D - static void lambdaAnalysis(ArrayListsPayment> alist) O + static void main(Stringl args) <<abstract>> O Usefullnfo is O LoanLender O SIMUOW is O SIMUOW_1 <<enumeration>> 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,
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY