Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using text fields, check boxes and radio buttons Create a GUI app that calculate

ID: 3625208 • Letter: U

Question

using text fields, check boxes and radio buttons

Create a GUI app that calculates and displays the total travel expensed of a buiness 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 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
-$37 per day for meals
-Parking fees, up to $10 per day
-Taxi charges up to $20 per day
-Lodging charges up to $95 per day
-If private vehicle is used, $0.27 per mile driven


The app should calculate and display the following:
-Total expenses incurred by the business person
-The total allowable expenses for the trip
-The excess that must be paid by the business person, if any
-The amount saved by the business person if the expenses are under the total allowed.

Explanation / Answer

Dear... Am giving you the sample code fro given senario. public class calcButton extends JFrame { private JTextField dtripTextField;                  private JTextField dlodgeTextField; private JTextField dlodgeTextField; private JTextField airfareTextField; private JTextField tcostTextField; private JTextField milesTextField; private JCheckBox airCheckBox; private JCheckBox taxiCheckBox; private JCheckBox pvecCheckBox; private JCheckBox crentCheckBox; private JButton calcButton; private final int WIDTH = 300; private final int HEIGHT = 300;             public calcButton()             {             setTitle("Travel Wroksheet");             setSize(WIDTH, HEIGHT);                                                setDefaultCloseOperation(JFrame.CLOSE);                                           setLayout(new GridLayout(4, 3));             JTextField dtrip = new JTextField(4);             JCheckBox air = new JCheckBox("Air");             JCheckBox crent = new JCheckBox("Car rental");             JCheckBox taxi = new JCheckBox("Taxi");             JCheckBox pvec = new JCheckBox("Personal Vehicle");             JTextField dlodge = new JTextField(4);             JTextField airfare = new JTextField(4);             JTextField tcost = new JTextField(4);             JTextField miles = new JTextField(4);             JTextField sfees = new JTextField(4);             JTextField pfees = new JTextField(4);             JButton calcbutton = new JButton("Calculate");             JLabel label1 = new JLabel("Number of days on trip.");             JLabel label2 = new JLabel("Mode of Travel to destination.");             JLabel label3 = new JLabel("Daily Lodging cost.");             JLabel label4 = new JLabel("Amount of air Fare Cost.");             setLayout(new GridLayout(4, 3));             JTextField dtrip = new JTextField(4);             JCheckBox air = new JCheckBox("Air");             JCheckBox crent = new JCheckBox("Car rental");             JCheckBox taxi = new JCheckBox("Taxi");             JCheckBox pvec = new JCheckBox("Personal Vehicle");             JTextField dlodge = new JTextField(4);             JTextField airfare = new JTextField(4);             JTextField tcost = new JTextField(4);             JTextField miles = new JTextField(4);             JTextField sfees = new JTextField(4);             JTextField pfees = new JTextField(4);             JButton calcbutton = new JButton("Calculate");             JLabel label1 = new JLabel("Number of days on trip.");             JLabel label2 = new JLabel("Mode of Travel to destination.");             JLabel label3 = new JLabel("Daily Lodging cost.");             JLabel label4 = new JLabel("Amount of air Fare Cost.");             JLabel label5 = new JLabel("Amount of taxi charges.");             JLabel label6 = new JLabel("Number of miles driven.");             JLabel label7 = new JLabel("Seminar or Registration fees.");             JLabel label8 = new JLabel("Amount of parking fees.");             JLabel label9 = new JLabel("Calculate.");             JPanel panel1 = new JPanel();             JPanel panel2 = new JPanel();             JPanel panel3 = new JPanel();             JPanel panel4 = new JPanel();             JPanel panel5 = new JPanel();             JPanel panel6 = new JPanel();             JPanel panel7 = new JPanel();             JPanel panel8 = new JPanel();             JPanel panel9 = new JPanel();             panel1.add(label1);             panel2.add(label2);             panel3.add(label3);             panel4.add(label4);             panel5.add(label5);             panel6.add(label6);             panel7.add(label7);             panel8.add(label8);             panel9.setLayout(new BorderLayout());             panel1.add(dtrip);             panel2.add(air);             panel2.add(crent);             panel2.add(taxi);             panel2.add(pvec);             panel3.add(dlodge);             panel4.add(airfare);             panel5.add(tcost);             panel6.add(miles);             panel7.add(sfees);             panel8.add(pfees)             panel9.add(calcbutton, BorderLayout.SOUTH);             add(panel1);             add(panel2);             add(panel3);             add(panel4);             add(panel5);             add(panel6);             add(panel7);             add(panel8);             add(panel9);             calcButton.addActionListener(new calcButtonListener());             setVisible(true);             }             private class calcButtonListener implements ActionListener             {             public void actionPerformed(ActionEvent e)             {                         String input;                                                     String input1;                         String input2;                         String input3;                         String input4;                         String input5;                         String input6;                         double avalue;                                                  double mvalue;                         double tvalue;                         double ptax;                        input = dtripTextField.getText();                                            input1 = dlodgeTextField.getText();                                       input2 = airfareTextField.getText();                         input3 = tcostTextField.getText();                         input4 = dlodgeTextField.getText();                         input5 = dlodgeTextField.getText();                         input6 = dlodgeTextField.getText();                         mvalue = Double.parseDouble(input) * 37;                         avalue = Double.parseDouble(input) * Double.parseDouble(input1);                         tvalue = avalue + mvalue;                         JOptionPane.showMessageDialog                                                   (null, "Total money spent on trip is: $" + tvalue + ".");             }             }             public static void main(String[] args)               {                   new calcButton();               }            } }