2. Name the demo file firstname_lastname_PE2 Create a program that simulates a dumpster diving game. Dumpster diving is when you search for loot in large industrial sized trash bins. In the game you will roll a ten-sided dice to determine what the user has received. Use the UML below as a guide for the Die class (Name the class Die.java). Die - sideUp: int = 10 - value: int + Die() + roll(): void + getValue(): int Below are some suggestions to aid you in designing the game: • Each round of the game is performed as an iteration of a loop that repeats as long as the player wants to "dive" for more items. • At the beginning of each round, the program will ask the user whether or not he or she wants to continue diving. • The program simulates the rolling of a ten-sided die • Each item that can be caught is represented by a number generated from the die; for example, 1 for "a half-eaten sandwich", 2 for "a left shoe", 3 for "a broken watch", and so on. • Each item the user catches is worth a different amount of points. • The loop keeps a running total of the user's loot points. • After the loop has finished, the total number of loot points is displayed, along with a message that varies depending on the number of points earned. Program must ask user if they want to dive again (-30 % if it doesn't)
2. Name the demo file firstname_lastname_PE2 Create a program that simulates a dumpster diving game. Dumpster diving is when you search for loot in large industrial sized trash bins. In the game you will roll a ten-sided dice to determine what the user has received. Use the UML below as a guide for the Die class (Name the class Die.java). Die - sideUp: int = 10 - value: int + Die() + roll(): void + getValue(): int Below are some suggestions to aid you in designing the game: • Each round of the game is performed as an iteration of a loop that repeats as long as the player wants to "dive" for more items. • At the beginning of each round, the program will ask the user whether or not he or she wants to continue diving. • The program simulates the rolling of a ten-sided die • Each item that can be caught is represented by a number generated from the die; for example, 1 for "a half-eaten sandwich", 2 for "a left shoe", 3 for "a broken watch", and so on. • Each item the user catches is worth a different amount of points. • The loop keeps a running total of the user's loot points. • After the loop has finished, the total number of loot points is displayed, along with a message that varies depending on the number of points earned. Program must ask user if they want to dive again (-30 % if it doesn't)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
create a

Transcribed Image Text:2. Name the demo file firstname_lastname_PE2
Create a program that simulates a dumpster diving game. Dumpster diving is when you search for loot in
large industrial sized trash bins. In the game you will roll a ten-sided dice to determine what the user
has received. Use the UML below as a guide for the Die class (Name the class Die.java).
Die
- sideUp: int = 10
- value: int
+ Die()
+ roll(): void
+ getValue(): int
Below are some suggestions to aid you in designing the game:
• Each round of the game is performed as an iteration of a loop that repeats as long as the player
wants to "dive" for more items.
• At the beginning of each round, the program will ask the user whether or not he or she wants to
continue diving.
• The program simulates the rolling of a ten-sided die
• Each item that can be caught is represented by a number generated from the die; for example, 1
for "a half-eaten sandwich", 2 for "a left shoe", 3 for "a broken watch", and so on.
• Each item the user catches is worth a different amount of points.
• The loop keeps a running total of the user's loot points.
• After the loop has finished, the total number of loot points is displayed, along with a message
that varies depending on the number of points earned.
• Program must ask user if they want to dive again (-30% if it doesn't)

Transcribed Image Text:1. Name the demo file firstname_lastname_PE1
Create a program that simulates tossing a penny.
Penny
-sideUp : String
+ Penny()
+toss(): void
+getSideUp():String
Use the UML above to create a class called Penny class (Name the class Penny.java).
The constructor will randomly determine the side of the penny that is facing up ("heads" or
"tails") and initializes the sideUp field accordingly.
The void method simulates the tossing of the penny. When the toss method is called, it
randomly determines the side of the penny that is facing up ("heads" or "tails") and sets
the sideUp field accordingly. (Appendix D in your textbook discusses generating random
numbers)
The method named getSideUp that returns the value of the sideUp field.
The program should create an instance of the class and display the side that is initially facing up. Then,
use a loop to toss the penny based on user input. Each time the penny is tossed, display the side that is
facing up. The program should keep count of the number of times heads is facing up and the number of
times tails is facing up and display those values after the loop finishes. Program must ask user if they
want to toss again (-30% if it doesn't)
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education