Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 5, Problem 7PP
Consider a class BasketballGame that represents the state of a basketball game. Its attributes are
- The name of the first team
- The name of the second team
- The score of the first team
- The score of the second team
- The status of the game (finished or in progress)
BasketballGame has methods to
- Record one point scored for a team
- Record two points scored for a team
- Record three points scored for a team
- Change the status of the game to finished
- Return the score of a team
- Return the name of the team that is currently winning
- a. Write a method heading for each method.
- b. Write preconditions and postconditions for each method.
- c. Write some Java statements that last the class.
- d. Implement the class.
- e. List any additional method and attributes needed in the implementation that were not listed in the original design. List any other changes made to the original design.
- f. Write a program that uses the class BasketballGame to keep track of the score of a basketball game. Use a loop that reads input each time a basket is scored. (You will need to indicate the scoring team and the number of points scored for each basket: 1, 2, or 3.) After each input is read, display the current score of the game. For example, a portion of the interaction with the program might be as follows:
Enter a score:
a 1
Cats 1, Dogs 0; Cats are winning.
Enter a score:
a 2
Cats 3, Dogs 0; Cats are winning.
Enter a score:
b 2
Cats 3, Dogs 2; Cats are winning.
Enter a score:
b 3
Cats 3, Dogs 5; Dogs are winning.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Q: It is always challenging to decide when to stop testing. Testing exit criteria can be decided either formally or informally.You are required to write a minimum of 2500 words on testing exit criteria.Note: Attach plagiarism report with it and the percentage of plagiarism must be less than 15%.
Draw sequence diagram for a Bank having many branches. Each branch has many savings, current and loan accounts. A customer can create account, deposit, or withdraw money from account, apply for loan, balance check etc.
Format of case analysis
Write the case first
Write the Time context ( this presents the time the problem should have been noted- only one )
Write the Case ownership ( this identifies who is the owner of the problem-only 1)
Write the Statement of discussions ( this is the answers of the questions. Write first the question followed by your answers) You need to mention the family name/s with date of your references to acknowledge your sources of ideas. Do NOT just copy and paste. EDIT your answers.
Write the statement of conclusion (this is your overall understanding of the case. You will include here your recommendations . Write not more than 3 sentences here.
References (at least 3 in APA format and should be within 2014 to 2020 dates of publication only.) This should match with the references you mentioned in your discussion.
CASE 1:
A small clinical laboratory was established sometime in 1969. The said laboratory was accredited as level 1 and was ISO accredited. In 1979, this…
Chapter 5 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Ch. 5.1 - Consider the program in Listing 5.4 . Suppose you...Ch. 5.1 - Prob. 2STQCh. 5.1 - Prob. 3STQCh. 5.1 - Suppose every species in the world has a peculiar...Ch. 5.1 - Revise the definition of the method writeOutput in...Ch. 5.1 - Revise the definition of the method readInput in...Ch. 5.1 - Revise the definition of the method...Ch. 5.1 - What is the meaning of (int) that appears in the...Ch. 5.1 - Prob. 9STQCh. 5.1 - Define a method called getDensity that could be...
Ch. 5.1 - Define a method called changePopulation that could...Ch. 5.1 - Define a method called changePopulation that could...Ch. 5.2 - In Listing 5.12, we set the data for the object...Ch. 5.2 - Give preconditions and postconditions for the...Ch. 5.2 - What is an accessor method? What is a mutator...Ch. 5.2 - Give the complete definition of a class called...Ch. 5.2 - Prob. 17STQCh. 5.2 - In the definition of the method in Listing 5.15,...Ch. 5.2 - What is a well-encapsulated class definition?Ch. 5.2 - When should an instance variable in a class...Ch. 5.2 - Prob. 21STQCh. 5.2 - In a class definition, is anything private ever...Ch. 5.2 - In a class definition, is the body of any method...Ch. 5.3 - What is a reference type? Are class types...Ch. 5.3 - When comparing two quantities of a class type to...Ch. 5.3 - Prob. 26STQCh. 5.3 - Write a method definition for a method called...Ch. 5.3 - Given the class Species as defined in Listing...Ch. 5.3 - After correcting the program in the previous...Ch. 5.3 - What is the biggest difference between a parameter...Ch. 5.3 - Prob. 31STQCh. 5.3 - Write an equals method for the class Person...Ch. 5.4 - Prob. 33STQCh. 5.4 - Prob. 34STQCh. 5.4 - Prob. 35STQCh. 5.4 - Prob. 36STQCh. 5.4 - Prob. 37STQCh. 5 - Design a class to represent a credit card. Think...Ch. 5 - Repeat Exercise 1 for a credit card account...Ch. 5 - Repeat Exercise 1 for a coin instead of a credit...Ch. 5 - Repeat Exercise 1 for a collection of coins...Ch. 5 - Consider a Java class that you could use to get an...Ch. 5 - Consider a class that keeps track of the sales of...Ch. 5 - Consider a class MotorBoat that represents...Ch. 5 - Prob. 8ECh. 5 - Prob. 9ECh. 5 - Prob. 10ECh. 5 - Write a program to answer questions like the...Ch. 5 - Define a class called Counter. An object of this...Ch. 5 - Prob. 3PCh. 5 - Define a Trivia class that contains information...Ch. 5 - Define a Beer class that contains the following...Ch. 5 - Write a grading program for an instructor whose...Ch. 5 - Add methods to the Person class from Self-Test...Ch. 5 - Create a class that represents a grade...Ch. 5 - Write a program that uses the Purchase class in...Ch. 5 - Write a program to answer questions like the...Ch. 5 - Consider a class that could be used to play a game...Ch. 5 - Consider a class BasketballGame that represents...Ch. 5 - Consider a class ConcertPromoter that records the...Ch. 5 - Prob. 9PPCh. 5 - Consider a class Movie that contains information...Ch. 5 - Repeat Programming Project 18 from Chapter 4, but...Ch. 5 - Prob. 12PP
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a program to print the value of EOF.
C Programming Language
Write a program that accepts two integer values typed in by the user. Display the result of dividing the first ...
Programming in C
The file pie=full. hcl contains a copy of the PIPE HCL description, along with a declaration of the constant va...
Computer Systems: A Programmer's Perspective (3rd Edition)
Soft Skills 44. Your companys software is a market leader but is proving difficult to maintain because it was w...
Starting Out with C++: Early Objects
What are the advantages and disadvantages of implicit declarations?
Concepts of Programming Languages (11th Edition)
1 int sum(int x, int y) { 2 int result; 3 result = x + y; 4 }
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Objective: The main objective of this assignment is checking the students’ ability to work with ADTs. In this week's assignment, you will be writing the interface of an ADT in order to conform to the requirements of a larger application. Description: A car rental company needs to keep extensive records to run their operation correctly. Not only does a company need to keep track of their customers, but it is also imperative to keep good records on employees. Keeping track of what car a customer is driving is a good example of a record. In addition, many times, cars need to be transported between locations of a company. If a staff member is moving a car, it is important to know which staff members are moving certain cars. Suppose Old Dominion University wanted to create a car rental company called ODU rentals. This company has employed you to keep records for the company. The company is confident you will succeed in creating a large scale record system, but they would like you to prove…arrow_forwardQ: It is always challenging to decide when to sop testing. Testing exit criteria can be decided either formally or informally. You are required to write a minimum of 2500 words on testing exit criteria. A plagiarism report with a plagiarism value up to 15% is required to attach with your submission.arrow_forwardIt is an individual happening, occuring at a particular point in time. phenomenon event instances actionarrow_forward
- visits Patiend- D physician- p Doctoon Or dered Testo Phy sian-ID Physian-ID patiend -ID Name Time Speciality Test-ID Degree ličense number Reason vitals patients Tests CPT-Co des vital -1D Test -ID Patient-ID CPT-Code Height weight Tempenatune pulse Ratt Blood presure Name SSN Datt -ordned Date -Retund Resutt Name Description DOB PHONE PRIMARY phys/ciaD Evends Event-Types Patient ID vit al - Datt vital -Time Event- ID Patient-ID Event -Code Code conditions Stont -Datl Diagnosis patient - ID phy sian - ID Con dition Daity ICDIO END - Datl Name Description Based upon the above schema: For each of the following, indicate whether the described result is a slice, a dice, a rollup, or a drilldown: An administrative worker uses the data warehouse to investigate survey scores based on patients that saw physicians with 3 specialities during the period 2017- 2018 after being diagnosed with conditions relating to lung disease. An administrative worker views results only for a particular…arrow_forwardNonearrow_forwardDraw activity diagram for a Bank having many branches. Each branch has many savings, current and loan accounts. A customer can create account, deposit, or withdraw money from account, apply for loan, balance check etc.arrow_forward
- Options: 1. If following the WAVE rule, this use case would represent the entire scenario that has value to a "Player" 2. "Search Premade Characters" is an optional task after "Create Character' 3. "Select Upgrades" is an optional task after "Upgrade Character" 4. If following the WAVE rule, this use case should look at tasks from the "Player" point of view, and describe how tasks are performedarrow_forwardI can't understand this ER diagram, can someone explain it to me with arrows, lines, and thick lines.arrow_forwardReview the UML diagram provided for a game software application. A text version is available: Text Version for UML diagram Word Document. You may notice that it is incomplete - it is missing attributes and methods, and only includes a small portion of a complete game application. This is quite common! As a software developer, typically you will be given pieces of the puzzle or tasks to complete as part of a larger project and as a member of a larger team. It takes practice to focus on the information you are given to determine what you have and what steps you need to take to complete the task. Specifically, the game application requires that only one instance of the game be able to exist in memory at any given time. This can be accomplished by creating unique identifiers for each instance of the game. Complete the UML diagram to accurately represent a singleton pattern for the Game Service class. You should replace the question marks in the UML diagram with appropriate static and…arrow_forward
- Project 4: PyGame Assignment Overview This assignment focuses on the design, implementation and testing of PyGame programs to build games. Assignment Specifications Go to Invent with Python, Making Games with Python & PyGame and choose either Chapter 4: Slide Puzzle or Chapter 5: Simulate to complete. Assignment Note These chapters have quite a bit more information than the previous projects you have completed but as you have figured out by now, making a game in PyGame is a more lengthy process. You are allowed to use the chapter as a tutorial as to what you need to do to create the game. You are allowed to use the files in the chapter, rather than build the code from scratch. You must then change something in the code to make the game different to create your own remix. Assignment Deliverable You must turn in a file called proj04.py – this is your source code solution; be sure to include your names, the project number and comments describing your code.arrow_forwardWhat is the difference between status and event data.arrow_forwardTo start execution of a model you can keyboard shortcut, Ctrl+S click the Start button on the model's toolbar keyboard shortcut, Ctrl+T select Start from the model editor's Simulation menuarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY