Question: When using toString method it prints the wrong answers. In the main method, a coach with parameters was created yet it still prints the default

 When using toString method it prints the wrong answers. In themain method, a coach with parameters was created yet it still prints

the default values. What action would you like to perform? A Please

When using toString method it prints the wrong answers. In the main method, a coach with parameters was created yet it still prints the default values.

What action would you like to perform? A Please enter the Coach's information: Enter coach's first name: John Enter coach's last name: Smith Enter coach's years of experience: 5 5 Please enter the Team's information: Enter teams name: Stars Enter Team's city: Super What action would you like to perform? Team's name: Stars from Super Coach Information: LastName: ? FirstName: ? Years of Experience 0 What action would you like to perform? public String toString() { String result = ""; result += " LastName: \t" + firstName + " FirstName: \t" + lastName + " Years of Experience\t" + years + " "; return result; } = "?"; public Coach() // default constructor { firstName lastName "?"; years = 0; } public Coach (String newFirstName, String newLastName, int newYears) { firstName = newFirstName; lastName = newLastName; years = newYears; }

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!