Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Please Problem 1) Name this file H4P1. In crypt-arithmetic puzzles, mathematical equations are written using letters. Each letter can be a digit from 0

Java Please

Problem 1) Name this file H4P1. In crypt-arithmetic puzzles, mathematical equations are written using letters. Each letter can be a digit from 0 to 9, but no two letters can be the same. Here is a sample problem: SEND + MORE = MONEY A solution to the puzzle is S = 9, R = 8, O = 0, M = 1, Y = 2, E = 5, N = 6, D = 7. In a class called H4P1, write a program that finds and prints all solutions to the crypt-arithmetic puzzle of the following: TOO + TOO + TOO + TOO = GOOD Problem 2) The game of Pig is a simple two-player dice game in which the first player to reach 100 or more points wins. Players take turns. On each turn, a player rolls a fair six-sided die: If the player rolls a 1, then the player gets no new points and it becomes the other players turn. If the player rolls 2 through 6, then he or she can either: ROLL AGAIN or HOLD. At this point, the sum of all rolls is added to the players score and it becomes the other players turn. In a class called H4P2, write a program that plays the game of Pig, where one player is a human and the other is the computer. When it is the humans turn, the program should show the score of both players and the previous roll. Allow the human to input R to roll again or H to hold. The computer program should play according to the following rule: keep rolling when it is the computers turn until it has accumulated 20 or more points for that turn, then hold (of course, if the computer rolls a 1, then it is the humans turn again). If the computer wins or rolls a 1, then the turn ends immediately. Allow the human to roll first.

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago