Question: Create a class called Asteroid that has the following attributes: Asteroid goldOre - Double silverOre - Double platinumOre - Double cubicYards - Double Asteroid ()
Create a class called Asteroid that has the following attributes:
| Asteroid |
| goldOre - Double |
| silverOre - Double |
| platinumOre - Double |
| cubicYards - Double |
| Asteroid () |
| Asteroid (goldOre, silverOre, platinumOre, cubicYards) |
| getGoldOre() - Double |
| mineGoldOre(Double) - Boolean |
| getSilverOre() - Double |
| mineSilverOre(Double) - Boolean |
| getPlatinumOre() - Double |
| minePlatinumOre(Double) - Boolean |
| getCubicYards() - Double |
| toString() - String |
Note:
The get methods will return the values in the related attributes
The mine methods will reduce the amount of the corresponding ore remaining, and also reduce the amount of cubic yards.
All mine methods will return false if cubic yards <= 0
THEN create a class:
Create a class called Drill that has the following attributes:
| Drill |
| efficiency - Double |
| durability - Double |
| maxDepth - Double |
| Drill() |
| Drill(efficiency, durability, maxDepth) |
| getEfficiency() - Double |
| getDurability() - Double |
| getMaxDepth() - Double |
| mineGold(Asteroid) |
| mineSilver(Asteroid) |
| minePlatinum(Asteroid) |
| toString() - String |
Note:
The mine methods will mine the corresponding ore on an asteroid. Each time the mine method is called it will try to mine up to 100 ore, depending on the efficiency.
You will mine 100 * the efficiency of the drill, which will always be less than 1 and greater than 0.
Step by Step Solution
There are 3 Steps involved in it
Heres the implementation of the Asteroid and Drill c... View full answer
Get step-by-step solutions from verified subject matter experts
