Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, ghazanfarwaheed7967
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, MalikaJones
In the blank libreoffice writer document, to start the process of entering a date field into a letter, click on the insert menu. edit menu. file menu. fields menu.
Answers: 3
image
Computers and Technology, 24.06.2019 22:00, kingkush85
Difference between ancient and modern mode of information transmission
Answers: 1
image
Computers and Technology, 25.06.2019 01:00, mrstealyogirl40
Holly created a professional development plan to explore how she could advance from her entry-level position to the next step in her career. she has identified her current skills and the skills needed for the job she wants. what should she do now? a) ask a colleague for advice about work-life balance b) identify her areas for improvement c) plan a vacation before she begins her new job d) wait until a position opens before continuing her plan
Answers: 1
Do you know the correct answer?
In Java Create a class named TreasureBox that contains:
(Be sure to set the appropriate access...

Questions in other subjects:

Konu
History, 06.12.2019 10:31
Konu
Mathematics, 06.12.2019 10:31
Konu
Mathematics, 06.12.2019 10:31