Question: public class VehicleApp { private static final DecimalFormat df 2 = new DecimalFormat ( # . ## ) ; / * * *
public class VehicleApp
private static final DecimalFormat df new DecimalFormat###;
@param args the command line arguments
public static void mainString args
TODO code application logic here
String FNameLNamephoneNumber; Variable Declaration
int numOfVehiclesnumOfTanks;
First name must be asked until is it blank
whileFNameisEmpty
FNameJOptionPane.showInputDialogEnter first name";
Last Name must be asked until is it blank
whileLNameisEmpty
LNameJOptionPane.showInputDialogEnter Last Name";
Phone number must be asked characters and can not be blank
while phoneNumberlengthphoneNumber.matchesd
phoneNumberJOptionPane.showInputDialogEnter Phone Number Digits;
Number of Vehicles must be between and
whilenumOfVehiclesnumOfVehicles
try
String vehicles JOptionPane.showInputDialogEnter number of vehicles ;
numOfVehiclesInteger.parseIntvehicles;
catch NumberFormatException e
JOptionPane.showMessageDialognull"Please enter a valid number";
Number of Tanks must be one of the specified values
try
while numOfTanks numOfTanks numOfTanks numOfTanks numOfTanks numOfTanks
String tanks JOptionPane.showInputDialogEnter number of tanks ;
numOfTanks Integer.parseInttanks;
catch NumberFormatException e
JOptionPane.showMessageDialognull "Please enter a valid number";
Create VehicleFactory instance and display summary
VehicleFactory VF new VehicleFactoryFName LName, phoneNumber, numOfVehicles, numOfTanks;
JOptionPane.showMessageDialognull VFgetSummary;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
