Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The pic is how I did it and run but got some problems, please fix them out 1 . In Ship.java, complete the isOverloaded method.
The pic is how I did it and run but got some problems, please fix them out
In Ship.java, complete the isOverloaded method. This method must return a boolean value
true if the ship is overloaded, and false otherwise. The ship is overloaded if the total weight of
all sacks of grain in its cargo exceeds the ships capacity.
In Ship.java, complete the sacksOfGrainType method. This method must return the number of
sacks of grain of the grain type indicated by its parameter that are in the ships cargo. That is if
the parameter type is Grain.WHEAT and the ships cargo contains sacks of wheat, the method
should return
In the main method of CargoSimulator.java, there is an instance of a CargoSimulator object
called sim. As described above, this object contains a list of ships, and each ship contains its list of
cargo. At the location indicated, print out how many sacks of wheat each ship in sim is carrying.
In the main method of CargoSimulator.java, print out a message for each ship in the CargoSimulator
instance sim that is overloaded. If a ship is not overloaded, print nothing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started