Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi-Lo Game (with Dice) In this homework, you will be writing a program, which repeatedly asks the user if the next roll will be higher

Hi-Lo Game (with Dice)

In this homework, you will be writing a program, which repeatedly asks the user if the next roll will be

higher or lower than the last dice roll. You will continually play until the user types quit on a line by

itself. The game will remember how many times you were successful and how many times you tried

and report the ratio of success to tries after the user quits.

In addition, the game will maintain persistence: remembering you and how many times youve played

even after exiting (by maintaining a file). You will need to ask the user for their user name prior to

playing and use that to record their results in a file. If the user has played before, the number of

successful tries and the number of tries is in a file named after the user with a .txt extension. If not, we

start at zero for that user. Once the user quits, youll need to save the new results into the correct file.

a) (10%) Your dialog should be clear each time you ask for something what you are asking for and output

the result. Note: you should also inform the user what you consider correct and what will end the

game for the user.

b) (20%) Logic reading/determining the hi/lo/quit (in its own method)

c) (20%) Logic providing the dice rolls(note: youll need a dice roll to begin)should be in its own method

d) (30%) Logic providing the persistence (3 methods) which includes:

i) Determine if the file exists (1 method)

(1) Hint: File has a method called exists() which returns true or false depending on whether

or no the file exists

ii) Opening the file, reading the number correct and the number of tries (each on their own line) (NO METHOD)

iii) Once finished, rewriting the file so that it contains current data ( 1 method)

e) (20%) The logic providing the rest of the result (managing the play, keeping score, calculations)

f) Name your program: DiceHILO.java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions