My professor asked me to write a program of calculating average using class.
A class must have four function,naming "avg2,avg6,avg8,avg10.
now user wants option to select which functions he wants to run.For Example, if user select "avg2" the functions runs in which user can enter only 2 numbers and function returns the average value, if user try to enter more than 2 numbers in "avg2" function than he'll get error.
Thank you both of you for your positive response, actually l don't know how to make logic of this program i will thankful if any of you help me out with the logic.
>ne555 actually our professor gave us this assignment at very first day of OOP, thats why facing this problem.
while user input //¿how do you determine this?
increment counter
if counter > limit
error 'Too many numbers'
value.at(counter) := input //¿do you know about arrays?
//computing the sum
sum := 0
for x in value
sum := sum + x
//computing the mean
avg <- sum/counter