logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Description of the module molkky_program

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Objects and classes

 

Description of the module molkky_program

to the module molkkyjwogram a main program that runs the game of Mölkky. This program takes care of all the communication with the user, in other words, it

asks for inputs and prints the needed information. First, the program asks Íòr the names of the players until the user inputs an empty line. The program creates Player

objects with these names and a new game object (MolkkyGame). Then, the program goes through the game round by round. It goes through the following things during

each round:

I. Goes through the turns of every player that is still in the game in the following way:

I. In each player’s turn it asks for the number of the skittles the player bu If only one skittle was hit, the program asks also for the number marked on that

skittle.

2. Adds points to the player. Ilonly one skittle was hit, player gets as many points as it is marked on the skittle, otherwise hey -‘ore the same as the number of

the skittles hitten.

3. Checks that the nlaver is still in the anie ¡filie nlaver is nor in the pame anvmore they are aMecl to the rankine list If the niaver hns lost, the program

prints [The player nm1 hc micced  timec in  row. and rThe n1uer’ nme1 has to leave the game. . Iftheplayerhaswon,

theprogramprints [The player name] has se points, and [The player name] won! .

2. Checks how many of the players are still in the game. If (here is one or less players left, the program ends the game.

3. Increases the number of played rounds -count by one.

4. Prints the score hoard. A tip: use the method tr_ of the class Molkky(ìame.

When the game has ended, the program prints the ranking of the players.

Sec the example execution for the specific outputs of the program in dit’ferent situations.

Error handling

Error handling is done in the main program. The program should handle the following errors:

. The user inputs less than 2 player names. The program prints

You have to enter at least two players.

and asks for the names until the user inputs at least two names.

. The number of the skittles the number marked on the skittle the user inputs, cannot be convetied to integer. The program prints

Invalid integer! Enter a number again:

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

672 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

978 Answers

Hire Me
expert
Husnain SaeedComputer science

981 Answers

Hire Me
expert
Atharva PatilComputer science

894 Answers

Hire Me