By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

Can anyone help me wit this?

P: 15
Question 1

The mail-order company requires a program to calculate discounts that it is giving to all its customers during a sales campaign. Write a program that asks the user to enter the total price of an order. If the order price is RM200.00 or less, the discount rate is 10%. If the order price is greater than RM200.00, the discount rate is 15%.The net price of the order is the price minus the discount. The program should display the price of the order, the discount amount, and the net price of the order. Design the program to process any number of orders. When there are no more orders to process, the program should display the number of orders it processed, the total of the prices, the total of the discounts, and the total of the net prices.


Sample output
Enter the total price of an order: RM150.50

Order price: RM150.50
Discount amount: RM15.05
Net order price: RM135.45

Do you have any other orders to proceed? (y/n) : y

Enter the total price of an order: RM420.30

Order price: RM420.30
Discount amount: RM63.05
Net order price: RM357.25

Do you have any other orders to proceed? (y/n) : y

Enter the total price of an order: RM200.00

Order price: RM200.00
Discount amount: RM20.00
Net order price: RM180.00

Do you have any other orders to proceed? (y/n) : n

Total number of orders: 3
Total order prices: RM770.80
Total discounts: RM98.10
Total net prices: RM672.70

Can anyone help me ..i juz don get it?
May 18 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 10K+
P: 11,448
Can anyone help me ..i juz don get it?
What is it that you 'juz don't get'? The structure of your program should be
something like this:
Expand|Select|Wrap|Line Numbers
  1. while more orders to process
  2.    process order and do some bookkeeping
  3.  
  4. print out statistics
kind regards,

Jos
May 18 '07 #2

P: 15
can ya post a sample of anything..

coz i am new to java... ><

thx in advanced
May 18 '07 #3

prometheuzz
Expert 100+
P: 197
can ya post a sample of anything..

coz i am new to java... ><

thx in advanced
Try to whip up some code yourself: otherwise you will remain "new to java".
Here's some sample code for a while-statement:
http://java.sun.com/docs/books/tutor...lts/while.html
May 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.