behaviour
Expected Behaviour:
User shall be able to run the program with the following command line:
java –jar PROJ1.jar (Begin with a car)
java –jar PROJ1.jar Car (Begin with a car)
java –jar PROJ1.jar Truck (Begin with a Truck)
Commands:
M – Displays this menu
F – Display the current liters of fuel in the Vehicle. Display the total KM driven.
Z (X) – Fill up the vehicle with X liters.
D (X) – Drive the specified X kilometers.
Example of Behaviour:
Begin:
$>F
Your car has 10 liters of Fuel.
$>D 10
You drive the automobile 10KM.
$>D 10
You drive the automobile 10KM.
$>F
Your car has 8 liters of Fuel. You have driven 20 km.
$> D 85
You drive the automobile 80KM.
Your automobile has thrown an OutOfFuelException
Begin:
$>Z 50
You fill the car to the maximum of 50 liters of Fuel.
$>D 10
You drive the automobile 10KM.
$>D 10
You drive the automobile 10KM.
$>F
Your car has 48 liters of Fuel. Your car has driven 20 km
$> D 2000
You drive the automobile 480KM
Your automobile has thrown an OutOfFuelException
Begin:
$>Z 51
The Gas Station has thrown an FuelOverflowException
requirements
Project submission shall include an executable JAR file. (PROJ1.jar)
Project submission shall enable user to enter input as expected
Project submission shall output expected results
Project submission shall include a class named Car
Project submission shall include a class named Vehicle
Class Car shall inherit its properties and functionality from class Vehicle
Project submission shall include a class named FuelStation
FuelStation shall have a method named fillup that takes a Vehicle as an argument
Vehicle shall have a method named drive() that takes a double named km as a parameter
Eg. public void drive(double km)
Vehicle.drive(double km) shall attempt to drive km. If the vehicle runs out of fuel, the vehicle will throw an OutOfFuelException
FuelStation.fillup(Vehicle vehicle) shall throw a FuelOverflowException if the vehicle has too much fuel.
Project submission shall include javadocs
Project submission shall include file called README.txt
Project submission shall seamlessly handle either a Car or a Truck as a startup parameter
Project submission shall handle unexpected input gracefully
is there any body who can solve this problem of java