Answered step by step
Verified Expert Solution
Link Copied!

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
1. 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.
2. 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 42 sacks of wheat, the method
should return 42.
3. 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.
4. 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Discuss the states of accounting

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago