Question: PLEASE ANSWER THIS IMMEDIATELY THANK YOU SO MUCH Write two Java classes to represent information about container ships and ports. First, write a Port class.
PLEASE ANSWER THIS IMMEDIATELY THANK YOU SO MUCH


Write two Java classes to represent information about container ships and ports. First, write a Port class. For each Port, you need to know: the location of the port (e.g. "Saint John, NB, Canada"). . the maximum cargo weight (in tons) that the port serves for no tax (e.g. 9000.0) . the environmental fee for having hazardous cargo in the port (e.g. 750.45); this is a flat fee that is NOT dependent on the cargo weight. Use appropriate data types for the 3 instance variables. Provide a constructor for Port that records the location, the cargo weight limit for tax-free service, and the environmental fee. Provide accessor and mutator methods for all three Port attributes (3 accessors and 3 mutators). Provide an additional accessor method, getPortTax (double cargoweight), that calculates and returns the port's tax for a given cargo weight that is passed in as a parameter. The tax is defined as $10.00 for every ton of cargo weight above the port's tax-free weight limit. For example, if the tax-free limit happened to be 5000.0 tons and the cargo weight passed in via the parameter is 5250.0 tons, the tax is $2500.00 (so, this method would return 2500.0). Next, create a Containership class. Include 4 instance variables in the Containership class that record: the weight of the ship's cargo in tons the port that it starts from the port that it goes to whether or not the cargo contains hazardous materials Again, use appropriate data types. Provide a constructor for containership that accepts four parameters and uses them to initialize all of the instance variables. For the purpose of this midterm exam. you do NOT need to write accessor and mutator methods for each instance variable in the containership class. However, you do need to provide a gecrotal Bortcharges (method in the Container ship class. This method calculates and returns the total port charges for Next, create a Containership class. Include 4 instance variables in the Containership class that record: the weight of the ship's cargo in tons the port that it starts from the port that it goes to whether or not the cargo contains hazardous materials Again, use appropriate data types. Provide a constructor for Containership that accepts four parameters and uses them to initialize all of the instance variables. For the purpose of this midterm exam, you do NOT need to write accessor and mutator methods for each instance variable in the Containership class. However, you do need to provide a gettotalPort Charges () method in the Containership class. This method calculates and returns the total port charges for this ship. This total includes the total tax, which is defined as the sum of taxes for both ports. It also includes the total environmental fees, if any should be applied. Important - How to Answer this Question: Open up a text editor window on your computer and write the complete port and Containership classes (each in a separate text file). Save these as Port.java and containership.java. Then, upload those two files to submit as your answer for this question. (To do that, click on the "Add a File" button below. upload both files, and then click the "Add" button.) Once the files have been added, you can submit your answer for this question. Additional notes: Javadoc comments are not required No driver program is required No additional accessor or mutator methods are required except those mentioned above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
