Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 2 ( 2 5 Marks ) Imagine you have been contracted to develop a piece of Java software for the ICESAT company. ICESAT place
QUESTION Marks
Imagine you have been contracted to develop a piece of Java software for the ICESAT company. ICESAT place satellites in earth orbit to monitor the condition of ice flows and icebergs across the world.
You have been tasked with creating a piece of software to store information on a number of icebergs around the world, in order to provide a warning system to any ships at sea if they sail too close to the known location of an iceberg. You have been asked to use the Java programming language.
a Write a Java class to represent an Iceberg. This class should contain instance variables to hold the following pieces of information. Be careful to choose the best types to hold this information, and ensure your class is properly encapsulated.
A number that identifies the iceberg you may assume this is a whole number
The size of the iceberg recorded as its maximum diameter in metres.
The location of the centre of the iceberg, using simple and coordinates.
Marks
b Write an appropriate constructor for your Iceberg class.
Marks
c You have also been asked to store information on all ships registered with ICESAT. Write another class called Ship. Each ship has a name, length in metres and a location also represented using simple and coordinates. Create an appropriate constructor for this class.
Marks
d Write one further class that represents the Earth. This should contain two arrays as instance variables an array of all the icebergs on the Earth, and an array of all the known ships. For the purpose of this exercise, you may assume that there will only be a maximum of three ships and three icebergs.
Marks
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