Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

1 Last updated 11/16/2020 CSC110 Final Project For your final project, you will be reusing Person.java from Module 0111 and creating three new files: Teacher.java, Student.java, and Section.java. In...

1 answer below »
1
Last updated 11/16/2020
CSC110 Final Project
For your final project, you will be reusing Person.java from Module 0111 and creating three new files: Teacher.java,
Student.java, and Section.java.
In these files, you are going to implement the Java classes required to store a course section in which each section of a
course has exactly one teacher and some number of students.
Required Classes
You will subclass the Person class from Module 0111 to create Teacher and Student classes. You will also create a
Section class that stores the details required to connect a course title, Teacher object, and Student objects to create a
section of a course.
Class Diagrams in Unified Modeling Language (UML)
NOTE: The UML notation for a
ays such as scores: int[1..*] should be written in Java as int[] scores
2
Last updated 11/16/2020
Class Requirements
Teacher
getEmployeeID: standard getter for employeeID
setEmployeeID: standard setter for employeeID
isSameTeacher: returns true if the instance employeeID and the otherTeacher employeeID string match, false otherwise
printDetails: ove
ides the printDetails method of Person to display employee details in the format shown below; must
include a call to super.printDetails() to print the name, birthdate, age, and adult/minor status.
Employee ID 1001 Richard Feynman born 5/11/1918 age 102 adult
Student
getStudentID, getScores: standard getter for studentID, scores
setStudentID, setScores: standard setter for studentID, scores
isSameStudent: returns true if the instance studentID and the otherStudent studentID string match, false otherwise
computeWorstScore: returns the lowest score from the instance scores
computeBestScore: returns the highest score from the instance scores
computeAverageScore: returns the average of all of the instance scores
computeGrade: call computeAverageScore to find the average score and then returns the student grade using the scale:
A ≥ XXXXXXXXXXB ≥ 80 and < XXXXXXXXXXC ≥ 70 and < XXXXXXXXXXD ≥ 60 and < XXXXXXXXXXF < 60
printDetails: ove
ides the printDetails method of Person to display student details in the format shown below; must
include a call to super.printDetails() to print the name, birthdate, age, and adult/minor status.
Student ID 2001 Laurie Brown born 4/1/1928 age 92 adult
Scores XXXXXXXXXXWorst 85 Best 100 Average 93 Grade A
Section
getTitle, getTeacher, getStudent: standard getters for title, teacher, student
setTitle, setTeacher, setStudent: standard setters for title, teacher, student
printRoster: displays the course title, teacher details, and student details in the format shown below; should include a
single System.out.println for the title, single call to Teacher printDetails to print the teacher, and multiple calls to
Student printDetails to print the student:
Class Physics 101
Employee ID 1001 Richard Feynman born 5/11/1918 age 102 adult
Student ID 2001 Laurie Brown born 4/1/1928 age 92 adult
Scores XXXXXXXXXXWorst 85 Best 100 Average 93 Grade A

Student ID 2002 Michel Baranger born 7/31/1927 age 93 adult
Scores XXXXXXXXXXWorst 70 Best 90 Average 79 Grade C
3
Last updated 11/16/2020
Project Setup
You should work through this assignment creating one class at a time in the following order. Your instructor has
provided a test class that you should run at each step to verify that you have implemented your class co
ectly.
All work should be completed in the same project in Eclipse where you completed the Person class. The following steps
assume this was your Labs project. If you used a different project, please use that wherever Labs appears in the
direction.
Teacher
1. Create a new Java class named Teacher in your Labs folder.
2. Your existing Person.java file should already be in your Labs folder.
3. From the Canvas Final Project module, choose Final Test Files, right-click on TeacherTest.java, choose Save As,
and then save the file to the directory where Teacher.java is located.
4. In the Eclipse Package Explorer window, click on Labs to highlight it and then go to File | Refresh. The
TeacherTest.java files should appear.
5. Write the code for Teacher.java.
6. When you are ready to test Teacher.java, double-click TeacherTest.java in the package explorer to make it the
cu
ent file and then press the Run button.
7. Repeat steps 5 and 6 until TeacherTest.java reports 0 e
ors and the printed details match the example given in
the Teacher class requirements section of this document.
Student
1. Create a new Java class named Student.
2. From the Canvas Final Project module, choose Final Test Files, right-click on StudentTest.java, choose Save As,
and then save the file to the directory where Student.java is located.
3. In the Eclipse Package Explorer window, click on Labs to highlight it and then go to File | Refresh. The
StudentTest.java file should appear.
4. Write the code for Student.java.
5. When you are ready to test Student.java, double-click StudentTest.java in the package explorer and then press
the Run button.
6. Repeat steps 4 and 5 until StudentTest.java reports 0 e
ors and the printed details match the example given in
the Student class requirements section of this document.
Section
1. Create a new Java class named Section.
2. From the Canvas Final Project module, choose Final Test Files, right-click on SectionTest.java, choose Save As,
and then save the file to the directory where Section.java is located.
3. In the Eclipse Package Explorer window, click on Labs to highlight it and then go to File | Refresh. The
SectionTest.java file should appear.
4. Write the code for Section.java.
5. When you are ready to test Section.java, double-click SectionTest.java in the package explorer and then press
the Run button.
6. Repeat steps 4 and 5 until SectionTest.java reports 0 e
ors and the printed details match the example given in
the Section class requirements section of this document.
StudentGradeTest
1. Create a new Java class named StudentGradeTest.
2. Given this new class a main method.
4
Last updated 11/16/2020
3. Create a Student object and give it your first name, your last name, the birthdate 5/1/1998, and the student ID
1001.
4. To test that you are assigning the co
ect grades, create a loop that counts from 50 to 100 by 5. Each time, give
your student object this number as a single score and call printDetails. This will allow you to verify that the right
grade is assigned for 50, 55, 60, 65, 70, 75, 80, 75, 90, 95, and 100.
Submitting Your Work
When everything is complete, submit only these files in Canvas:
• Person.java
• Teacher.java
• Student.java
• Section.java
• StudentGradeTest.java
Bonus
For bonus points, recall that early in the semester we discussed System.out.printf which allows data to be formatted.
Research System.out.printf and use it to create new method in Section called printPrettyRoster which will print the
oster in the following format:
Class Physics 101
Richard Feynman

ID Name XXXXXXXXXXAvg Grade Scores
2001 Laurie Brown XXXXXXXXXXA XXXXXXXXXX 91
2002 Michel Baranger XXXXXXXXXXC XXXXXXXXXX 76
For full bonus points, your scores must be “right-aligned” such as how the final 0 of 70 and 100 line up over each other.
For testing, change SectionTest.java from calling printRoster to calling printPrettyRoster.
Answered Same Day Dec 02, 2021

Solution

Sayed Shad Ahmad answered on Dec 06 2021
144 Votes
src/Person.java
src/Person.java
Importing LocalDate class for getting system date
import java.time.LocalDate;
Class Person
public class Person 
{
    
Instance variables for Person name & date of birth
    private String firstName;
    private String lastName;
    private int birthMonth;
    private int birthDay;
    private int birthYear;
    
    
Getter method to get first name of Person
    public String getFirstName()
    {
        return firstName;
    }   
    
    
Getter method to get last name of Person
    public String getLastName()
    {
        return lastName;
    }   
    
    
Getter method to get birth month of Person
    public int getBirthMonth() 
    {
        return birthMonth;
    }   
    
    
Getter method to get birth day of Person
    public int getBirthDay()
    {
        return birthDay;
    }   
    
    
Getter method to get birth year of Person
    public int getBirthYear()
    {
        return birthYear;
    }
    
    
Setter method to set first name of Person
    public void setFirstName(String newFirstName) 
    {
        this.firstName = newFirstName;
    }   
    
    
Setter method to set last name of Person
    public void setLastName(String newLastName) 
    {
        this.lastName = newLastName;
    }   
    
    
Setter method to set date of birth of Person
    public void setBirthDate(int newBirthMonth, int newBirthDay, int newBirthYear)
    {
        this.birthMonth = newBirthMonth;
        this.birthDay = newBirthDay;
        this.birthYear = newBirthYear;
    }
    
    
Method to calculate age of Person 
    public int computeAge()
    {
        
Getting cu
ent system date
        LocalDate ld = LocalDate.now();
        
        int cu
Year = ld.getYear();
        
        return cu
Year - this.birthYear;
    }
    
    
Method to check whether the Person is an adult
    public boolean isAdult()
    {
        return this.computeAge() >= 18;
    }
    
    
Method to print Person details
    public void printDetails()
    {
        System.out.println(this.firstName + " " + this.lastName + " born " +
                            this.birthMonth + "/" + this.birthDay + "/" +
                            this.birthYear + " age " + this.computeAge() +
                            " " + (isAdult() ? "adult" : "minor"));
    }
}
src/Section.java
src/Section.java
Class Section
public class Section 
{
    
Instance variable for Section title, Teacher object & a
ay of Student objects
    private String title;
    private Teacher teacher;
    private Student students[];
    
    
Getter method to get title of Section
    public String getTitle() 
    {
        return title;
    }
    
    
Getter method to get Teacher object
    public Teacher getTeacher() 
    {
        return teacher;
    }
    
    
Getter method to get a
ay of Student objects
    publ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here