I have a project to work on during class time You will prese

I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed assignment document. Each team member will upload a document with screen shots of code and some sample runs. Each team member will contribute with ideas, syntax, energy, and perhaps a share of the typing. Good time management is essential as time is limited.

As well as logical, you need to be creative in your software development. This week you will WOW! the class with an application of your own design, on the subject of Travel Guide or Trip Planning.

Searching online for the geographic information you need.

Your presentation should be fun and informative or perhaps useful.

Include the following: arrays and collection processing, input validation and exception handling, date processing and calculations, output formats, great user experience including some graphics and maybe animation, PLUS all the default requirements such as good GUI layout, tabbing, Enter and Esc keys, object/control naming, and documentation!

Solution

Travel Expenses for travel trip gui:


This a GUI application calculates and displays the total travel expenses of a business person on a travel trip. Here is the information that the user must provide:
• Number of days on the travel trip
• Amount of airfare for travel trip, if any
• Amount of car rental fees for traveling, if any
• Number of miles driven for travel, if a private vehicle was used
• Amount of parking fees travel , if any
• Amount of taxi charges travel , if any
• Conference or seminar registration fees for travel, if any
• Lodging charges, per night for travel

The company reimburses travel expenses according to the following policy:
• $37 per day for meal travel(this is given regardless of if used so no text field is needed for input)
• Parking fees for travel , up to $10.00 per day
• Taxi charges for travel up to $20.00 per day
• Lodging charges for travel up to $95.00 per day
• If a private vehicle for travel is used, $0.27 per mile driven

This application should calculate and display the following:
• Total expenses incurred by the businessperson for travel
• The total allowable expenses for the travel trip
• The excess that must be paid by the businessperson for travel trip, if any
• The amount saved by the businessperson for traveltrip if the expenses were under the total allowed

code:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.JOptionPane;

import java.text.DecimalFormat;

/**

* The TravelExpense class creates the GUI for the

* Travel Expenses application for travel trip.

*/

public class TravelExpensesfortravel extends JFrame

{

// The following variables will reference the

// custom panel objects

private JPanel travelinformationPanel; // Travelinformation panel

private JPanel buttonPanel; // Buttons panel

// Labels for the Travel Information fields.

private JLabel numDaysOntravelTripLabel;

private JLabel travelamountAirfairLabel;

private JLabel travelamountCarRentalLabel;

private JLabel travelmilesDrivenLabel;

private JLabel travelparkingFeesLabel;

private JLabel traveltaxiFeesLabel;

private JLabel travelconfRegLabel;

private JLabel travellodgingChargesPerNightLabel;

// Text Fields for Travel Information entry

private JTextField numDaysOntravelTripTextField;

private JTextField amountAirfairTextField;

private JTextField amountCarRentalTextField;

private JTextField milesDrivenTextField;

private JTextField parkingFeesTextField;

private JTextField taxiFeesTextField;

private JTextField confRegTextField;

private JTextField lodgingChargesPerNightTextField;

// Buttons

private JButton resetButton;

private JButton calcButton;

// 5 required constants

private double perdaymealsAmount = 37.00; // Meals amount reimbursed by company per day.

private double perdayparkingFeesReimbursed = 10.00; // Parking Fees amount reimbursed by company per day.

private double perdaytaxiChargesReimbursed = 20.00; // Taxi Charges amount reimbursed by company per day.

private double perdaylodgingChargesReimbursed = 95.00; // Lodging Charges amount reimbursed by company per day.

private double perdayprVechiclePerMileReimbursed = 0.27; // Private Vehicle per miles reimbursment rate.

/**

* Constructor

*/

public TravelExpenses for traveltrip()

{

// Call the JFrame constructor & set the title.

super(\"Travel Expenses\");

// Set the main window to open in the center of the screen.

setLocationRelativeTo(null);

// Specify an action for the close button.

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Create a BorderLayout manager for the content pane.

setLayout(new BorderLayout());

// Build the Travelinformation and Buttons panels

buildTravelinformationPanel();

buildButtonPanel();

// Add the panels to the frame\'s content pane

add(travelinformationPanel, BorderLayout.CENTER);

add(buttonPanel, BorderLayout.SOUTH);

// Pack the contents of the window and display it.

pack();

setVisible(true);

}

// The buildTravelinformationPanel method adds the labels and text fiels to the Travelinformation panel.

private void buildTravelinformationPanel()

{

// Create the labels for Travelinformation fields

numDaysOntravelTripLabel = new JLabel(\"Number of days on trip: \");

travelamountAirfairLabel = new JLabel(\"Amount of airfair: \");

travelamountCarRentalLabel = new JLabel(\"Amount of car rental: \");

travelmilesDrivenLabel = new JLabel(\"Miles driven: \");

travelparkingFeesLabel = new JLabel(\"Parking Fees: \");

traveltaxiFeesLabel = new JLabel(\"Taxi fees: \");

travelconfRegLabel = new JLabel(\"Conference registration: \");

travellodgingChargesPerNightLabel = new JLabel(\"Lodging charges per night: \");

// Create the text boxes for Travelinformation user input

numDaysOntravelTripTextField = new JTextField(3);

amountAirfairTextField = new JTextField(8);

amountCarRentalTextField = new JTextField(8);

milesDrivenTextField = new JTextField(4);

parkingFeesTextField = new JTextField(6);

taxiFeesTextField = new JTextField(6);

confRegTextField = new JTextField(8);

lodgingChargesPerNightTextField = new JTextField(6);

// Create a panel to hold labels and text fields.

travelinformationPanel = new JPanel();

// Create GridLayout manager with 10 rows and 2 columns.

travelinformationPanel.setLayout(new GridLayout(10, 2));

// Add the 8 labels and 8 text fields to this panel.

travelinformationPanel.add(numDaysOntravelTripLabel);

travelinformationPanel.add(numDaysOntravelTripTextField);

travelinformationPanel.add(travelamountAirfairLabel);

travelinformationPanel.add(amountAirfairTextField);

travelinformationPanel.add(travelamountCarRentalLabel);

travelinformationPanel.add(amountCarRentalTextField);

travelinformationPanel.add(travelmilesDrivenLabel);

travelinformationPanel.add(milesDrivenTextField);

travelinformationPanel.add(travelparkingFeesLabel);

travelinformationPanel.add(parkingFeesTextField);

travelinformationPanel.add(traveltaxiFeesLabel);

travelinformationPanel.add(taxiFeesTextField);

travelinformationPanel.add(travelconfRegLabel);

travelinformationPanel.add(confRegTextField);

travelinformationPanel.add(travellodgingChargesPerNightLabel);

travelinformationPanel.add(lodgingChargesPerNightTextField);

// Add an empty border around the panel for spacing.

travelinformationPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 1, 10));

}

/**

* The buildButtonPanel method creates and adds the Reset and Calculate

* buttons to the TravelExpense panel as its own panel.

*/

private void buildButtonPanel()

{

// Create the calcButton.

calculateButton = new JButton(\"Calculate\");

// Register an event listener for the calcButton.

calculateButton.addActionListener(new CalcButtonListener());

//Create the resetButton.

resetButton = new JButton(\"Reset\");

// Register an event listener for the resetButton.

//resetButton.addActionListener(new ResetButtonListener());

// Create the Buttons panels.

buttonPanel = new JPanel();

// Create BorderLayout manager.

buttonPanel.setLayout(new BorderLayout(5, 5));

// Add the two buttons to the buttonPanel.

buttonPanel.add(resetButton, BorderLayout.WEST);

buttonPanel.add(calcButton, BorderLayout.CENTER);

// Add an empty border around the panel for spacing.

buttonPanel.setBorder(BorderFactory.createEmptyBorder(1, 10, 10, 10));

}

/**

* Private inner class that handles the event when the user clicks

* the Calculate button .

*/

private class CalculateButtonListener implements ActionListener

{

// Declare variables used in calculations.

String input; // To hold the users input

int traveldays; // Number of days on trip entered

double travelair; // Amount for airfair

double travelcarRental; // Amount of car rental

double travelmiles; // Miles driven

double travelparking; // Parking fees

double traveltaxi; // Taxi fees

double travelconfReg; // Conference Registration charges

double travellodging; // Lodging charges per night

double travelmealsAmount;

public void actionPerformed(ActionEvent e)

{

//Declare variables for calculated items.

double travelactualExpenses;

double travelmilesExpenses;

double travelallowableExpenses;

double travelexcessAir;

double travelexcessCarRental;

double travelexcessParking;

double travelexcessTaxi;

double travelexcessLodging;

double travelexcessAmountTotal;

double travelamountSaved;

double travelpaidBackAmount;

// Create a DecimalFormat object to format the totals as dollar amounts.

DecimalFormat dollar = new DecimalFormat(\"$#,##0.00\");

// Get Input Data the user entered in the text fields.

private void getData()

{

traveldays = Integer.parseInt(numDaysOntravelTripTextField.getText());

travelair = Double.parseDouble(amountAirfairTextField.getText());

travelcarRental = Double.parseDouble(amountCarRentalTextField.getText());

travelmiles = Double.parseDouble(milesDrivenTextField.getText());

travelparking = Double.parseDouble(parkingFeesTextField.getText());

traveltaxi = Double.parseDouble(taxiFeesTextField.getText());

travelconfReg = Double.parseDouble(confRegTextField.getText());

travellodging = Double.parseDouble(lodgingChargesPerNightTextField.getText());

}

// Determine actualExpenses method.

private double determineActualExpensesfor travel()

{

actualExpenses = travelair + travelcarRental + travelparking + traveltaxi + travelconfReg + travellodging + travelmilesExpenses;

// need to calculate milesExpense = miles * prVechiclePerMileReimbursed (??)

// Calculate the allowableExpenses.

// Calculate the paidBackAmount.

// Display the Totals message box.

JOptionPane.showMessageDialog(null, \"Total expenses: \" + \"\ \" +

\"Allowable expenses: \" + \"\ \" +

\"\ \" + \"Amount to be paid back: \");

}

}

/**

* Private inner class that handles the event when the user clicks

* the Reset button .

*/

private class ResetButtonListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

numDaysOntravelTripTextField.setText(\"\");

amountAirfairTextField.setText(\"\");

amountCarRentalTextField.setText(\"\");

milesDrivenTextField.setText(\"\");

parkingFeesTextField.setText(\"\");

taxiFeesTextField.setText(\"\");

confRegTextField.setText(\"\");

lodgingChargesPerNightTextField.setText(\"\");

}

// The main method creates an instance of the TravelExpenses class.

public static void main(String[] args)

{

new TravelExpensesfortravel ();

}

}

I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as
I have a project to work on during class time. You will present your application to the class next week. There is a drop box for you to upload your completed as

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site