Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, Twitches
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, TheBurntToast
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
image
Computers and Technology, 23.06.2019 00:40, QueenKy6050
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why. a.) student. course. callnum = "csc230"; b.) cin > > student. name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student. name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist. course. credits = 3; j.) course = studenttype. course;
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, kevin72836
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
Do you know the correct answer?
This assignment will acquaint you with the use of while loops and boolean expressions. You will crea...

Questions in other subjects:

Konu
History, 11.02.2022 08:30
Konu
Physics, 11.02.2022 08:30
Konu
Mathematics, 11.02.2022 08:30
Konu
Social Studies, 11.02.2022 08:30