subject

In Java Create a class named TreasureBox that contains:
(Be sure to set the appropriate access modifiers – private/public)
a. A public static double field name PTS_PER_GOLD_COIN. Set this constant to 15.0
b. A public static double field name PTS_PER_SILVER_COIN. Set this constant to 7.5
c. An int data field for the number of gold coins in the box (can be negative or
positive).
d. An int data field for the number of silver coins in the box (can be negative or
positive).
e. A double data field for total value of points of the coins contained in the treasure box
f. A private method named updateTotalPoints that has no parameters and no return
values. This method updates the attribute for the total value of points in the
treasure box based on the number of gold and silver coins and the points per each
coin. Be sure to use the constants and do not ‘hard code’ the values 15 and 7.5 in
this method. This method is an example of a helper function to be used by ALL
methods that need to update the total values of points in the treasure box.
g. A constructor that accepts two values and initializes both attributes in the following
order: number gold coins and number of silver coins. The constructor should
update the attribute for total number of points based on the number of gold and
silver coins in this treasure box. (Use your helper function!)
h. A constructor that accepts no values and initializes both the number gold coins and
number of silver coins to 0. This constructor should call the constructor you created
in the previous step with the appropriate values.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
If you have a lien on your vehicle, you cannot apply for a duplicate copy of your vehicle’s certificate of title. true or false
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Pls do you believe that the use of 3d animation has grown in feature films over the last few years? if so, do you think the trend will continue? what are the forces driving this trend?
Answers: 2
question
Computers and Technology, 22.06.2019 14:30
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
What is the name of the option in most presentation applications with which you can modify slide elements? 1. the option enables you to modify a slide element in most presentation applications.
Answers: 3
You know the right answer?
In Java Create a class named TreasureBox that contains:
(Be sure to set the appropriate access...
Questions
question
Chemistry, 22.07.2019 22:00
question
Biology, 22.07.2019 22:00
Questions on the website: 13722363