| | |
Help with Algorithm please!
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 0
Hi,
I have this task that I need to solve and am stuck.I would like some help on this please.I am fairly new to this,so not sure what I should do.....really appreciated if anyone could help me out
Question
Write an Algorithm to calculate discounts.
Bookstore is offering discounts to customers. Classifications of customers are:
Library,Schools,Educational institutions
no of books purchased
more than 50 books receive 30% discount
25 to 49 20%"
15 to 24 books 15%
5 to 14 books 10%
less than 5 books 5%
If customer is an Individual:
more than 25 books 25% discount
5 to 24 books 15% discount
Thanks
I have this task that I need to solve and am stuck.I would like some help on this please.I am fairly new to this,so not sure what I should do.....really appreciated if anyone could help me out
Question
Write an Algorithm to calculate discounts.
Bookstore is offering discounts to customers. Classifications of customers are:
Library,Schools,Educational institutions
no of books purchased
more than 50 books receive 30% discount
25 to 49 20%"
15 to 24 books 15%
5 to 14 books 10%
less than 5 books 5%
If customer is an Individual:
more than 25 books 25% discount
5 to 24 books 15% discount
Thanks
0
#2 Oct 25th, 2009
You can use a series of if statements to test the input of the number of books. Depending on the input, the different if statements execute. Each statement will produce a different discount.
Check out my new band URL on facebook. I'm the bass player. :) Become a fan and leave comments if you like.
URL on facebook!
URL on facebook!
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 0
0
#3 Oct 25th, 2009
•
•
•
•
You can use a series of if statements to test the input of the number of books. Depending on the input, the different if statements execute. Each statement will produce a different discount.
Oke, by that do you mean IF ELSE statement?
So would that be something like this:
if purchase =(30+ books then
finalPrice = price / 100 x 10
But what am confused about is that there's no price given for the books. So I assume that I will have to work out the discount only from the amount of books bought is this right?
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 0
0
#7 15 Days Ago
•
•
•
•
Yes, that's right. And you're going to have to get input from the user asking if they are an institution or individual and how many books they want to buy.
Hi,
Okay this is what I got so far and would like to know if am on the right track.
If CustomerType = "Library" Or CustomerType = "School" Or CustomerType = "educational institution" Then
If Qty >= 50 Then
Discount = 30
ElseIf Qty >= 25 And Qty <= 49 Then
Discount = 20
ElseIf Qty >= 15 And Qty <= 24 Then
Discount = 15
ElseIf Qty >= 5 And Qty <= 14 Then
Discount = 10
ElseIf Qty < 5 And Qty > 0 Then
Discount = 5
Else: Discount = 0
If CustomerType = "Individual" Then
If Qty >= 25 Then
Discount = 25
ElseIf Qty <= 24 And Qty >= 5 Then
Discount = 15
Else: Discount = 0
If CustomerType = " " Then
Discount = 0
Also, I just figured out that I need to draw a diagram or flowchart supporting the Psuedo Code. I have attached what I have as a draft but am really stuck on it and confused on how to draw this flowchart with the given scenario.
Help is much appreciated.
Thanks
![]() |
Similar Threads
- Time complexity of algorithm (Computer Science)
Other Threads in the Computer Science Forum
- Previous Thread: preserve/retrieve downloaded text file "date of creation"?
- Next Thread: programming for mobiles
| Thread Tools | Search this Thread |







