subject

This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points or, b. one of the players wins 3 points while the other player has 0 points. (2) The match is over when one of the players wins 2 games. The program will run a single match. See sample runs below. Write a complete class called RacquetBallMatch that has the following: • (8 points) playGame method: that plays one full game of 7 points between two players Allen and Bob. This method accepts a Scanner object and returns the name of the winner of this game. Specifically, this method repeatedly asks the user "who the winner of the next point is" until the game is over by following the rules mentioned above. The user is expected to enter the first letter of the player’s names, i. e. A for Allen and B for Bob. (Make the input case insensitive) See sample runs below. • (2 points) printGameScores method: accepts points of two players and prints the scores. See sample runs below. • (2 points) printMatchScores method: accepts game counts of two players and prints the scores. See sample runs below. • (5 points) main method: o Welcomes the user. o Declares and initializes a Scanner object to be used throughout to read user input. o Calls the playGame method repeatedly until the winner of a 3-game set can be declared. For example, if Bob wins the first 2 games, he would be declared the match winner and the program would stop. • (3 points) Include appropriate program documentation and formatting including: Your first and last name, the date of submission, code comments necessary to explain the operation of your program, and proper indentation of the code, etc. Notes: • For each of the methods, think about the following: What is the return type, what parameter(s) will it need to perform the task, and accordingly decide the method signature for each. • Don’t use static variables (variables that are declared outside of all the methods). It is ok to have class constants (variables declared with final keyword). • Use while-loops to handle the repetition. • Make sure there is no code-duplication. • Use a Boolean variable that captures the winning condition for a game or the match and use it in the while-loop conditions.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
What are compression artifacts? 1) visible defects in the picture caused by the nature of the compression algorithm. 2) numbers that tell a web server how much to compress a picture for faster transmission. 3) invisible defects in the picture preserved by lossless compression. 4) numbers that tell a photo editing program how much to compress a picture for faster transmission.
Answers: 3
question
Computers and Technology, 22.06.2019 00:40
Reading characters and strings from the keyboard: consider the following c++ program 1. #include 2. #include 3. using namespace std; 4. mystring1 5. 6. int main() 7. { 8. 9. string mystring1, mystring2; mychar1 10. 11. 12. char mychar1, mychar2; 13. 14. cout< < "enter a string: "; mychar2 15. 16. cin> > mystring1; // 17. cin.get(mychar1); 18. cin> > mychar2; 19. getline(cin,mystring2); mystring2 20. 21. 22. cout<
Answers: 1
question
Computers and Technology, 22.06.2019 01:00
Duplicating objects creates copies that a. move differently than the original object b. erase the original object c. look and act like the original object d. add events to a game
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
You know the right answer?
This assignment will acquaint you with the use of while loops and boolean expressions. You will crea...
Questions
question
Biology, 19.04.2020 04:08
question
Mathematics, 19.04.2020 04:09
question
Mathematics, 19.04.2020 04:09
Questions on the website: 13722362