Question

Develop Pseudocode and Desk checking for the following programs. Your solutions should allow the user to...

Develop Pseudocode and Desk checking for the following programs. Your solutions should allow the user to provide the number of elements in each array and array should be initialised according to the user input. Proper functions should be used in each program to promote modularity.

1. Find the average of a list of numbers

2. Find the smallest value from a list of numbers

Homework Answers

Answer #1

1.main

2.declare integer array A of size 20

3. Declare integer size, i=0

4. Output” Enter number of elements in array”

5. Input size

6. For i =0 to size-1, step size i =i+1

Input A[i]

7. Average= Call avg(A,size)

8. Smallest= call minimum(A,size)

9. Output “Average= “ Average

10. Output “smallest value =“ smallest

11. Stop main.

Pseudocode avg(int A[ ], int size)

1.Begin

2. Declare integer total=0,i =0

3. Declare float average

4. For i =0 to size-1, step size 1

total= total +A[i]

5. average= total/size

6. Return average

7. End

pseudocode: minimum ( int A[ ], int size)

1. Start

2. Declare integer min

3. Assign min= A[0]

4.For i =1 to size-1, step size 1

If A[i]< min

Assign min= A[i]

5. End loop

6. Return min

7.End.

Desk check:

enter number of elements in array:5

10

21

3

42

5

Average=16.2

Smallest=3

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
PLease code a C++ program that prompts a user to enter 10 numbers. this program should...
PLease code a C++ program that prompts a user to enter 10 numbers. this program should read the numbers into an array and find the smallest number in the list, the largest numbers in the list the sum of the 10 numbers and the average of the 10 numbers please use file i/o and input measures for Handling Errors in C++ When Opening a File
Using Python, write the following code. You are to allow the user to enter the daily...
Using Python, write the following code. You are to allow the user to enter the daily temperature as a floating-point number. You should make the assumption that you are recording temperatures in Fahrenheit. You should allow the user to continue entering temperatures until the value -999 is entered. This number should not be considered a temperature, but just a flag to stop the program. As the user enters a temperature, you should display the following each time: Current Temperature: 999...
Q: Design a program that lets the user enter the total rainfall for each of 12...
Q: Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Create parallel arrays for the month names and rainfall amounts for each month. Use month names (i.e. January, February, March, etc.) when printing out the months with the highest and lowest amounts. Include a modular...
Complete the following Self-Test exercises (each program should allow the user to enter the data being...
Complete the following Self-Test exercises (each program should allow the user to enter the data being tested as often as the user wishes) In addition to displaying the output, provide a brief explanation as to how the computer arrived at that output.   What output will be produced by the following code, when embedded in a complete program? int first_choice = 1; switch (first_choice + 1) { case 1: cout << "Roast beef\n"; break; case 2: cout << "Roast worms\n"; break;...
Phone number lookup Design a program that has two parallel arrays: a string array named people...
Phone number lookup Design a program that has two parallel arrays: a string array named people that is initialized with the names of seven of your friends, and a string array named phoneNumbers that is initialized with your friends phone numbers. The program should allow the user to enter a persons name (or part of a persons name). it should then search for that person in the people array. If the person is found, it should get that persons phjone...
C++ Programming   You are to develop a program to read Baseball player statistics from an input...
C++ Programming   You are to develop a program to read Baseball player statistics from an input file. Each player should bestored in a Player object. Therefore, you need to define the Player class. Each player will have a firstname, last name, a position (strings) and a batting average (floating point number). Your class needs to provide all the methods needed to read, write, initialize the object. Your data needs to be stored in an array of player objects. The maximum...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take the array and its size as input params and return a bool. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out...
Your assignment is to write a c++ function that can calculate values for any 5 th...
Your assignment is to write a c++ function that can calculate values for any 5 th order polynomial function. ?(?) = ?0 + ?1? + ?2? 2+?3? 3 + ?4? 5 + ?5? 5 Your function should accept only two parameters, the first parameter should be the value of x at which to calculate y(x). The second parameter should be an array with 6 elements that contain the coefficients a0 to a5. The output of your function should be the...
Write a code in c++ using linear insertion following the steps below. Comment your work. 1....
Write a code in c++ using linear insertion following the steps below. Comment your work. 1.    Ask the user for the name of a file containing data. If it does not exist, the program should display an error, then ask for a new file name. Entering an asterisk (*) as the first and only character on a line should terminate the program. 2.     You can use a statically-allocated one-dimensional array of doubles for this with length 100. You...
In c++ create a class to maintain a GradeBook. The class should allow information on up...
In c++ create a class to maintain a GradeBook. The class should allow information on up to 3 students to be stored. The information for each student should be encapsulated in a Student class and should include the student's last name and up to 5 grades for the student. Note that less than 5 grades may sometimes be stored. Your GradeBook class should at least support operations to add a student record to the end of the book (i.e., the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT