Challenge: Team Constructor
Task
Swipe to start coding
Here is a class called Team written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main class and its methods.
- Write a constructor with 4 parameters:
name,sport,yearFounded, andcity. - Initialize the
namefield with the value of thenameparameter. - Initialize the
sportfield with the value of thesportparameter. - Initialize the
yearFoundedfield with the value of theyearFoundedparameter. - Initialize the
cityfield with the value of thecityparameter.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 7
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Awesome!
Completion rate improved to 2.63
Challenge: Team Constructor
Swipe to show menu
Task
Swipe to start coding
Here is a class called Team written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main class and its methods.
- Write a constructor with 4 parameters:
name,sport,yearFounded, andcity. - Initialize the
namefield with the value of thenameparameter. - Initialize the
sportfield with the value of thesportparameter. - Initialize the
yearFoundedfield with the value of theyearFoundedparameter. - Initialize the
cityfield with the value of thecityparameter.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 7
single