Create a class called Transporter that has the following attributes: Transporter cargoCapacity - Double personelleCapacity - Integer
Fantastic news! We've Found the answer you've been seeking!
Question:
Create a class called Transporter that has the following attributes:
Transporter |
cargoCapacity - Double |
personelleCapacity - Integer |
cargo[][] - String |
personelle[] - String |
Transporter () |
Transporter (cargoCapacity, personelleCapacity) |
addCargo(String, double) - Boolean |
removeCargo(String) - Boolean |
addPersonelle(String) - Boolean |
removePersonelle(String) - Boolean |
toString() - String |
Note:
Cargo is a 2-dimensional array of Strings where it stores the name of the item and also the weight. Because we are storing the weight as a String you will have to convert this data to a double to check the weight. Return true if the cargo item can be added and results in the weight of all cargo being under the cargoCapacity. Return false if adding the item would cause us to exceed the cargoCapacity.
Related Book For
Posted Date: