I trying to finish this assignment for Java and it's really getting to me. I haven't had this much trouble in the past, but things ramped up pretty quickly and I'm really stuck. I'll post what I have, although it's not much, if someone out there is kind enough to lend me a hand. The sad thing is I don't think this will take that long, as it seems to be a fairly straight forward program - but I'm pulling my hair out and my teacher is really no help at all.
The basic jist of the program is that a user will enter in command line arguments relating to the weight of a package and shipping method for said package. Based on the command line argument info the program will tell you how much the cost to ship the package is, insurance cost for the package and the total.
My program needs to have five classes - Main, Shipment, Insurance (a subclass of Shipment), CheckShipment, DisplayData.
Main Class
uses command-line arguments
10 T
10 is weight
T is shipping method Truck
creates an Insurance object to calculate and display
the shipment cost
the insurance cost
the total cost
uses the CheckShipment class to check the validity of the requested weights and methods
will throw an Exception
if the weight is not between 0 and 100 kilos
if an invalid method is requested
if the first argument is not an integer
if no command-line arguments are entered
Shipment Class -
has four protected instance variables
weight
is the weight of the shipment
method
is the shipping method
‘M’ or ‘m’ for mail
‘A’ or ‘a’ for air
‘T’ or ‘t’ for truck
shippingCost
is the cost of shipping
methodCost
is the cost of using a particular method and weight
has a private method calculateCost()
does not take an argument
does not return a value
calculates the cost of a given shipment
has a constructor
takes two arguments
method
weight
Insurance -subclass of Shipment
has a method calculateInsurance()
is private
does not take an argument
does not return a value
calculates the cost of insurance
has a public method displayOrder()
uses the DisplayData class
returns a String that can be used to display the details of a given shipment
I'm not looking for someone to just finish this for me, I'm genuinely stuck and want to figure this out, so if there's a kind soul out there who can lend a hand i'd be forever grateful. Thanks!