Question: COSC 211 Programming assignment #3 Derive a class named Student from the class Person (implemented in programming assignment #1). A Student object has a name

 COSC 211 Programming assignment #3 Derive a class named Student from
the class Person (implemented in programming assignment #1). A Student object has
a name and an identification number (both inherited from the class Person),
two test scores (int), the average score (double) and a letter grade
(char). Write the definitions for the constructors, a number of suitable accessor
and mutator methods as well as an equals() and a toString() method
for the Student class Write a Java program to read in the

COSC 211 Programming assignment #3 Derive a class named Student from the class Person (implemented in programming assignment #1). A Student object has a name and an identification number (both inherited from the class Person), two test scores (int), the average score (double) and a letter grade (char). Write the definitions for the constructors, a number of suitable accessor and mutator methods as well as an equals() and a toString() method for the Student class Write a Java program to read in the name, the id and the two test scores for 5 students from the keyboard and then compute the letter grade for each student according to the following scale: average >=90 is an A 80 System.out.print2n("Person p1 and p2 are being modified) Person.setIdipl. 1234) pl.setName("Jim"): System.out.println(pl); p2.setId(1234) Person.setName(p2, Jimmy"); if (pl.getName().equals(p2.getName())) System.out.println("Person pl and p2 have the same names); else systen.out.println("Person pl and p2 have the different names"); it (pl.getId()--p2.getId()) Syaten.out.println("Person pl and p2 have the same 10"); else System.out.println("Person pl and p2 have the different id") re Output:- Name: Ton ID: 1111 Name Mary ID: 2222 Name: Mary ID: 2222 Person p2 and p) are equal Person pl and p2 are being modified Ramo: Jin ID: 1234 Person pl and p2 have the different names Forson pl and p2 have the same id / Output:- free with BOIS semary D 2222 Py: 12:23 Perean landare sul Non and are ing we ID 1214 Persone the efferent Peruan dhe the id Complete Person.java code:- Person.java Don't forget to add your info here public class Person private String name: private int id; // default constructor 1/ Initialize values to their default public Person() { this.name = ""; this.id = 0; > // parameterized constructor // set the values as passed parameter public Person(String name, int id) { this.name = name; this.id = id; > // copy constructor // copy data of one person to another public Person(Person another Person) { this.name - another person.ne; this.id = another person.id; > 1/ setting name 1/ changing name public void setName(String name) this.name = name; > // static method to set name of any person at any time public static void setName(Person P. String newstame) { p.setName(newame): > 1/ get the name of person public String getName() { return this.name: > 1/ setting id // changing id public void setia(int id) { this.id - id; > // static method to set id of any person at any time public static void setId(Person P. int id) { p.setId(id): ) 11 get the id of person public int getido return this.id; 1/equals method that compare two objects for equality public boolean equals(Person otherPerson) if(this.name.equals(other person.getName()) ss this. ide other person.getId> return true; return false; // method to print the object in proper format public String tostring() { return "Name:+name+"\tID: id; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!