Write a program that creates an enumeration representing

Assignment Help JAVA Programming
Reference no: EM13334089

Pig - Dice Game

Gameplay

On a turn, a player rolls the die repeatedly until either:

A 1 is rolled

The player chooses to hold (stop rolling)

If a 1 is rolled, that player's turn ends and no points are earned.

If the player chooses to hold, all of the points rolled during that turn are added to his or her score.

Scoring Examples

Example 1:Sherri rolls a 3 and decides to continue. She then chooses to roll two more times (6, 1). Because she rolled a 1, Sherri's turn ends and she earns 0 points.

Game End

When a player reaches a total of 100 or more points, the game ends and that player is the winner.

However, we are going to create a modified version of this game where we are going to simulate 6 rolls in a row and determine if they have won or not.If any of those dice are 1, then the player loses. However, if none of the dice are 1, then it we should total the dice and print out their score.If they score over 20, then we are going to say they win.

·Note for all you purists out there, we will revisit this game when we have loops and if/else statements to make it more robust.
Below is the pseudocode to help start this process:

https://pastebin.com/xPj4AKcL

Program 2

Bacon Eater

The BaconEater class belowcontains a partial program that computes the cost of buying bacon at the store. Create the class and do the following:

1.Study the comments to determine what to do (look at the pastebin link below).
2.Add the import statements to import the DecimalFormat and NumberFormat classes.
3.Add the statement to declaremoneyto be a NumberFormat object as specified in the comment.
4.Add the statement to declarefmtto be a DecimalFormat object as specified in the comment.
5.Add the statements to print a label in the following format (the numbers in the example output are correct for input of138perpoundand324lbsUsetheformattingobjectmoneytoprinttheunitpriceandtotalpriceandtheformattingobjectfmttoprinttheweightto2decimalplaces
***** Bacon Eater *****

Sales Price:138perpound
Weight: 3.24 pounds
TOTAL:447

https://pastebin.com/9cFHYHua

** Enhance your program a bit so that you get the weight of 3 different bacon orders, calculate their sales price and the average sales price, weight, and cost per pound.

Program 3

Playing With Money

Write a program that creates an enumeration representing all the coins that we have in the US Currency.From there, you are going to ask the user for a dollar and cents amount.You are going to figure out the coins that make up the dollar amount entered.Then, you will multiply the coin by the ordinal value of the each number in the enumeration.

Sample Output might look like this:

How much money do you want to convert? 3.45

3 Dollar coins
0 Fifty Cents
1 Quarter
2 Dimes
1 Nickel
0 Pennies
The new value is: 1 + 4 + 3 + 15 = 23
The pseudocode is listed here:
https://pastebin.com/Av4wLfs8

Reference no: EM13334089

Questions Cloud

Explain reaction spontaneous at standard conditions : At what temperatures is this reaction spontaneous at standard conditions. Assume that ?H° and ?S° do not depend on temperature.
Find how many forces act on the crate : A rocket, away from all gravitational forces, accelerates upward at an acceleration of 12.8m/s^2. On its main deck is a crate with a mass of 81.6kg. How many forces act on the crate
What will be the par value of the holdings in the 20-year : If a firm remains in business indefinitely, the pension obligation will resemble a perpetuity. Suppose, therefore, that you are managing a pension fund with obligations to make perpetual payments of $3.0 million per year to beneficiaries.
What is an imaginary number : Complex numbers are what you get when you add real and imaginary numbers. What is an imaginary number? How are they different or similar to real numbers? What applications do they have?
Write a program that creates an enumeration representing : Sherri rolls a 3 and decides to continue. She then chooses to roll two more times (6, 1). Because she rolled a 1, Sherri's turn ends and she earns 0 points.
Average amount in the bottles is computed : An automated filling process used by a soft drink manfacturer fills bottles marked as containing 32 ounces. The amount, X, in the bottles is assumed to be a normally distributed random variable. To monitor the process, a random sample of 25 bottles i..
What would be the expected return on a zero-beta stock : Suppose the yield on short-term government securities (perceived to be risk-free) is about 7.76%. Suppose also that the expected return required by the market for a portfolio with a beta of 1.0 is 17.76%
What is the present value and duration of the obligation : You will be paying $11,800 a year in tuition expenses at the end of the next two years. Bonds currently yield 9%. What is the present value and duration of your obligation
Find what is the percentage change in the bonds price : A(n) seven-year bond has a yield of 8% and a duration of 7.199 years. If the bond's yield changes by 25 basis points, what is the percentage change in the bond's price

Reviews

Write a Review

JAVA Programming Questions & Answers

  Reads in up to 1000 non-negative integers

Write a program that reads in up to 1000 non-negative integers and displays distinct numbers (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read each number and store it in an array if it is new. If the number is alread..

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  Create a class named blooddata that includes fields

Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor (the factors are + and -). Create a default constructor that sets the fields to "O" and "+", and an overloaded c..

  Identify the 5 code elements

Identify the 5 code elements for a Password class. Things like: class, instance, and final variables, accessor and mutator method, public and private specifiers for methods and member variables.i need to provide detail and descriptions for each code ..

  Make a program in java language with classes

Make a program, in JAVA language with classes, that simulates health attending in one business day, according to the information just given.

  Java project

Prompt the user for an int between lower and upper boundary.

  Java program that computes a ride you took in taxi

Write a java program that computes a ride you took in taxi. The bill computed based on an initial cost plus the taxi charges 0.5 dirham every 0.3 km.

  Ask the user to enter a positive non-zero integer value.

Write a program which aske the user to Enter a positve non-zero integer value. if the value enterd zero or negative print as error message and end the program; otherwise, use the integer to call a method displayPattern(n) which must display the follo..

  The letters of the alphabet a through z

The letters of the alphabet A through Z can be represented in Morse code. Each letter is represented by a combination of up to four dots and/or dashes, as shown below. Use Java to write and run a console-window program that can convert an English ..

  Write a program that prompts for and accepts input of test

write a program that prompts for and accepts input of test ggrades that are integers between 0 and 100. For each numerical test grade,  program should display a corresponding letter grade

  Implement a probability calculator for the standard normal

implement a probability calculator for the standard normal distribution using GUI.

  Develop the implementation file student.cpp

Required to implement the class to develop the implementation file Student.cpp that conforms to the following specifications

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd