Create a GUI application that calculates and displays the total travel expenses of a business- person on a trip. Here is the information that the user must provide:

  • Number of days on the trip
  • Amount of airfare, if any
  • Amount of car rental fees, if any
  • Number of miles driven, if a private vehicle was used
  • Amount of parking fees, if any
  • Amount of taxi charges, if any
  • Conference or seminar registration fees, if any
  • Lodging charges, per night

The company reimburses travel expenses according to the following policy:

  • $38.00 per day for meals
  • Parking fees up to $25.00 per day
  • Taxi charges up to $49.00 per day
  • Lodging charges up to $215.00 per day
  • If a private vehicle is used, $0.49 per mile driven

The application should calculate and display the following:

  • Total expenses incurred by the businessperson
  • The total allowable expenses for the trip
  • The excess that must be paid by the businessperson, if any
  • The amount saved by the businessperson if the expenses were under the total allowed

Sample Output: see image.

Some notes:

For this you should either initialize each TextField to 0, or you must fill in each TextField before hitting the button.

The three formulas needed are:

double totalSpent = (days * nightlyLodging) + air + car +
(miles * PER_MILE) + parking + taxi +
(days * MAX_MEALS_PER_DAY) + reg;
double totalAllowable = (days * MAX_LODGING_PER_DAY) + air + car +
(miles * PER_MILE) + (days * MAX_PARKING_PER_DAY) +
(days * MAX_TAXI_PER_DAY) + (days * MAX_MEALS_PER_DAY) +
reg;
double excess = totalSpent - totalAllowable;

You should be able to line up these variables with the GUI TextFields.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.