Question: Please submit your final project: Your design specifications must meet the followingRequirements: 1 . Arrays 2 . Methods with parameters 3 . Input or output
Please submit your final project: Your design specifications must meet the followingRequirements: Arrays Methods with parameters Input or output files GUI or menuimport javax.swing.;import java.awt.;import java.awt.event.;public class RectangleProgram extends JFrame private JLabel lengthL, widthL, areaL, perimeterL; private JTextField lengthTF, widthTF, areaTF, perimeterTF; private JButton calculateB, clearB, exitB; private CalculateButtonHandler cbHandler; private ExitButtonHandler ebHandler; private ClearButtonHandler clrHandler; private static final int WIDTH ; private static final int HEIGHT ; public RectangleProgram Create the four labels lengthL new JLabelEnter the length: SwingConstants.RIGHT; widthL new JLabelEnter the width: SwingConstants.RIGHT; areaL new JLabelArea: SwingConstants.RIGHT; perimeterL new JLabelPerimeter: SwingConstants.RIGHT; Create the four text fields lengthTF new JTextField; widthTF new JTextField; areaTF new JTextField; perimeterTF new JTextField; Create Calculate Button calculateB new JButtonCalculate; cbHandler new CalculateButtonHandler; calculateB.addActionListenercbHandler; Create Clear Button clearB new JButtonClear; clrHandler new ClearButtonHandler; clearB.addActionListenerclrHandler; Create Exit Button exitB new JButtonExit; ebHandler new ExitButtonHandler; exitB.addActionListenerebHandler; Set the title of the window setTitleArea and Perimeter of a Rectangle"; Get the container Container pane getContentPane; Set the layout pane.setLayoutnew GridLayout; Place the components in the pane pane.addlengthL; pane.addlengthTF; pane.addwidthL; pane.addwidthTF; pane.addareaL; pane.addareaTF; pane.addperimeterL; pane.addperimeterTF; pane.addcalculateB; pane.addexitB; pane.addclearB; Set the size of the window and display it setSizeWIDTH HEIGHT; setVisibletrue; setDefaultCloseOperationEXITONCLOSE; private class CalculateButtonHandler implements ActionListener public void actionPerformedActionEvent e double width, length, area, perimeter; length Double.parseDoublelengthTFgetText; width Double.parseDoublewidthTFgetText; area length width; perimeter length width; areaTF.setText area; perimeterTF.setText perimeter; private class ClearButtonHandler implements ActionListener public void actionPerformedActionEvent e lengthTF.setText; widthTF.setText; areaTF.setText; perimeterTF.setText; private class ExitButtonHandler implements ActionListener public void actionPerformedActionEvent e System.exit; public static void mainString args RectangleProgram rectObject new RectangleProgram; import javax.swing.;import java.awt.;import java.awt.event.;public class CalcPayGui extends JFrame private JLabel nameLabel, rateLabel, hoursLabel, deductLabel, grossLabel, netLabel; private JTextField nameTF, rateTF, hoursTF, deductTF, grossTF, netTF; private JButton calculateB, clearB, exitB; private CalculateButtonHandler cbHandler; private ExitButtonHandler ebHandler; private ClearButtonHandler clrHandler; public CalcPayGui setTitleCalculate Payroll"; setDefaultCloseOperationJFrameEXITONCLOSE; nameLabel new JLabelName:; rateLabel new JLabelHourly Rate:"; hoursLabel new JLabelHours Worked:"; deductLabel new JLabelDeduct:; grossLabel new JLabelGross Pay:"; netLabel new JLabelNet Pay:"; nameTF new JTextField; rateTF new JTextField; hoursTF new JTextField; deductTF new JTextField; grossTF new JTextField; netTF new JTextField; deductTF.setEditablefalse; grossTF.setEditablefalse; netTF.setEditablefalse; calculateB new JButtonCalculate; cbHandler new CalculateButtonHandler; calculateB.addActionListenercbHandler; clearB new JButtonClear; clrHandler new ClearButtonHandler; clearB.addActionListenerclrHandler; exitB new JButtonExit; ebHandler new ExitButtonHandler; exitB.addActionListenerebHandler; JPanel panel new JPanelnew GridLayout; panel.addnameLabel; panel.addnameTF; panel.addrateLabel; panel.addrateTF; panel.addhoursLabel; panel.addhoursTF; panel.adddeductLabel; panel.adddeductTF; panel.addgrossLabel; panel.addgrossTF; panel.addnetLabel; panel.addnetTF; panel.addcalculateB; panel.addclearB; panel.addexitB; addpanel; pack; setVisibletrue; private class CalculateButtonHandler implements ActionListener public void actionPerformedActionEvent e double rate, hours, gross, deduct, net; String name; name nameTF.getText; hours Double.parseDoublehoursTFgetText; rate Double.parseDoublerateTFgetText; gross rate hours; deduct calculateWithholdingTaxgross; net gross deduct; nameTF.setText name; grossTF.setText gross; deductTF.setText deduct; netTF.setText net; private class ClearButtonHandler implements ActionListener public void actionPerformedActionEvent e nameTF.setText; rateTF.setText; hoursTF.setText; grossTF.setText; deductTF.setText; netTF.setText; private class ExitButtonHandler implements ActionListener public void actionPerformedActionEvent e System.exit; private double calculateWithholdingTaxdouble gross if gross return gross ; else if gross return gross ; else if gross return gross ; else return gross ; public static void mainString args new CalcPayGui; import java.ioFile;import java.ioFileNotFoundException;import java.ioPrintWriter;import java.util.Scanner;public class CalcPay public static void mainString args throws FileNotFoundException Scanner input new Scannernew FilePayIntxt; PrintWriter output new PrintWriternew FilePayouttxt; while inputhasNext double hours input.nextDouble; double rate input.nextDouble; String name input.next; double grossPay hours rate; double deduct calculateTaxgrossPay; double netPay grossPay deduct; output.printfsfffff
name, hours, rate, deduct, grossPay, netPay; System.out.printfsfffff
name, hours, rate, deduct, grossPay, netPay; input.close; output.close; public static double calculateTaxdouble grossPay double taxRate; if grossPay taxRate ; else if grossPay taxRate ; else if grossPay taxRate ; else taxRate ; return grossPay taxRate; PayIntxt Doepublic class MyPaypublic static void main String argsthrows FileNotFoundExceptionScanner inFile new Scanner new FileReaderemployeetxt;PrintWriter outFile new PrintWriteroutpaytxt;String firstName;String lastName;double hoursWorked;double payRate;double wages;double taxAmount;double netAmount;firstName inFile.next;lastName inFile.next;hoursWorked inFile.nextDouble;payRate inFile.nextDouble;wages hoursWorked payRate;taxAmount wages ;netAmount wages taxAmount;System.out.printlnPaycheck for firstName lastName Hours worked hoursWorked at rate of $ payRate Gross Amount wages Tax Amount taxAmount Total Pay netAmount;outFile.printlnPaycheck for firstName lastName Hours worked hoursWorked at rate of $ payRate Gross Amount wages Tax Amount taxAmount Total Pay netAmount;inFile.close;outFile.close;employeetxtJohn Doe
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
