Sale!

CSC 210.03 Assignment 8 PRACTICE WITH OBJECTS

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (1 vote)

❐Part 1: RectangleTest Class [8 points]

File Name: RectangleTest.Java 1. (The Rectangle class) Following the example of the Circle class in slides, design a class named Rectangle to represent a rectangle. This class contains: a. Two double data fields named width and height that specify the width and height of the rectangle.

The default values are 1 for both width and height. b. A no-arg constructor that creates a default rectangle. c. A constructor that creates a rectangle with the specified width and height. d. A method named getArea() that returns the area of this rectangle. e. A method named getPerimeter() that returns the perimeter. * Assignment * Description: * Name: * Teammate: * ID: * Class: CSC 210-

* Semester: */ 
2. Implement the above class. Write a test program RectangleTest.java that creates two Rectangle objects—one with width 4 and height 40 and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this. Note: Rectangle class should be in this same class order. (10 points) Sample output: There was no box here… I’m assuming you want a screenshot of the output here?

❐Part 2: Employee Class [8 points]

File Name: EmployeeTest.Java 1. (The Employee class) Design a class named Employee. This class contains: a. A string data field named employeeId for the employee’s id b. A string data field named name for employee’s name c. A string data field named email for email d. A int data field named deptId for the department id e. A constructor with no parameter f. A constructor that creates an employee with the specified employeeId, name, email, and deptId.
Use the same variable names and assign it to the clas data field using the keyword “this” g. Create getters and setters for each variable: i). Create setter methods named setEmployeeName() that sets the employee’s name, setEmployeeId() that sets the employeeId, setEmployeeEmail() that sets the employee email and setEmployeeDeptId() that sets the department ID. ii). Create getter methods modeled like above i.e. getEmployeeName, getEmployeeId, etc. for all the variables and return the values 2. Implement the above class.
Write a EmployeeTest.Java test program that creates an Employee object with your name as name, and employeeId is initialized with your student ID, your student email as email, and 210 for department ID. Print out this initial profile by using the getter methods. Then use setEmployeeDeptId() method, to change the department ID to 220. Print this new profile with the getter method for Employee Department Id. Example output 
Please paste your screenshot for this scenario here: Output :

❐Part 3: CoffeeShopEmployee Class [14 points]

File Name: CoffeeShopEmployee.Java Steps to follow for main method
1. Prompt the user to create 3 or more Employee objects from the Employee class, no parameter is needed 2. Use a loop and an Array of to create these objects and assign them as each element in the array 3. Use a loop to set the name, email, employee id, department Id properties of each objects, for all 4 variables values using setter methods of each object.
3. Create a method to print each Employee object in the Objects Array. Print out all employee details. Please paste your screenshot for this scenario here: Output :

❐Part 4: Reflect 50 words [5 points]

Let’s reflect on what we’ve learned so far. The following reflection is identical to the one posted on iLearn. This assignment was generally simple and straightforward. There were a couple of ambiguities on where each class needed to be defined and which files to submit. But was later clarified with a mentor on Slack. The requirement of separately instantiating the Employee object and using setters to provide value seemed a bit confusing and redundant. One could simply instantiate Employee with the constructor that was created as part of an earlier section, and then add that to the array. If the purpose was to make use of the setter, the prompt could’ve asked the user to tweak a particular employee after it has been set up.
👋 Assignment 8 Part 4: Your own Reflection
❐Part 5 Optional Extra Credit : Ask and Answer [3 e.c points] Ask or Answer a question posted in this form 👋 Assignment 8 Part 5: Ask and Answer