Create a class called Drill that has the following attributes: Drill0 Drill(efficiency, durability, maxDepth) getEfficiency) - Double getDurability() - Double getMaxDepth() - Double mineGold(Asteroid) - Double mineSilver(Asteroid) - Double minePlatinum(Asteroid) - Double toString() - String Note: Drill efficiency - Double durability Double maxDepth - Double 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

24

## Class Creation for "Drill" in Object-Oriented Programming

### Class Definition: Drill

The class named `Drill` is designed with the following attributes:

#### Attributes:
- **efficiency:** Double
- **durability:** Double
- **maxDepth:** Double

#### Constructor and Methods:

1. **Constructors:**
   - `Drill()`
   - `Drill(efficiency, durability, maxDepth)`

2. **Getter Methods:**
   - `getEfficiency() : Double`
   - `getDurability() : Double`
   - `getMaxDepth() : Double`

3. **Operational Methods:**
   - `mineGold(Asteroid) : Double`
   - `mineSilver(Asteroid) : Double`
   - `minePlatinum(Asteroid) : Double`
   
4. **Miscellaneous:**
   - `toString() : String`

#### Notes:

The mining methods (`mineGold`, `mineSilver`, and `minePlatinum`) are designed to mine their respective ores from an asteroid. Each call to a mining method attempts to mine up to 100 units of ore, subject to the drill's efficiency. The amount mined is computed as \(100 \times \text{efficiency}\), where efficiency is a value less than 1 and greater than 0.

### Detailed Breakdown:

#### Attributes:
- **efficiency (Double):** Represents the efficacy rate of the drill.
- **durability (Double):** Indicates the state of wear and tear of the drill.
- **maxDepth (Double):** Specifies the maximum depth the drill can reach.

#### Constructor:
- **Drill():** Default constructor initializing a `Drill` object.
- **Drill(efficiency, durability, maxDepth):** Parameterized constructor initializing a `Drill` object with specific values for efficiency, durability, and maxDepth.

#### Getter Methods:
- **getEfficiency():** Returns the efficiency of the drill.
- **getDurability():** Returns the durability of the drill.
- **getMaxDepth():** Returns the maximum depth the drill can operate at.

#### Mining Methods:
- **mineGold(Asteroid):** Mines gold from the specified asteroid.
- **mineSilver(Asteroid):** Mines silver from the specified asteroid.
- **minePlatinum(Asteroid):** Mines platinum from the specified asteroid.

#### toString():
- **toString():
Transcribed Image Text:## Class Creation for "Drill" in Object-Oriented Programming ### Class Definition: Drill The class named `Drill` is designed with the following attributes: #### Attributes: - **efficiency:** Double - **durability:** Double - **maxDepth:** Double #### Constructor and Methods: 1. **Constructors:** - `Drill()` - `Drill(efficiency, durability, maxDepth)` 2. **Getter Methods:** - `getEfficiency() : Double` - `getDurability() : Double` - `getMaxDepth() : Double` 3. **Operational Methods:** - `mineGold(Asteroid) : Double` - `mineSilver(Asteroid) : Double` - `minePlatinum(Asteroid) : Double` 4. **Miscellaneous:** - `toString() : String` #### Notes: The mining methods (`mineGold`, `mineSilver`, and `minePlatinum`) are designed to mine their respective ores from an asteroid. Each call to a mining method attempts to mine up to 100 units of ore, subject to the drill's efficiency. The amount mined is computed as \(100 \times \text{efficiency}\), where efficiency is a value less than 1 and greater than 0. ### Detailed Breakdown: #### Attributes: - **efficiency (Double):** Represents the efficacy rate of the drill. - **durability (Double):** Indicates the state of wear and tear of the drill. - **maxDepth (Double):** Specifies the maximum depth the drill can reach. #### Constructor: - **Drill():** Default constructor initializing a `Drill` object. - **Drill(efficiency, durability, maxDepth):** Parameterized constructor initializing a `Drill` object with specific values for efficiency, durability, and maxDepth. #### Getter Methods: - **getEfficiency():** Returns the efficiency of the drill. - **getDurability():** Returns the durability of the drill. - **getMaxDepth():** Returns the maximum depth the drill can operate at. #### Mining Methods: - **mineGold(Asteroid):** Mines gold from the specified asteroid. - **mineSilver(Asteroid):** Mines silver from the specified asteroid. - **minePlatinum(Asteroid):** Mines platinum from the specified asteroid. #### toString(): - **toString():
Expert Solution
steps

Step by step

Solved in 7 steps with 4 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education