Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

3. Have the group identify common themes.

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago