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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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