944,172 Members | Top Members by Rank

Ad:
Oct 25th, 2009
0

Help with Algorithm please!

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe is offline Offline
9 posts
since Dec 2008
Oct 25th, 2009
0
Re: Help with Algorithm please!
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.
Reputation Points: 100
Solved Threads: 48
Posting Pro in Training
Grn Xtrm is offline Offline
495 posts
since Nov 2008
Oct 25th, 2009
0
Re: Help with Algorithm please!
Click to Expand / Collapse  Quote originally posted by Grn Xtrm ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe is offline Offline
9 posts
since Dec 2008
Oct 25th, 2009
0
Re: Help with Algorithm please!
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.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Oct 26th, 2009
0
Re: Help with Algorithm please!
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.

Thank you
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe is offline Offline
9 posts
since Dec 2008
Nov 26th, 2009
0
Re: Help with Algorithm please!
1
Last edited by Nepenthe8; Nov 26th, 2009 at 9:02 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe8 is offline Offline
9 posts
since Feb 2008
Nov 26th, 2009
0
Re: Help with Algorithm please!
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
Attached Files
File Type: doc flowchart.doc (25.5 KB, 54 views)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe is offline Offline
9 posts
since Dec 2008
May 13th, 2010
0
Re: Help with Algorithm please!
Hi all....

I have received feedback for my algorithm and apparently it's not what my tutor was looking for he's asking for steps at the beginning of the algorithm to show how I got the data from the user, and steps at the end outputting the relevant values.

I am confused about this and don't know what he actually want,thought that the algorithm I wrote was pretty neat.

I would like to ask for help from you guys here...really appreciate it.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Nepenthe is offline Offline
9 posts
since Dec 2008
May 17th, 2010
0
Re: Help with Algorithm please!
did u mean a user input?

if so, u can ask user how many books they want 1st.use box to get user input.
User can choose whether individual,library or school also by using user input box.then only continue with your flow chart
Last edited by ubi_ct83; May 17th, 2010 at 1:49 am.
Reputation Points: 7
Solved Threads: 2
Junior Poster
ubi_ct83 is offline Offline
123 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: Getting an IT tech career started
Next Thread in Computer Science Forum Timeline: Crypto God Whit Diffie Joins ICANN





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC