Java

 

Java Code

A Game of 21
Write a program that uses the Die class that was presented in Chapter 4 to write a program
that lets the user play against the computer in a variation of the popular blackjack card
game. In this variation of the game, two six-sided dice are used instead of cards. The dice
are rolled, and the player tries to beat the computer’s hidden total without going over 21.
Here are some suggestions for the game’s design:
● Each round of the game is performed as an iteration of a loop that repeats as long as
the player agrees to roll the dice, and the player’s total does not exceed 21.
● At the beginning of each round, the program will ask the user whether he or she wants
to roll the dice to accumulate points.

● During each round, the program simulates the rolling of two six-sided dice. It rolls
the dice first for the computer, and then it asks the user if he or she wants to roll. (Use
the Die class that was demonstrated in Chapter 4 to simulate the dice).
● The loop keeps a running total of both the computer and the user’s points.
● The computer’s total should remain hidden until the loop has finished.
● After the loop has finished, the computer’s total is revealed, and whoever the player
with the most points without going over 21 wins.

Additional requirements:

Solution, must be object oriented design remonstrated with a driver.
Welcome the user with a message that you read from a file called "input.txt".
Write the results of the game to the terminal and also to the output file called, "output.txt" and remind the user to look at that file if he/she wants to.
You only need to submit the designs, input/output files ( if applicable ) source code ( .java and not the project or the .class ) files of all the classes you'll implement and the driver program for the problem. ( Do not submit the whole project folder and irrelevant files. )

Answers

Related Questions

None...

World War II and the Cold War defined at least one, if not two or three, generations of Americans. What influence do you think the media played in cra...

None...

7 pages paper talks about ( Voters Rights Act Impacting Today’s Voting Equality )  please check the attached for more explanation about it, also yo...

None...

The Assignment:  Write an essay that uses a clearly defined thesis statement to make an argument (based on one of the two topics listed below) that m...

None...

in general how it started, the weapons used, the purpose/cause of it, in what area  was it most concentrated in. Topic relates to 1950s Cuban Revolut...

None...

Describe pollice verso (thumbs down) by Jean-Leon Gerome in the Phoenix Art museum  –  two to three pages; double spaced  – Describe in your ow...

None...

I need someone that knows a lot about history and has the knowledge to write specific examples. I need a very simple tone essay since English is my se...

None...

Select one work of art from each of the following: 1. baroque religious art (about 2 pages) 2. baroque political art (about 2 pages) 3. baroque bourge...

None...

The Contenders Paper Instructions You will write a 3–4-page research-based paper that focuses on the contrasting ultimate war objectives of Kim Il-S...

None...

I need an annotated bibliography containing the analysis of 5 different academic sources surrounding the introduction of sound to cinema, with a parti...

None...

This week we are looking at understanding what works historically and in practice for reducing or eliminating warfare. Steven Pinker claims violence i...

None...

1. The French revolutionaries claimed that they were inspired by the Enlightenment philosophes.  Would the philosophes we studied back in Week 2 hav...

None...

The Supernatural Smith is clearly at great pains to play down the supernatural and mythic elements of Christianity. Why? The Centrality Of The Resurre...

None...

You will write a 1 page essay, on the Arthurian hero who appeals to you most and why. Make sure that you read the relevant sections of the books (Mo...

None...

What are the arguments for and against the united states adopting a more expansionist foreign policy? How understandings of national identity, at the...

None...

By examining the period from 1867 to 1940 please respond to the following question. Examine the changes and continuities from the Porfiriato to the re...

None...

Write one or two paragraphs on each of the following art movements of the 20th century. Select one artwork from each of the movements to explain your...

None...

select 2 art works from the so called “romantic” period of the 19th century and explain how and why these art works reflect the ideas and values o...

None...

Read the instructor’s post and reply with your thoughts. You should make an entry for each discussion no later than Wednesday.  You should also res...

None...

Research Proposal + Outline Class: Comparative World Religions Topic Over the course of the paper, the main topic that will be discussed in the unders...

None...

The power of ISIS has grown substantially since 2004 and continues to rise from the terrorist mindsets fueling this militant group. Based on history.c...

None...

Select a current event within the last six months about an internal issue in China. The topic can deal with issues such as economics, business, cultur...

None...

1. maya, the maya had many lyrical calendars that repeated at different intervals. 2. gender, matriarchies vs patriarchies TweetShareSharePin0 Shares...

None...

This assignment offers you the opportunity to compare two branches of Christianity. Create a 10- to 12-slide Microsoft® PowerPoint® presentation co...

None...

Analyze the causes of the World War I(60% of essay)and why and how the U.S. got into the war(40% of essay).   Around 1000 words Write to people who...

If you didn't find the right answer

Ask Your Questions, We'll notify you once someone answers it