subject

Write a marie program to calculate some basic statistics on a list of positive numbers. the program will ask users to input the numbers one by one. assume that all numbers will be in the range 1 to 1000. to terminate the data entry, user will input any negative number. once the data entry is complete, the program will show four statistics about the list of numbers: (1) count (2) minimum value (3) sum of numbers (4) "mean/average" calculation.

as an example, if the user enters the following decimal numbers as input (one after the other)

23, 6, 78, 36, 3, 250, 127, 210, –5

the program would output the following values as the count, minimum, sum and mean respectively:

8
3
733
91

the average is calculated by dividing sum by count. note that marie does not support floating point numbers, hence the result of division will only have the integer part (as shown in above example, average is 91 instead of 91.625)

a simple algorithm for implementing division in marie is shown below.

let x = dividend, y = divisor, z = quotient (result) of division.

set initial z to 0
while x > y, do
set x to (x – y)
increase z by 1
endwhile

assume that the user will always provide valid numbers as input, that is, do not worry about dealing with invalid input data.

write comments within your program so that a reader can understand it easily.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
Which option allows you to view slides on the full computer screen?
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
You know the right answer?
Write a marie program to calculate some basic statistics on a list of positive numbers. the program...
Questions
question
Mathematics, 18.11.2020 02:40
question
English, 18.11.2020 02:40
question
Mathematics, 18.11.2020 02:40
question
Mathematics, 18.11.2020 02:40
question
English, 18.11.2020 02:40
question
Mathematics, 18.11.2020 02:40
Questions on the website: 13722360