Help with Algorithm

Hi all!!

Hope anyone here could help me out with this.
I have solved an algorithm which I was asked to do by my tutor,but apparently it's not what he's 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. These are important steps in the algorithm.

this is the algorithm I wrote:

If CustomerType = "Library" Or CustomerType = "School" Or CustomerType = "Educational Institutions" 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 = "Individuals" Then
If Qty >= 25 Then
Discount = 25
ElseIf Qty <= 24 And Qty >= 5 Then
Discount = 15
Else: Discount = 0
If CustomerType = " " Then
Discount = 0


Registered Member
I don't see a question here; you said that your tutor asked you to add input and output to this algorithm. Are you asking how to do this? Maybe you should ask your tutor about this (after all, what's a tutor for?).

If you have a specific question, ask it, and I'll be happy to take a look.


Trust me, I'm The Doctor.
What your instructor is asking you to do is pretty simple but you're going to have to specify which language you're using.

What you'll want to do, though, is add some code that prints instructions for the user to add their own values for your CustomerType field.

In java this would look like:
System.out.print("Please enter which type of institution you are referencing (Library/School/Educational Institution) and press enter: ")
String CustomerType =; /*This is the code that accepts input from they keyboard and applies it to a variable*/
CustomerType.toUpperCase(); //I use this to make comparing strings easier later on

[this is where your nested ifs go]

The end would look like:
System.out.print("Your discount on [whatever the hell is it] is: ")

NOTE: My syntax is nowhere near perfect because I want you to be able to do this by yourself. Accepting input and outputting the results is a very important part of learning any programming language and is damn near the basis of object orientated programming.
Last edited: