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, 22.06.2019 01:40
When the pc version of the spreadsheet program became available, the ibm pc quickly became the top-selling personal computer?
Answers: 3
question
Computers and Technology, 22.06.2019 05:10
Read the code below. what will the computer print if the input for year_variable is 1700? if year_variable == 1776: print("your answer is correct. the declaration of independence was signed in “year_variable”.") elif year_variable < 1776: compute_variable = 1776 - year_variable. print("add “compute_variable“ years to your answer for the correct answer.") elif year_variable > 1776: compute_variable = year_variable - 1776 print("subtract “compute_variable” years from your answer for the correct answer.")
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 23.06.2019 06:30
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
You know the right answer?
In Java Create a class named TreasureBox that contains:
(Be sure to set the appropriate access...
Questions
question
Mathematics, 26.08.2019 14:20
question
English, 26.08.2019 14:20
Questions on the website: 13722363