Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Chapter 4, you created a class named Game that included two Team objects that held data about teams participating in a game. Modify the

In Chapter 4, you created a class named Game that included two Team objects that held data about teams participating in a game. Modify the Game class to set the game time to the message Game cancelled! if the two teams in a game do not have the same value for the sport. (In other words, a girls basketball team should not have a game scheduled with a boys tennis team.) Write a program to demonstrate a valid and an invalid game.

image text in transcribed

Programming Exercise 7-11 Game.java Team.java Instructions Game.java Team.java 1 public class Team 1 public class Gane [ 2 private Tean teanl; 3 private Team tean2; 4private String tine; 3 private String name; 4 private String sport; S private String mascot; 6 public final static String MOTTO"Sportsmanship!" 7 public Team(String nane, String sport, String mascot) In Chapter 4, you created a class named l Gane that included two Tean objects that held data about teams participating in a game. Modify the Gane class to set the game time to the message Game cancelled! if the two teams in a game do not have the same value for the sport. (In other words, a girls basketball team should not have a game scheduled with a boys' tennis team.) Write a program to demonstrate a valid and an invalid game public Gane(Team t1, Team t2, String tinep /I your code here 8 public Team getTeam1) // your code here this.name name this.sport sport; this.mascot mascot; 10 18 11 public Team getTeam2) [ 12 13 14 public String getTime() 15 16 17 18 12 13 public String getName() 14 15 16 0 17 public String getSport() 18 19 20 21 public String getMascot() /I your code here return nane; /I your code here Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. return sport; 23 24 25 return mascot; Once you are happy with your results, click the Submit button to record vour score

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

More Books

Students also viewed these Databases questions

Question

4. Write goals down and regularly monitor progress.

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago