Java Programming (MindTap Course List)
Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
Question
Book Icon
Chapter 4, Problem 5PE
Program Plan Intro

a.

Display the school name, sport name and team name

Program plan:

Filename: “Team.java”

  • Define the “Team” class.
    • Declare the required variables.
    • Define the parameterized constructor.
      • Set the values.
    • Define “getSchoolName” method
      • Return the school name.
    • Define “getSportName” method
      • Return the sport name.
    • Define “getTeamName” method
      • Return the team name.

Filename: “TestTeam.java”

  • Define the “TestTeam” class.
    • Define the main method.
      • Create the objects for “Team” class with different parameters.
      • Display the results.

Program Plan Intro

b.

Display the game details

Program plan:

Filename: “Team.java”

  • Define the “Team” class.
    • Declare the required variables.
    • Define the parameterized constructor.
      • Set the values.
    • Define “getSchoolName” method
      • Return the school name.
    • Define “getSportName” method
      • Return the sport name.
    • Define “getTeamName” method
      • Return the team name.

Filename: “Game.java”

  • Define the “Game” class.
    • Declare the required variables.
    • Define the parameterized constructor.
      • Set the values.

Filename: “TestTeam.java”

  • Define the “TestTeam” class.
    • Define the main method.
      • Create the objects for “Team” class with different parameters.
      • Create an object for “Game” class.
      • Display the results.

Blurred answer
Students have asked these similar questions
a - Create a FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating, and the date. The class includes methods to get each field. In addition, create a default constructor that automatically sets the activity to running, the minutes to 0, and the date to January 1 of the current year. Save the file as FitnessTracker.java. Create an application that demonstrates each method works correctly, and save it as TestFitnessTracker.java. b - Create an additional overloaded constructor for the FitnessTracker class you created in Exercise 3a. This constructor receives parameters for each of the data fields and assigns them appropriately. Add any needed statements to the TestFitnessTracker application to ensure that the overloaded constructor works correctly, save it, and then test it. c - Modify the FitnessTracker class so that the default constructor calls the three-parameter constructor. Save the class as FitnessTracker2.java. Create an…
Create a class for Subject containing the Name of the subject and score of the subject. There should be following methods: 1. set: it will take two arguments name and score, and set the values of the attributes. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. 2. set: it will take one double value as argument and set the value of score only. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. 3. display: it will display the name and score of the subject. Like “Name : Math, Score: 99.9” 4. getScore: it will return the value of score. 5. greaterThan: it will take subject’s object as argument, compare the calling object’s score with argument object’s score and return true if the calling object has greater score. Create a class “Main” having main method to perform following tasks. 1. Create two objects of Subject…
Help me With this Java Task
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,