COMP274 Lab2 – Person Class – Guaranteed 100% score

Lab Price = $12
Please feel free to send us your queries at: support@iqrajavaid.com
Payment Methods

Add to Cart

Buy Now

View Cart


Problem Statement

COMP 274 Week 2
Inheritance and Polymorphism
The objective of this programming assignment is to experience the use of inheritance in Java and to see how polymorphism works in Java.
The assignment involves writing three classes, plus a test class. All four classes are in the same project. The base class is a Person class which contains a couple of attributes and methods common to all persons. The first derived class is an Employee class which adds employee information to a Person. The second derived class is a GroupManager class which adds work group information to an Employee. The test program will be structured to include a method which accepts a base class reference and demonstrates polymorphic behavior.
NOTE: None of the first three classes below do ANY user input or console output! Console output is only done in the display method of the test program!
NOTE: ALL the member variables of these classes MUST BE PRIVATE!
NOTE: Only the main method in the test class and the display method in the test class can be static methods.
Development Strategy: Start with the Person class. Implement that first. Then write some test code in your test program to check that it works. Then go on to the Employee class. When that is written add test code for that. Finally implement the GroupManager class and then add test code for that.
The details of the three classes to be implemented are as follows:
1. The Person class contains the name and address of a person. An explicit value constructor must be provided to set both of these values. There is a changeName and a changeAddress method used to modify the name or the address value. There must be ONE getInfo method that returns one string containing both the name and address. The string returned should be formatted to appear as shown below:

Name: Davy Jones
Address: New York

Private Member Variables:
name, address
Public Methods:
one constructor – takes 2 String parameters
changeName –takes 1 String parameter – no returned value
changeAddress –takes 1 String parameter – no returned value
getInfo – takes no parameters – returns a String

Your class can NOT contain any other member variables or methods!

2. The Employee class inherits from the Person class. This class adds attributes for an employee ID (int), annual salary (double), and the current assignment (String). An explicit value constructor must be provided to set the two values of the base class plus these three values. There is a changeSalary and a changeAssignment method used to modify the annual salary or the current assignment. The base class getInfo method must be overridden to include all the base class person information plus the employee information. The string returned should be formatted to appear as shown below:

Name: Davy Jones
Address: New York
EmployeeID: 103
AnnualSalary: 34567.00
CurrentAssignment: Welder

Private Member Variables:
employeeID, salary, assignment
Public Methods:
one constructor – takes 3 String, 1 int, and 1 double parameter
changeSalary –takes 1 double parameter – no returned value
changeAssignment –takes 1 String parameter – no returned value
getInfo – takes no parameters – returns a String

Your class can NOT contain any other member variables or methods!

3. The GroupManager class inherits from the Employee class. This class adds attributes for a group name (String), group size (int), and a list of employee ids (int array) belonging to the group. An explicit value constructor must be provided that accepts name, address, employee ID, salary, group name and group size parameters. The constructor will create an integer array the size specified in the group size parameter. It will also set the group size member variable to 0 indicating there are initially no employee ids stored in the array. There is an addMember method used to add employee ids to the list of employee ids belonging to the group. This method adds the employee id to the array and increments the group size (unless the list is full). The base class getInfo method must be overridden to include all the base class employee information plus all the group information. Group information should include the group name, size, and the list of employee ids belonging to the group. The string returned should be formatted to appear as shown below:
Name: Monty Jones
Address: Dallas
EmployeeID: 104
AnnualSalary: 54321.00
CurrentAssignment: Group Manager
Group Name: FactoryGroup
Group Size: 3
Member 1: 101
Member 2: 102
Member 3: 103

Private Member Variables:
groupName, groupSize, eidList
Public Methods:
one constructor – takes 3 String, 2 int, and 1 double parameters
addMember –takes 1 int parameter – returns Boolean – false if list is full
getInfo – takes no parameters – returns a String

Your class can NOT contain any other member variables or methods!

4. The test program’s main method needs to create a couple (at least 2) Employee objects and a GroupManager object. The test program does not need to be interactive, so user input is not required. The test program should add the employee ids used to create the Employee objects to the GroupManager object. The test program MUST contain a display method (a static method) which takes ONE Person object reference as a parameter. The display method should use the getInfo method to get the all the information about the object passed in and output that information.

The main method should pass the Employee objects and the GroupManager object to the display method. The output seen demonstrates polymorphic behavior, that is the base class Person reference to an Employee object accesses Employee information, and the base class Person reference to a GroupManager object accesses GroupManager information.

Take screen shots of the output of the program. Paste the screen shots and your source code for all your classes into a Word document.

Relevant Material
Screenshots
COMP274_Lab2_Person
COMP274_Lab2_Person

Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Payment Details

 

Lab Price = $12
Please feel free to send us your queries at: support@iqrajavaid.com
Payment Methods

Add to Cart

Buy Now

View Cart

Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.


Leave a Reply