Question: Question 4 Write a testing program to test the classes created in question 2 and question 3. Please complete this testing in the Java Project


Question 4 Write a testing program to test the classes created in question 2 and question 3. Please complete this testing in the Java Project name as Question234. The testing requirement lists as follows: a) Create two objects of Staff. b) Create two objects of Student. c) Print the objects of Staff and write the information into a text file. Name the text file as Question4Answer.txt. (20 Marks)
# answer question 4 only
(30 Marks) Question 2 Create a Java Project and the project name as Question234.Write a Java program that creates a class called Person. The UML diagram shows the variable and method available in the Person Class. Please add two new useful methods. Person -name:String -address: String +Person (name: String, address:String) +getName(): String +getAddress(): String +setAddress(address:String):void +toString(): String "Person[name=?, address=?]" (20 Marks) Continued ... Question 3 As the extension of Question 2, extends the Person class into two different subclasses, namely Student Class and Staff Class. The UML diagram showcases the necessary variables and methods needed for each class. Please complete this 2 class in the Java Project name as Question234. Staff -school:String -pay: double +Staff(name:String, address:String, school:String, pay:double) +getSchool(): String +setSchool (school:String):void +getPay(): double +setPay(pay: double):void +toString(): String Student -program: String -year:int -fee:double +Student(name:String, address:String, program: String, year: int, fee: double) +getProgram(): String +setProgram(program: String):void +getYear():int +setYear(year: int):void +getFee(): double +setFee(fee:double):void +toString(): String "Staff[Person[name=?, address=?], school=?,pay=?]" "Student[Person[name=?, address=?], program=?, year=?, fee=?]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
