Overview:This program simulates 2 people playing miniature golf. The rules state that a person cannot have more than a 5 for their score as you don’t people having to wait too long for people ahead of...

1 answer below »

Overview:


This program simulates 2 people playing miniature golf. The rules state that a person cannot have more than a 5 for their score as you don’t people having to wait too long for people ahead of them to complete their time at a hole. There are 18 holes which each player may attempt. The player with the lowest score wins the game. The program will also allow the players to move on to the next course and play another 18 holes in another game if desired by allowing the score cards for the current players to be reset.







Objectives:


The implementation of the program will demonstrate tools learned in lab assignments throughout this course. As you code this project you will bring together input, output, IF decision structures, and loops to perform the tasks to solve this situation in a single application while keeping the scores in lists.












Instructions/Requirements:


There should be two Lists to keep score for the two players of the game. There will be a maximum of 18 scores in each List for each of the two players and each score can be 0 (if the hole hasn’t been played yet) or 1-5.







Create a public method called ResetGame() that clears the scores for the player in the two Lists. It can either blank them out so nothing is in the List or blank them out and put in 18 zeros. It is up to you how you make this.





Create a public method called PlayRound() that accepts two scores into Lists of scores, one for each player. It should either set a specific hole [best way, and way that a non-intro programming class would be doing it by a chosen position passed in by a third parameter] or just add the score to the end of each list. It is up to you how you handle this.


*Important Addition to PlayRound(), if one of the numbers is above 5 you need to replace it with 5 because that is the maximum score in miniature golf for a hole.







Create a public method called TotalScore(). It should total the number of points for each player so far and display it, along with a message of who is winning with a lower score or if there is a tie





Create a public method called ShowScores(). It should show the scores so far by printing all the scores in each list separated by spaces



Example of three rounds and ShowScores() being called:

Player 1: 1 4 3

Player 2: 2 5 3





Create a public method called SaveGame() that saves all the scores for both players to 1-2 data files.





Create a public method called LoadGame() that clears the Lists and then fills them with the scores from the saved data file(s).







Main Program method:




The main method of the program should have a menu in an indefinite loop that allows the user to do the following:




New Game (Calling the ResetGame() method)



Play a round, asking the user for number of strokes 1-5 for each of the two players and then calling the PlayRound() method with them. [If you have it setting specific holes then also ask for the hole number to use and make sure it is a valid hole number or give a message about that instead of using it.]

Show the scores and the current winner by calling ShowScores() and TotalScore().

Save Game (Calling the SaveGame() method)

Load Game (Calling the LoadGame() method)

Exit Game

Make a loop that prints the menu and then ask the user for the choice they want. Then use an If Structure to only do that thing



Answered 3 days AfterNov 16, 2022

Answer To: Overview:This program simulates 2 people playing miniature golf. The rules state that a person...

Pratyush answered on Nov 19 2022
39 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here