
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

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.

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 2 images

Knowledge Booster
Similar questions
- Deeper Class Design - the Square Class In this section, your job will be to write a new class that will adhere to the methods and data outlined in the “members” section below (said another way, your classes will implement a specific set of functions (called an interface) that we’ll describe contractually, ahead of time). These classes will all be shapes, with actions (methods) that are appropriate to shape objects, such as “getArea()”, or “draw()”. First we build a Square class that contains the following data and methods listed below, and then later, we will copy it to quickly make a Circle class. Note: when considering each data item below, think about what type of data would best represent the concept we’re trying to model in our software. For example, all shapes will have a coordinate pair indicating their location in a Cartesian coordinate system. This x and y pair may be modeled as ints or floats, and you might choose between the two depending on what the client application will…arrow_forwardIn c++ Create a new project named lab11_1. You will be implementing three classes: A Clothing class, a Shirt class, derived from Clothing and third class of your choice that will be derived from Clothing. I have included the UML diagrams for Clothing and Shirt. You will need to make sure that the class you derive from Clothing is appropriate, meaning it makes sense that it would inherit from Clothing. In your driver file, I’d like to see a Shirt object created, as well as an object of the class type that you create. Set the class variable members to specific values, and then print. You can choose to override the output operator to make this easier, or you can implement a method named print(). Create a new project named lab11_2. Come up with your own base class, and derived class. No big specifications here on what you need to do (in terms of overloading operators, friend functions, static variables, composition, etc), but you have to make use of the base class members in the derived…arrow_forwardIs there a different way of doing this problem? Question: Create a class AccessPoint with the following attributes: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Also, add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overlap that checks if two access points overlap their coverage and returns true if they overlap. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Test your class by writing a main function that creates five access…arrow_forward
- pls help me using python This is the code it provides: class Artist:# TODO: Define constructor with parameters to initialize instance attributes# (name, birth_year, death_year) # TODO: Define print_info() method. If death_year is -1, only print birth_year class Artwork:# TODO: Define constructor with parameters to initialize instance attributes# (title, year_created, artist) # TODO: Define print_info() method if __name__ == "__main__":user_artist_name = input()user_birth_year = int(input())user_death_year = int(input())user_title = input()user_year_created = int(input()) user_artist = Artist(user_artist_name, user_birth_year, user_death_year) new_artwork = Artwork(user_title, user_year_created, user_artist)new_artwork.print_info()arrow_forwardWhat effect does it have on a class's dependencies if it is called "incomplete" or "insufficient," which are two of the most important things about a well-designed class?arrow_forwardPlease help with the following: Consider the following Python code:class MyClass: attr = 10a. "altr" is MyClass's instance attribute.b."attr" is MyClass's static attribute.c."attr" is a non-local variable.d."attr" is a local variable.arrow_forward
- Program Specifications Write a FancyCar class to support basic operations such as drive, add gas, honk horn and start engine. fancy_car.py is provided with function stubs. Follow each step to gradually complete all instance methods. Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. The main program includes basic calls to the instance methods. Add statements in the main program as instance methods are completed to support development mode testing. **Step 0: Complete the constructor to initialize the model and miles per gallon (MPG) with the values of the parameters. Initialize the odometer to five miles and the tank to be full of gas. By default, the model is initialized to "Old Clunker", and MPG is initialized to 24.0. Note the provided constant variable indicates the gas tank capacity of 14.0 gallons. Step 1 Complete the instance…arrow_forwardRules: Corner cases. By convention, the row and column indices are integers between 0 and n − 1, where (0, 0) is the upper-left site. Throw an IllegalArgumentException if any argument to open(), isOpen(), or isFull() is outside its prescribed range. Throw an IllegalArgumentException in the constructor if n ≤ 0. Unit testing. Your main() method must call each public constructor and method directly and help verify that they work as prescribed (e.g., by printing results to standard output). Performance requirements. The constructor must take Θ(n^2) time; all instance methods must take Θ(1)Θ(1) time plus Θ(1)Θ(1) calls to union() and find().arrow_forwardInstructions In this exercise, you will design the class memberType. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent. Include the member functions to perform the various operations on the objects of memberType—for example, modify, set, and show a person’s name. Similarly, up-date, modify, and show the number of books bought and the amount spent. Add the appropriate constructors. Write the definitions of the member functions of memberType. Write a program to test various operations of your class memberType. Gradingarrow_forward
- Written in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardin visual c# (windows form app) no console or Console.WriteLine Design a non-static method that can be contained within an... Design a non-static method that can be contained within an instance/object of the MyCallback delegate type. This method should display values of two data fields contained within the object that is passed to the method. Make-up your own method definition that meets these requirements.arrow_forwardFor this portion of the assignment you will need to create the Employee class * based on the instructions in the API and have implemented the Equals method for that class. * * There is one parameter being passed as to this method that you will use as part of your solution:* An Employee object reference with the identifier testEmployee* * 1) Instantiate an instance of the Employee class using the default constructor and * assign it to an object reference with the identifier defaultEmployee* * 2) Instantiate an instance of the Employee class using the alternate constructor, * passing the following arguments:* name: "Keanu Reeves"* ID: 10010* salary: 78000.00* Assign the instance to an object reference with the identifier keanuEmployee* * 3) Declare a variable of type Employee with the identifier excellentEmployee and assign it * a reference to the same object that is being referenced by the keanuEmployee object reference. * 4) Construct a selection statement that tests if testEmployee is…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY