Make class called dice that has one variable called face

Assignment Help JAVA Programming
Reference no: EM132057256

A new project in your IDE. This project will contain a class that has the main mehod.

Now, make class called Dice that has one variable called face. This variable will be a number between 1 and 6 inclusive and will store the latest value when the dice is rolled. make method called Roll that save a new value between 1 and 6 into the face variable. make another method that returns the value of face.

In the same program make a new class call Player that contains a variable called score and a variable called name. make a method called SetScore that takes as a parameter a value that is used to update the score variable. make another method called GetScore that will return the value of the score variable. Add a constructor for the player class that takes a string as input and is used to set the value of the name variable.

In the main method of the program make a dice object and three player objects.

Then roll the dice once for each player. For each roll update the score of the player with the value of the dice. So after the first three rolls each player will have a different score based on the dice.

Print the score of each player.

Roll the dice again, once for each player, print the value of the new roll and add the value of the roll to the score of each player.

Repeat this two more times, in other words, the score of each player will be the sum of 4 rolls. Remember that for each time you print the value of the roll and the total score of the player.

Finally print which player has the highest score and which player has the lowest score.

Reference no: EM132057256

Questions Cloud

Design the application for print payment coupons : Design the application that would print 12 payment coupons for each of the 15 apartments
Develop a recursive method that writes a given array : Develop a recursive method that writes a given array backward. Consider the last element of the array first.
Providing a visual sample of exercise : Suppose that you have a dictionary whose words are not sorted in alphabetical order. As a function of the number, n, of words, what is the time complexity.
Providing a visual sample of exercise : Using Java and the Eclipse IDE please help me by providing a visual sample of this exercise.
Make class called dice that has one variable called face : Now, make class called Dice that has one variable called face. This variable will be a number between 1 and 6 inclusive and will store the latest value
Explain what it means to swallow an exception : Explain what it means to swallow an exception, and why that's almost never an acceptable practice.
Explain when the code in the finally clause : Explain when the code in the finally clause of a try statement is executed, and what that code typically does.
Describe advantages of the new date : Describe advantages of the new date/time API introduced with Java 8 when compared with the older date/time API that was available prior
Explain how java propagates exceptions : Explain how Java propagates exceptions and how it uses the stack trace to determine what exception handler to use when an exception occurs.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Case study - bug tracking system

A bug can be defined as an unexpected defect in a computer program. Number of faults, flaws and imperfection can be encountered in an application developed with a given technology and platform. All these bugs should be reported to the organization..

  Write a java class that asks the user to enter three numbers

CS101- Write a java class that asks the user to enter three numbers N1, N2, N3 , obtains the numbers, then calculates and displays the largest number Max followed by the text "is the largest" and the smallest number.

  Create a class representing a student

Create a second class that instantiates the first class with information about yourself. In the second class, create a class method that displays your name and GPA.

  Class named person with fields for holding a person''s name

Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields.

  Write down the java code for the bank

Write down the java code for the bank of Fraud. User is presented with menu which looks something like this: 1. Deposit 2. Withdrawal 3. Check Balance 4. Exit.

  Create the visit method and whatever other methods you see

You have been provided with a framework for a java application. It will not compile because there is a class and method missing (Visitor::visit). Your assignment is to create the visit method and whatever other methods you see fit. There are some ..

  How do you arrange passenger on flight sits

Millions of commercial airline flights cross the world's cities every year, and each one of these flights must solve what seems like a simple problem: how do you arrange where each passenger on one of those flights sits

  Java programming using netbeand

Java Programming using Netbeand- In this assignment, you will be asked to demonstrate what you have learned in the Discussion Board in terms of vector, wrapper classes, conversion, and collection data structures by writing and implementing Java co..

  Iness reviews you read on the internet

How much of your purchasing decision is influenced by product/business reviews you read on the Internet? Do you or would you pay for professional

  Create a java class namedtextprocessorgui

Create a Java class namedTextProcessorGUI. Provide a main() function that creates and displays an instance ofTextProcessorGUI. I recommend you write this class as a subclass ofJFrame.

  What are differences between instance and class variables

What are the differences between instance and class variables? What is an overloaded method?

  Create a class called bankaccount

For your new program (#5 above), create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two constructors, as follows:

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