Question
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,
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.
IN JAVA PLEASE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started