Answered step by step
Verified Expert Solution
Question
1 Approved Answer
9.5.7 I'm not sure how to start. Please answer all parts using the given format. Thank you! Exercise 9.5.7: Creating .equals Sports Let's Go! For
9.5.7 I'm not sure how to start. Please answer all parts using the given format. Thank you!
Exercise 9.5.7: Creating .equals Sports Let's Go! For this exercise, we are going to look at how we can create a quals method. Remember, to compare objects, we cannot just use - We need to create a criteria to determine if the objects are equal. In our cile, we will say that two people are the same if both the name and birthday match. We are going to write a program that prompts the user for a person's name and birthday and a student's name, birthday, and grade, and decide if they are the same person Start in the Person class creating the quals method. Remember, this should take the other person as an input and return a boolean if both the name and birthday are equal Once completed, create the tester class where you will prompt the user for information Sample output is provided below. Sample Output Please enter the Person's name: Tanner Please enter the Person's birthday: 5/2005 Please enter the Student's nomer Tanner Please enter the Student's birthday: W4/2005 Please enter the Student's grade: 12 Some true Please enter the Person's name: Tanner Please enter the Person's birthday: 5/2005 Please enter the Student's none: Angelo Please enter the Student's birthday: S/2005 Please enter the Student's grade: 12 Sane: false 31 OP Sandbox My Section Practice Status: Not Submitted Save Subi e E FILES 9.5.7: Creating .equals 1 import java.util.Scanner; 2 3 public class PersonTester 4- public static void main(String[] args) 6- { 7 // Start here! 8 } 9 ] PersonTester javo Student ja Person.java 31 esc SO DO O # $ 4 2 3 5 6 Sandbox My Sochon racce Status: Not Submitted M ili FILES 9.5.7: Creating.equals Save Sunt continue 1. public class Student extends Person 2 3 private int grade; 4 5- public Student(String name, String birthday, int grade) { 6 super name, birthday); 7 this.grade - grade; 8 } 9 10- public int getGrade 11 return grade; 12 3 13 14 Person Tester java Student Person java 31 # 2 3 4 5 6 W E R My Section Practice Status: Not Submitted Submit Contin 2 D FILES D PersonTester java Student.java Person 9.5.7: Creating.equals 1- public class Person ! 2 3 private String nome; 4 private String birthday; 5 6 public Person (String name, String birthday) 7. 8 this.name = name; 9 this.birthday - birthday; 10 3 11 12 - public String getBirthdayO{ 13 return birthday; 14 } 15 16 public String getNameO{ 17 return name: 18 } 19 1/Create a equals method here 21 22 } 23 31 SLO 74 2 # 3 $ 4 5 6 7 W E R T Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started