Use Java Language to complete the program:
Section 4: Rolling Game
In this scenario use input, random, while loops, methods and boolean data to make a dice rolling game.
This is what the game should have:
1. The Player starts with $100 at the beginning of the game
2. The Computer rolls a dice between 1 and 6 and the result is shown/printed
3. Make sure the Player also rolls a dice between 1 and 6, but its not shown yet
The Player can bet any amount between 0 Dollars and the amount of Dollars $ that they have.
The Player can select if the dice role will be HIGHER, LOWER or TIE (correctly guessing higher or lower wins 2x their bet, correctly guessing TIE wins 4x their bet)
4. Make sure to show what the Player rolled - this determines whether they Won/Lost/Tied
5. Make sure to update the players money:
if the Player wins their bet, update their Dollar $ amount
if the Player loses their bet, update their Dollar $ amount
6. The game should continue (loops) until the Player is out of money or the Player enters a sentinel value

Answers

Answer 1

Here's the Java program for the Rolling Game with input, random, while loops, methods, and boolean data:

```

import java.util.Scanner;

import java.util.Random;

public class Rolling Game {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

Random rand = new Random();

int playerMoney = 100;

boolean keepPlaying = true;

while(keepPlaying) {

int computerRoll = rand.nextInt(6) + 1;

System.out.println("Computer rolled: " + computerRoll);

System.out.print("Enter your bet amount (0 - " + playerMoney + "): $");

int bet = input.nextInt();

if(bet == 0) {

keepPlaying = false;

break;

}

System.out.print("Guess if the roll will be HIGHER, LOWER or TIE: ");

String guess = input.next().toUpperCase();

int playerRoll = rand.nextInt(6) + 1;

System.out.println("You rolled: " + playerRoll);

if(computerRoll > playerRoll && guess.equals("LOWER") ||

computerRoll < playerRoll && guess.equals("HIGHER") ||

computerRoll == playerRoll && guess.equals("TIE")) {

System.out.println("Congratulations! You won $" + (bet * 2));

playerMoney += (bet * 2);

} else {

System.out.println("Sorry! You lost $" + bet);

playerMoney -= bet;

}

if(playerMoney <= 0) {

System.out.println("You're out of money! Game over.");

keepPlaying = false;

} else {

System.out.println("You now have $" + playerMoney);

}

}

input.close();

}

}

```

The program starts with initializing the playerMoney to 100 and keepPlaying to true. It then enters a while loop that continues until the player enters 0 for bet or runs out of money. Inside the loop, the computer rolls a dice using random class and the result is shown using println statement. The player enters the bet amount between 0 and playerMoney using the Scanner class.

The player then guesses whether the roll will be HIGHER, LOWER or TIE. The player rolls the dice and the result is shown using println statement. If the player guesses correctly, the player's money increases and the message "Congratulations! You won $" along with the amount won is shown using println statement. Else, the player's money decreases and the message "Sorry! You lost $" along with the amount lost is shown using println statement.

If the player's money is less than or equal to 0, the message "You're out of money! Game over." is shown and the loop ends. Else, the player's money is updated and the message "You now have $" along with the updated amount is shown using println statement. Finally, the Scanner class is closed and the program ends.

Learn more about Java program: https://brainly.com/question/17250218

#SPJ11


Related Questions

Create a list that will contain 14 elements, with the first 12 elements having the value “badger” and the last two elements having the value “mushroom”.

Answers

A list that contains 14 elements, with the first 12 elements having the value “badger” and the last two elements having the value “mushroom” is as follows:

list1 = ["badger", "badger", "badger", "badger", "badger", "badger", "badger", "badger", "badger", "badger", "badger", "badger", "mushroom" "mushroom"]

Code explanation

List are used to store multiple items in a variable. The items stored accommodate different datatype. List are represented with a square bracket "[]". The elements stored are placed inside the square brackets.

The python list is stored in the variable list1The python list has the first 12 elements as "badger" and the last two elements as "mushroom".

learn more on list here: https://brainly.com/question/24941798

In cell K2 enter a formula using the IF and OR functions, as well as structured references, to determine if Adam Moriarty can be a group leader. a. The IF function should first determine if the staff member’s Service Years is greater than 3 OR if the staff member’s college graduate status is "Yes". Remember to use a structured reference to the Service Years and the College Graduate columns.

Answers

Solution :

The value of the K2 cell is filled by IF and OR functions with structured references as :

\(K2=IF(OR([CBF\ \text{Staff[ Service years]} > 3, \text{CBF Staff[College graduate]}="Yes"),"Yes","No")\)

Now if the syntax of the formula is not provided, then we can use :

\($K2=IF(OR([[\text{Service Years}]]>3,[[\text{College Graduate}]]="Yes"),"Yes","No")$\)

The staff member are required to satisfy one of the two or both the conditions so as to become a group leader. The conditions are :

---   staff member should served for more than 3 years

--- staff members should be college graduate

In cell K2 enter a formula using the IF and OR functions, as well as structured references, to determine
In cell K2 enter a formula using the IF and OR functions, as well as structured references, to determine

textspeak consists of?

Answers

Textspeak is a type of shorthand language used in texting, instant messaging, and social media. It is a form of written communication that uses abbreviations, acronyms, and symbols to represent words, phrases, or ideas.

Examples include: LOL (laugh out loud), BRB (be right back), and :) (smiley face).

Textspeak is a type of shorthand language commonly used in digital communication. It is used to quickly convey a message in a limited number of characters and often replaces full words and phrases with abbreviations, acronyms, and symbols.

Textspeak is a valuable tool for quickly communicating thoughts and messages in digital spaces, and its use is becoming increasingly popular.

Learn more about emoticons: https://brainly.com/question/22886600

#SPJ4

most 4 year colleges want an applicant's scores for all the following except

Answers

Answer:

IQ

Explanation:

what is the first step in installing the pivot pin and take-down assembly? fte

Answers

The first step in installing the pivot pin and takedown assembly is to insert the detent spring and detent, then slide the takedown assembly onto the receiver.

The first step in installing the pivot pin and takedown assembly is to insert the detent spring and detent into the receiver's small hole.

Then, carefully slide the takedown assembly onto the receiver, aligning the pivot pin holes.

Insert the pivot pin halfway through the receiver until you can see the pivot pin detent hole, then push in the detent and hold it down as you continue to push in the pivot pin.

Once the pivot pin is fully pressed in, twist it and make sure the detent clicks into place.

Finally, test the pivot pin and takedown assembly by pushing and pulling them to ensure they move smoothly and securely.

To learn more about pivot element visit:

https://brainly.com/question/31261482

#SPJ4

use the redo feature to reverse the most recent action you have changed. group of answer choices true false

Answers

The statement "Use the redo feature to reverse the most recent action you have changed" is false.

The redo feature is used to repeat an action that was undone using the undo feature. It allows you to restore a previous action that was undone, not reverse the most recent action you have changed. The undo feature is used to reverse or cancel the most recent action you have performed When you undo an action, it is removed from the current state, and you can then use the redo feature to bring back that action if needed. However, the redo feature cannot reverse the most recent action directly. To reverse the most recent action, you would typically use the undo feature. This allows you to step back to a previous state before the action was performed. The redo feature comes into play if you change your mind and want to reapply the action that was previously undone.

Learn more about  The redo feature  here:

https://brainly.com/question/1569443

#SPJ11

Why would you clear a computer’s cache, cookies, and history?

to ensure that your computer’s settings and security certificates are up to date
to ensure that your computer’s settings and security certificates are up to date

to make sure that nothing is preventing your computer from accessing the internet
to make sure that nothing is preventing your computer from accessing the internet

to prevent intrusive ads from delivering malware to your computer
to prevent intrusive ads from delivering malware to your computer

to ensure that they are not clashing with the web page or slowing your computer down

Answers

Answer:

prevents you from using old forms. protects your personal information. helps our applications run better on your computer.

large carriers like sprint, at&t, and xo communications exchange internet traffic freely at physical locations called ________.

Answers

The answer is Internet Exchange

The Hypertext Markup Language (HTML) is a language for creating A. Networks B. Webpages C. Protocols D. All of the Above Which of the following is not a component of hardware?

Answers

Answer is B.

None of the options is a hardware component. On the other hand web pages and protocols can be considered a software component. I hope this helps.

Use the drop-down menus to describe the Time Zone feature in the Outlook calendar.

Outlook only allows a maximum of
time zones to be set in a calendar.

Time zones are set by accessing the calendar options

When creating a second time zone, it is helpful to
both.

Answers

Answer:

✔ two

✔ in Backstage view

✔ label

Explanation:

on edg

Answer:

two, in Backstage view, label

Explanation:

_____ memory improves processing by acting as a temporary high-speed holding area between the memory and the CPU.

Answers

Answer:

Cache memory improves processing by acting as a temporary high-speed holding area between the memory and the CPU.

A four byte hexadecimal number beginning with lower order byte is stored from memory location D055 H. Write a program in assembly language to check whether given number is palindrome or not. If the number is palindrome then HL register pair must contain AAAA H else FFFF H

Answers

How would I write a program, that’s hard

A social studies teacher weighs scores on tests at 50 percent, homework at 30 percent, and class participation at 20 percent. Which student will receive the highest grade based on this grading system? Sophia gets 75 percent on tests, completes all of her homework, and attends half of the classes. Maya gets an 88 percent on tests, completes all of her homework, and sometimes participates in class. Amit gets a 65 percent on tests, completes all of his homework, and participates in class regularly. Elias gets a 97 percent on tests, does all of his homework, and participates in class regularly. 20 pointssssssssssssssss

Answers

Answer:

D

Explanation:

Edge2020

Answer:

It is D

Explanation:

onedge

can someone tell me what to do i’m kinda stuck and don’t know what he’s telling me to do pls ill give brainlist and points

can someone tell me what to do im kinda stuck and dont know what hes telling me to do pls ill give brainlist

Answers

Answer:

Well a debtor is basically someone owing someone money, basically someone in debt. He’s telling cup head boy to take care of the people who owe him or someone else their or his money. Thats basically it.

what modulation type is used for computer networks?

Answers

Answer: digital

Explanation:

Joseph Haydn's Symphony No. 101 in D Major, composed in 1794, has what nickname, after the rhythmic two-note sequence that repeats throughout the second movement?

Answers

101 has a reason for its quirky nickname…

Listen to the bassoons and the strings in the second movement of Haydn's Symphony No. 101, nicknamed 'The Clock', and you'll hear something quite striking. That incessant rhythmic pulse sounds so much like a timepiece going round and round it was given the perfect moniker.

Which of the following is a country that cruise ships commonly sail under the flag of?
O United States
O Canada
O Panama
O South Africa
< Previous

Answers

Answer:

Panama

hope this helps!

given an avl binary search tree, find and print the value of the node at the kth index in the tree. maximum time complexity: o(n) assumptions: none example: tree:

Answers

To find and print the value of the node at the kth index in an AVL binary search tree, you can perform an in-order traversal of the tree while keeping track of the index count. Here's an example implementation in Python:

class Node:

   def __init__(self, value):

       self.value = value

       self.left = None

       self.right = None

       self.count = 1  # Number of nodes in the subtree rooted at this node

def kth_node_value(root, k):

   if root is None:

       return None

   if k <= root.count:

       return kth_node_value(root.left, k)

   elif k > root.count + 1:

       return kth_node_value(root.right, k - root.count - 1)

   else:

       return root.value

# Example usage:

# Assuming you have an AVL binary search tree with the desired kth index

root = Node(4)

root.left = Node(2)

root.right = Node(6)

root.left.left = Node(1)

root.left.right = Node(3)

root.right.left = Node(5)

root.right.right = Node(7)

k = 3

kth_value = kth_node_value(root, k)

print(f"The value at the {k}th index is: {kth_value}")

In this example, the function kth_node_value traverses the AVL tree recursively, checking the index count against the k value to determine whether to move to the left or right subtree or return the current node's value. The time complexity of this approach is O(n), where n is the number of nodes in the tree.

Learn more about binary here

https://brainly.com/question/30049556

#SPJ11

Which of the following is not a benefit that can be provided by using IP telephony. A. Decrease network utilization. B.increase user productivity

Answers

Reduced network use cannot be achieved by using IP telephony. Technologies that exchange voice, fax, and other sorts of information via a multitude of protocols are known as "IP telephony" (Internet Protocol telephony).

WHAT IS IP telephony?

Technologies that exchange voice, fax, and other sorts of information via a multitude of protocols are known as "IP telephony" (Internet Protocol telephony). Typically, these technologies use the Public Switched Telephone Network (PSTN).

The call is sent as a sequence of packets over a LAN or the Internet to avoid PSTN fees.

In the middle to late 1990s, changes in the telephone and communications sectors were first influenced by the Internet and the TCP/IP protocol.

The Internet Protocol has essentially replaced all other data communication methods.

Today, all providers of communication services, whether fully or in part, employ IP infrastructure for their voice services. The bulk of firms have already switched from PSTN to VoIP for internal communications (Voice over IP).

Hence, Reduced network use cannot be achieved by using IP telephony.

learn more about IP TELEPHONY click here:

https://brainly.com/question/14255125

#SPJ4

What are some ways tables can be inserted into a document? Check all that apply

•drawing table
•using a dialog box
•using quick tables
•using the save options
•converting an image to a table
•adding an excel spreadsheet

Answers

Answer:

drawing tableusing quick tablesconverting an image to a table.

Answer:

its 1. 2. 3. 6.

Explanation:

A type of topology in which all the systems a connected a main cable ​

Answers

Answer:

Bus topology uses one main cable to which all nodes are directly connected. The main cable acts as a backbone for the network. One of the computers in the network typically acts as the computer server. The first advantage of bus topology is that it is easy to connect a computer or peripheral device.

Array must be initialized with a brace-enclosed initializer.
a. true
b. false

Answers

It is TRUE to state that Array must be initialized with a brace-enclosed initializer.

What is the explanation for the above?

In many programming languages, including C++, arrays must be initialized with a brace-enclosed initializer. This initializer specifies the initial values of the elements in the array. For example, to initialize an array of integers in C++, you might use code like this:

int myArray[] = {1, 2, 3, 4, 5};

This initializes an array with 5 elements, with the values 1, 2, 3, 4, and 5. Without the brace-enclosed initializer, it is not clear what the initial values of the array elements should be.

Learn more about Array at:

https://brainly.com/question/30757831

#SPJ1

commerce sites with minimal needs can use externally hosted stores that provide software tools to build an online store on a hostâs site. t/f

Answers

"The given statement is True", commerce sites with minimal needs can indeed use externally hosted stores that provide software tools to build an online store on a host's site. These platforms, such as Shopify, WooCommerce, and BigCommerce, offer a convenient and cost-effective way for small businesses to establish and maintain their online presence.

These externally hosted solutions typically include various features and functionalities, such as website design, product management, shopping cart, payment processing, and customer support, allowing businesses to focus on their core operations while outsourcing the technical aspects of running an e-commerce store.

By utilizing these tools, businesses can save time, effort, and resources in comparison to building a custom online store from scratch. Additionally, these platforms often have built-in security measures and regular updates, ensuring a secure and up-to-date online shopping experience for customers.

Overall, externally hosted stores are a viable option for commerce sites with minimal needs, offering a comprehensive set of tools to create and manage an online store effectively.the correct option is true.

To learn more about, hosted

https://brainly.com/question/24852211

#SPJ11

Which of the following is listed on a high school transcript?
O A. Employment history
O B. Immunization information
O C. Club membership
O D. Sports participation

Answers

i would be b. i hope it helps

what permission must be granted for a user to run procedures within a database?

Answers

Answer:

To grant permissions on a stored procedure

From Stored Procedure Properties, select the Permissions page. To grant permissions to a user, database role, or application role, select Search. In Select Users or Roles, select Object Types to add or clear the users and roles you want.

Tara needs to select all of the text in a Word document. Which keyboard shortcut will achieve this goal? Ctrl A Ctrl E Ctrl Esc Ctrl R.

Answers

It's CTRL + A ......................... "i'm just putting these full stops, because i can't answer with at least 20 characters. so" (:

Consider the following code segment:

ArrayList scales = new ArrayList ();
scales.add("DO");
scales.add("RE");
scales.add("MI");
scales.add("FA");
scales.add("SO");
String swap = scales.get(2);
scales.remove(2);
String set = scales.remove(scales.size()-1);
scales.add(scales.get(0));
scales.set(0,set);
scales.add(scales.size()/2, swap);

Which of the following represents the value of scales after the code has been executed?


[SO, RE, FA, DO]


[SO, RE, MI, FA, DO]


[SO, RE, MI, DO]


[FA, RE, MI, DO]


[FA, SO, RE, MI, DO]

Answers

The scales value after code execution will be [FA, SO, RE, MI, DO].

How to Perform Scale Programming?

The scale schedule must be used for a predetermined period (temporary), as it will not generate an event for eSocial.

To include it, access the menu: Schedules/ Schedule Schedules.

Example: If an employee makes the 0002 scale, it can be informed that in a certain period he will make the 0003 scale. And at the end of this period, the system will consider the Contract's initial scale again.

Scheduling can be done individually or collectively. It can also be in a single day or in a range of days.

Learn more about code execution in https://brainly.com/question/16698901

Answer:

[SO, RE, MI, FA, DO]

Explanation:

Consider the following code segment:ArrayList scales = new ArrayList ();scales.add("DO");scales.add("RE");scales.add("MI");scales.add("FA");scales.add("SO");String

Can anyone give me Nitro type gold please? My NT account is trapkaybee061307

Answers

Answer:

no

Explanation:

Answer:

nah man I'm only fourteen and I don't have money

Explanation:

you can add me on Ro.blox

here is my username

untoten_115

What determines strength of magnetic field?

Answers

The magnitude of magnetic field is directly proportional to the strength of the electric current flowing in the wire.

magnetic field strength, also known as magnetic intensity or magnetic field intensity, is the portion of a material's magnetic field that is generated by an external current and not inherent to the material. It is measured in amperes per meter and expressed as the vector H. H is defined as H = B/M, where B is the magnetic flux density, which is a measure of the actual magnetic field that exists within a material and is defined as the concentration of magnetic field lines, or flux, per unit cross-sectional area. The permeability of the magnetic field and the magnetization is M. The magnetic field H can be thought of as the magnetic field that is created by the current that flows through wires, and the magnetic field B can be thought of as the entire magnetic field, including the contribution M that is made by the magnetic properties of the materials. The magnetizing field H is quite weak when a current flows through a wire wrapped around a cylinder made of soft iron. However, the actual average magnetic field (B) in the iron could be thousands of times stronger because B is greatly enhanced by the alignment of the many tiny natural atomic magnets in the iron in the direction of the field.

To know more about magnetic field visit https://brainly.com/question/14848188?referrer=searchResults

#SPJ4

within the dns hierarchy, which term refers to the dns servers just below the dns root? A. Top-level domain servers
B. WINS server
C. Domain controllers
D. Second-level domain server

Answers

"within the dns hierarchy, which term refers to the dns servers just below the dns root" is A. Top-level domain servers.

These servers are responsible for managing the top-level domains (TLDs) such as .com, .org, .edu, etc. They are the first step in resolving domain names into IP addresses. When a user types in a domain name, the request is sent to the top-level domain server, which then directs the request to the appropriate second-level domain server. Overall, the DNS hierarchy is crucial for ensuring that content loaded within the DNS hierarchy is properly resolved and directed to the correct destination.

learn more about Top-level domain servers. here:

https://brainly.com/question/11030987

#SPJ11

Other Questions
What are the slope and y value at the y-intercept of the line y 3x 5? Record the following transactions for Mouser Pet Foods, Inc., in the financial statements effects template below (in thousands).Sell stock in company for $78,000Obtain long-term bank loan of $30,000.Purchase manufacturing equipment for $20,400 cash.Rent manufacturing and warehousing space and pay $34,800 in advance for the year.Purchase $30,000 of inventory, paying $6,000 in cash and the remaining amount on credit.Sell half of the inventory purchased in Transaction e for $33,900 on account.Pay $24,000 to creditors.Make loan payment of $4,800 of which interest is $480 and the rest is principal.($ thousands)Balance SheetIncome StatementTransactionCash Asset+Noncash Assets=Liabil-ities+Contrib. Capital+EarnedCapitalRev-enuesExpen-ses=NetIncomea)==b)==c)==d)==e)==f)==g)==h)== Tony decides to use observation. He visits 10 students and observes them doing schoolwork at home for 30min. If a student looks at social media during that time, he notes it.(a) Provide an advantage of using observation.(b) Provide a disadvantage of using observation.(c) What are the sample and population for Tonys research?(d) Suppose 3 of the 10 students looked at social media during the observation. What conclusion couldTony make about the percent of high school students who use social media while doing schoolwork? WHEREDoes government get it's power? 10 LITUL Practice & Problem Solving X) 5.2.PS-21 Question Help How is the word term used to describe a ratio relationship and in the context of an expression? Choose the correct answer below. O A. The terms of a ratio are the quantities being compared. The terms in an expression are the parts that are separated by plus or minus signs. B. The term of a ratio is the sum of the quantities being compared. The terms in an expression are the parts that are separated by plus or minus signs. OC. The terms of a ratio are the quantities being compared. The terms in an expression are the parts that are separated by multiplication or division signs. OD. The term of a ratio is the sum of the quantities being compared. The terms in an expression are the parts that are separated by multiplication or division signs. Click to select your answer and then click Check Answer. All parts showing Clear All Check Answer Review progress Question 9 of 12 Back Next Suppose the variable x is represented by a standard normal distribution.What value of x is at the 70th percentile of the distribution? Equivalently, what is the value for which there is a probability of 0.70 that x will be less than that value?Please round your answer to the nearest hundredth. imagine that you got an opportunity to meet one of your favourite actress for about an hour narrate about how you met him or her what you did and how you felt about the meeting The Second Great Awakening could best described as Damon plotted a point on the grid. He says that the first number of the ordered pair is negative and the second number is positive. What is damons point when consumer income decreases but the price of each good does not change what happens to the budget line? Which of the following types of glacial erosion would be most effective at eroding material if the ice is flowing over many meters of glacial till? Consider the relevance, significance, advantages and disadvantages, and strengths and weaknesses of having a cell-mediated and a humoral response. Detail the significance of the speed and specificity of the response in relation to the defense process and progression of the disease in the body. Current Attempt in Progress Wildhorse Construction Company uses the percentage-of-completion method of accounting. In 2020. Wildhorse began work under contract with a contract price of $1,550,000. Other details follow: Assuming the same facts as those above except that Wildhorse uses the completed-contract method of accounting what portion of the total contract price would be recognized as revenue in 2021 ? Revenue recognized in 2021 Kayla hikes 25 meters in 13.7 seconds. Which of the following is closest to how far she will hike in 6 minutes , if she maintains the same pace?A: 650 meters B: 10 metersC: 150 meters D: 9000 meters The graph shows the distribution of energy in the particles of two gas samples atdifferent temperatures, T and T. A, B, and C represent individual particles.Number of ParticlesATTKinetic EnergyActivation EnergyB11Based on the graph, which of the following statements is likely to be true? mark the wheat and rice product in areas in the map of IndiaPLS MAKE AND SHOW ON THE MAP I will definitely mark you brainliest what did radar astronomers find in the polar regions of mercury? Carlton is solving a linear equation using the steps shown.Equation: Negative 4 x + 12 = negative 6 xStep 1: Add 4x to both sides: 12 = negative 6 x + 4 xStep 2: Combine like terms: 12 = negative 2 x Name 2 body systems that interact to maintainhomeostasis in the human body and explain how they do how were the accomplishment of Simon Bolivar and Jose de San Martin similar?