Someone explain this please

So my teacher gave me this as part of an assignment. I get that he wants us to make an algorithm, but I don't understand of what.


This is the exercise:

Write an algorithm (pseudocode) to read a set of sales data items from standard input and calculate and output their total and their average. Prompt user to enter number of data items.

I would greatly appreciate if someone explained this to me since its due today.
psuedo code he means english statements of what to do. for example if you were read and display contents from a file you would 1. Open file 2. read from file 3. Close File 4. Print contents

You may want to be more detailed than what i wrote though
I get what he wants is an algorithm, but I don't get for what because he just said :

read a set of sales data items from standard input and calculate and output their total and their average. Prompt user to enter number of data items.

that's the part I don't get.
The what for is exactly what he said...

the algorithm is in psuedo code. Youre not writing actual code. You are writing in english the steps you would take (in order) to accomplish what your professor is asking.


Reading a set of sales data means you are reading data from a file and then you will use the data you got from the file to calculate the total and average.
Last edited on
Ahhhhhhh, I think I understood... maybe.
Hope i helped! if you get stuck again post your code and tell me the error and ill do my best to help some more
closed account (E0p9LyTq)
read a set of sales data items from standard input

Standard input usually means the keyboard.

Your instructor wants you to ask the user how many sales items to enter, create a loop to retrieve the number of data items.

When you have retrieved all the data, find the total and average.

Reading from a file is not standard input. Why prompt the user for the number of entries if they are read from a file.
@ furry guy yes you are correct but i didnt want to give up the entire solution. I just wanted to give an example. I can see how my statements could be misleading. Thats my mistake!
Topic archived. No new replies allowed.