Results 1 to 2 of 2
  1. #1
    bamagirl31 is offline Member
    Join Date
    May 2011
    Posts
    47
    Rep Power
    0

    Default Need help with displaying calculation

    ,I want the application to take the product price, read the user input of the quantity wanted, and multiply the price by the quantity. Then, I want the result, the product total to multiply by the tax of 1.08 and give the result in paymentBalance. When I run the application, I keep getting 0 no matter the quantity entered by the user.
    Please help.
    Java Code:
    package products;
    
    /**
     *
     * @author Lekeisha
     */
    
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    
    
    public class Products {
        public Products()
        {
            
        }
        public static void main(String[] args)
            {        
            Products products1 = new Products();
            products1.inputFromConsole();
            }
        
        public void inputFromConsole()
        {
           
            // TODO code application logic here
            int quantityOrdered = 0;
            double productTotal;
            double priceItem = 3.95;
            double taxPaid = 1.08;
            double paymentBalance;
            productTotal = priceItem*quantityOrdered;
            paymentBalance = productTotal*taxPaid;
            
            
            
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                    
            System.out.println("I want this quantity." + "");
            
            try
                {    
                    quantityOrdered = br.read();
                }
                catch
                (IOException e)
                {
                    return;
                }    
            System.out.println("This is the total balance. " +(paymentBalance));
            
                    }   
                                                         
            }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Isn't this just a continuation of this thread: help-displaying-calculation-user-input? And if so, why create an entirely new thread, and why not answer Norm's helpful questions?

    Edit: In fact, no need to answer that. Let's lock this thread, and continue the discussion in the original thread. Fragmenting the discussion is not quite fair to the folks here who might re-do effort that Norm has already expended.

Similar Threads

  1. help with displaying calculation with user input
    By bamagirl31 in forum New To Java
    Replies: 18
    Last Post: 05-26-2011, 04:00 AM
  2. problem displaying calculation in JText field
    By smallmos1 in forum New To Java
    Replies: 1
    Last Post: 02-10-2011, 08:15 PM
  3. Moretgage Calculation
    By rsmithjr316 in forum New To Java
    Replies: 3
    Last Post: 01-17-2011, 03:32 AM
  4. Jtextfield value get and calculation
    By globo in forum New To Java
    Replies: 11
    Last Post: 10-25-2010, 04:51 AM
  5. Problem with Calculation ....
    By danny000 in forum New To Java
    Replies: 1
    Last Post: 04-15-2008, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •