Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this part you will complete the class Parcel, which already has the following private fields: weight, of type double, the weight of the parcel
In this part you will complete the class Parcel, which already has the following private fields:
weight, of type double, the weight of the parcel in kilos,
width, of type int, which holds the width of the parcel in cms
length, of type int, which holds the length of the parcel in cms
height, of type int, which holds the height of the parcel in cms
In addition, there are three public integer class constants:
LENGTHLIMIT, the maximum length of a parcel that can be carried,
SIZELIMIT, the maximum size derived from a formula supplied by the courier company
WEIGHTLIMIT, the maximum weight in kilos.
The class has a getter method for weight as well as equals and toString methods, which are initially commented out.
iAlter the header of Parcel so it inherits from Freight and add a public constructor to the class Parcel with the signature:
ParcelString double, int, int, int
The constructors first parameter is used to set the address, and the other four parameters to set the values of the four instance fields of Parcel in the order described above.
The field dateSent should be set to an empty string.
Uncomment the provided methods equals and toString.
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