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 19:50
Python write an expression that executes the loop body as long as the user enters a non-negative number. note: if the submitted code has an infinite loop, the system will stop running the code after a few seconds and report "program end never reached." the system doesn't print the test case that caused the reported message. sample outputs with inputs: 9 5 2 -1
Answers: 3
question
Computers and Technology, 21.06.2019 21:30
You need to write some code that responds to a text change in a jtextfield. how can you do that? create a class that implements the interface actionlistener and override the method textfieldchanged create a class that extends the superclass actionlistener and override the method actionperformed create a class that implements the interface actionlistener and override the method actionperformed create a class that extends the superclass actionlistener and override the method textfieldchanged
Answers: 2
question
Computers and Technology, 22.06.2019 14:00
Which database model is best used for data warehouse and data mining
Answers: 3
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
You know the right answer?
In Java Create a class named TreasureBox that contains:
(Be sure to set the appropriate access...
Questions
question
Mathematics, 11.03.2021 17:40
question
Mathematics, 11.03.2021 17:40
question
Mathematics, 11.03.2021 17:40
question
Chemistry, 11.03.2021 17:40
question
Mathematics, 11.03.2021 17:40
Questions on the website: 13722361