Question

In Java please, and sooner is better then later.
Create a working order form for Orinoco as shown. Sales tax is 7% To display the Total Due (a Label) as currency, research ho

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.BorderLayout;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.AbstractAction;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;

import javax.swing.Action;
import javax.swing.JCheckBox;
import javax.swing.JRadioButton;


public class HelloWorld implements ActionListener {

   private JFrame frame;
   private JTextField textField;
   private final Action action = new SwingAction();
   private JTextField textField_1;
   private JTextField textField_2;
   private JTextField textField_3;
   JCheckBox chckbxNewCheckBox;
   ButtonGroup group;
   JLabel label;

   /**
   * Launch the application.
   */
   public static void main(String[] args) {
       EventQueue.invokeLater(new Runnable() {
           public void run() {
               try {
                   HelloWorld window = new HelloWorld();
                   window.frame.setVisible(true);
               } catch (Exception e) {
                   e.printStackTrace();
               }
           }
       });
   }

   /**
   * Create the application.
   */
   public HelloWorld() {
       initialize();
   }

   /**
   * Initialize the contents of the frame.
   */
   private void initialize() {
       //for frame
       frame = new JFrame("orinoco.com");
       frame.setBounds(100, 100, 450, 300);
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.getContentPane().setLayout(null);
      
       //item label
       JLabel lblItem = new JLabel("Item");
       lblItem.setBounds(37, 11, 46, 14);
       frame.getContentPane().add(lblItem);
      
       //price
       JLabel lblPrice = new JLabel("Price");
       lblPrice.setBounds(37, 36, 46, 14);
       frame.getContentPane().add(lblPrice);
      
       //quantity
       JLabel lblQuantity = new JLabel("Quantity");
       lblQuantity.setBounds(37, 61, 60, 14);
       frame.getContentPane().add(lblQuantity);
      
       //setting conditions like bounds for items in the frame
       textField_1 = new JTextField();
       textField_1.setBounds(136, 8, 86, 20);
       frame.getContentPane().add(textField_1);
       textField_1.setColumns(10);
      
       textField_2 = new JTextField();
       textField_2.setBounds(136, 58, 86, 20);
       frame.getContentPane().add(textField_2);
       textField_2.setColumns(10);
      
       textField_3 = new JTextField();
       textField_3.setBounds(136, 33, 86, 20);
       frame.getContentPane().add(textField_3);
       textField_3.setColumns(10);
      
       chckbxNewCheckBox = new JCheckBox("Taxable?");
       chckbxNewCheckBox.setBounds(136, 85, 97, 23);
       frame.getContentPane().add(chckbxNewCheckBox);
      
       JLabel lblShipping = new JLabel("Shipping");
       lblShipping.setBounds(37, 114, 60, 14);
       frame.getContentPane().add(lblShipping);
      
       JLabel lblNextDay = new JLabel("Next Day");
       lblNextDay.setBounds(37, 139, 60, 14);
       frame.getContentPane().add(lblNextDay);
      
       JLabel lblThisWeek = new JLabel("This Week");
       lblThisWeek.setBounds(37, 164, 60, 14);
       frame.getContentPane().add(lblThisWeek);
      
       JLabel lblSomeDay = new JLabel("Some Day");
       lblSomeDay.setBounds(37, 189, 60, 14);
       frame.getContentPane().add(lblSomeDay);
      
       JLabel lblTotalDue = new JLabel("Total Due");
       lblTotalDue.setBounds(37, 214, 60, 14);
       frame.getContentPane().add(lblTotalDue);
      
       JButton btnProcess = new JButton("Process");
       btnProcess.setBounds(37, 239, 89, 23);
       frame.getContentPane().add(btnProcess);
       btnProcess.addActionListener(this);
      
       JButton btnRest = new JButton("Reset");
       btnRest.setBounds(146, 239, 89, 23);
       frame.getContentPane().add(btnRest);
      
       JRadioButton radioButton = new JRadioButton("$20");
       radioButton.setBounds(136, 135, 109, 23);
       frame.getContentPane().add(radioButton);
       radioButton.setActionCommand("20");
      
       JRadioButton radioButton_1 = new JRadioButton("$12");
       radioButton_1.setBounds(136, 160, 109, 23);
       frame.getContentPane().add(radioButton_1);
       radioButton_1.setActionCommand("12");
      
       JRadioButton radioButton_2 = new JRadioButton("$5");
       radioButton_2.setBounds(136, 185, 109, 23);
       frame.getContentPane().add(radioButton_2);
       radioButton_2.setActionCommand("5");
      
       group = new ButtonGroup();
       group.add(radioButton);
       group.add(radioButton_1);
       group.add(radioButton_2);
      
       label = new JLabel("$0.00");
       label.setBounds(136, 214, 46, 14);
       frame.getContentPane().add(label);
      
   }
   private class SwingAction extends AbstractAction {
       public SwingAction() {
           putValue(NAME, "Submit");
           putValue(SHORT_DESCRIPTION, "Some short description");
       }
       public void actionPerformed(ActionEvent e) {
           System.out.println("hai");
       }
   }
   //main logic here
   @Override
   public void actionPerformed(ActionEvent arg0) {
       double price = Double.parseDouble(textField_2.getText());
       double quantity = Double.parseDouble(textField_3.getText());
       double total = price * quantity;
       if(chckbxNewCheckBox.isSelected()) total += (total * 7)/100.0;
       DecimalFormat df2 = new DecimalFormat("#.00");
       label.setText("$"+df2.format(total+Integer.parseInt(group.getSelection().getActionCommand())));
   }
}

orinoco.com hammers Item 20 Price 15 Quantity Taxable? Shipping $20 Next Day This Week $12 $5 Some Day $341.00 Total Due Proc

Add a comment
Know the answer?
Add Answer to:
In Java please, and sooner is better then later. Create a working order form for Orinoco...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLEASE HELP ME WITH QUESTIONS 5 - 8 - 10 ! THANK YOU! Consider a basic...

    PLEASE HELP ME WITH QUESTIONS 5 - 8 - 10 ! THANK YOU! Consider a basic economic order quantity (EOQ) model with the following characteristics: Item cost: $15 Item selling price: $20 Monthly demand: 500 units (constant) Annual holding cost: $1.35 per unit Cost per order: $18 Order lead time: 5 working days Firm's work year: 300 days (50 weeks @ 6 days per week) Safety stock: 15% of monthly demand For this problem, determine the values of: Question 1...

  • In this practice program you are going to practice creating graphical user interface controls and placing...

    In this practice program you are going to practice creating graphical user interface controls and placing them on a form. You are given a working NetBeans project shell to start that works with a given Invoice object that keeps track of a product name, quantity of the product to be ordered and the cost of each item. You will then create the necessary controls to extract the user input and display the results of the invoice. If you have any...

  • Alicia recently started a local food truck operation in Baltimore City.  Each week, Ali...

    Alicia recently started a local food truck operation in Baltimore City.  Each week, Alicia needs a certain amount of raw food materials to make the items that she offers for sale on her food truck menu.  After perusing some google search results, Alicia discovers a commercial food service distributor that provides bulk ingredients for food truck operators.  She contacts the distributor through its website, and after setting up an account, places an initial order for the following items: Item                            Quantity...

  • Job Order Costing Question - College Accounting question

    Any help with the blank sections would be appreciated. Thank you. Mastery Problem: Job Order CostingPurl of Great Price CompanyMaria Young is the sole stockholder of Purl of Great Price Company (POGP Company), which produces high-end knitted sweaters and sweater vests for sale to retail outlets. The company started in January of the current year, and employs three knitters (each of whom work 40 hours per week) and one office manager/knitting supervisor (this employee works 20 hours per week as office...

  • please help with COS schedule, income statement, and variances. everything is completed and added for reference....

    please help with COS schedule, income statement, and variances. everything is completed and added for reference. please complete the last 3 sections View Help i SUBSCRIPTION EXPIRED To keep using Excel without interruption, please reactivate now. Reactivate H32 X : B for D A C E F G H I J K L M N O P Q 43 For simplicity, base all calculations using 30 days in each month OPERATIONAL DATA Grooming: The Groomer can groom 5 dogs a...

  • I am having trouble figuring this out. How do I break down the calculations? INSTRUCTIONS FOR MILESTONE 2 (Due Week 4...

    I am having trouble figuring this out. How do I break down the calculations? INSTRUCTIONS FOR MILESTONE 2 (Due Week 4) IMPORTANT NOTE: Make sure to completely review the Rubric for Milestone 2 Use the data from this Milestone and begin working on your final presentation due in Milestone 4 (Week 7) ITEMS TO COMPLETE FOR THIS MILESTONE (Green Tabs): GENERAL Use data from Milestone 1 in your analysis CONTRIBUTION MARGIN ANALYSIS Select a price for each service (grooming, day...

  • please help with the income statement - + Fit to page D Page view A Read...

    please help with the income statement - + Fit to page D Page view A Read aloud h Add notes Overview: In the third milestone, you will jump forward in time: Imagine that your business has already opened. Use the updated scenario information to analyze your company's performance. o Post-opening Scenario: Your angel investors are silent in relation to the business; however, they require board meetings for status updates on the company's financial health. Therefore, you need to analyze your...

  • can you please complete the income statement (last photo) other pages are for refernce. please let...

    can you please complete the income statement (last photo) other pages are for refernce. please let me know what additional information is needed to complete the question TOLED Tuy Demstalled, but first we need to close some apps. Update now A B C D E F G H J K L M N O P Q R S OPERATIONAL & COST INFORMATION: For simplicity, base all calculations using 30 days in each month m OPERATIONAL DATA Grooming: The Groomer can...

  • Hello, please Answer the questions below. Please write clear or type the solution. Thank you unada...

    Hello, please Answer the questions below. Please write clear or type the solution. Thank you unada x P Canadax d a C:/Users/Moe/Downloads/Assignment%20-%20B.pdf ESSAY. Provide sparate sheet of paper, each question brings 12. 1) Fisheria is a country in which the quantity theory of money operates. The country has a constant population, capital stock, and technology. In 2010, real GDP was $300 million, the quantity of money was $60, and the velocity of circulation of money was 10. In 2015, the...

  • JAVA Hello I am trying to add a menu to my Java code if someone can...

    JAVA Hello I am trying to add a menu to my Java code if someone can help me I would really appreacite it thank you. I found a java menu code but I dont know how to incorporate it to my code this is the java menu code that i found. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; public class MenuExp extends JFrame { public MenuExp() { setTitle("Menu Example");...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT