Results 1 to 2 of 2
- 05-25-2011, 04:45 AM #1
Member
- Join Date
- May 2011
- Posts
- 47
- Rep Power
- 0
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)); } }
-
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
-
help with displaying calculation with user input
By bamagirl31 in forum New To JavaReplies: 18Last Post: 05-26-2011, 04:00 AM -
problem displaying calculation in JText field
By smallmos1 in forum New To JavaReplies: 1Last Post: 02-10-2011, 08:15 PM -
Moretgage Calculation
By rsmithjr316 in forum New To JavaReplies: 3Last Post: 01-17-2011, 03:32 AM -
Jtextfield value get and calculation
By globo in forum New To JavaReplies: 11Last Post: 10-25-2010, 04:51 AM -
Problem with Calculation ....
By danny000 in forum New To JavaReplies: 1Last Post: 04-15-2008, 02:42 PM


LinkBack URL
About LinkBacks

Bookmarks