Question: JAVA PROGRAM PLEASE HELP WILL RATE WELL Overview For this homework youll be designing and creating a few classes to calculate cost / revenue of

JAVA PROGRAM PLEASE HELP WILL RATE WELL

Overview

For this homework youll be designing and creating a few classes to calculate cost / revenue of different kinds of aircraft cargo, passenger and military. Youll be writing the calculated cost to a file whose location is determined by the user.

Business Rules

1. The costs for an aircraft are calculated as follows:

a. Cargo aircraft costPerPound * totalWeightInPounds

b. Passenger aircraft costPerSeat * occupiedSeats

c. Military aircraft costPerFlight

2. Output file location should be determined by the user.

3. Costs can be floating point values.

4. Costs, weight and seats cannot be negative numbers. If a negative number is entered, display an error message and prompt the user for input again.

Program Design

You need to create one class for each aircraft above and an abstract Aircraft class which will hold one method to return a PrintWriter object that can be used to print to the output file and 1 abstract method to calculate the cost. These abstract methods must be overridden in each of the aircraft classes above that extend from the Aircraft class. You must make use of a method to get the input by the user from the keyboard. You must use an enum (AIRCRAFT_TYPE_ENUM in the UML) to store the available aircraft types and an instance of the enum to record users choice of aircraft.

Input

Eg. keyboard interaction with user:

> What kind of aircraft are you flying today?

1) Cargo

2) Passenger

3) Military

> 1

> Youve chosen Cargo aircraft. Please enter the cost per pound in dollars:

> 300

> Please enter the total weight of the cargo in pounds:

> -2000

> Weight cannot be a negative value. Please enter weight > 0:

> 2000

> Your cargo aircraft is carrying 2000 pounds at $300 per pound.

Please enter the output path for the file:

> F:/output.txt

> Your cost has been written to F:/output.txt

Output

Contents of F:/output.txt

Cost of flying the Cargo plane with 2000 pounds at $300 per pound = $600000

Please comment throughout the code so i can leanr thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!