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...
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...
Use C++ to implement the following program about Prime Factorization of a Number. Do BOTH parts...
Use C++ to implement the following program about Prime Factorization of a Number. Do BOTH parts of the problem or you will lose points. Provide comments to explain each step. a. Write a function that takes as a parameter a positive integer and returns a list (array) of the prime factors of the given integer. For example, if the parameter is 20, you should return 2 2 5. b. Write a function that tests the above function by asking the...
Download the ProductUpTo3.java file, and open it in jGrasp (or a text editor of your choice)....
Download the ProductUpTo3.java file, and open it in jGrasp (or a text editor of your choice). This program will read in three integers with Scanner, put the values in an array of int, and then print the product of the three values. Example output of the program is shown below, with user input shown in bold: Enter first integer: 3 Enter second integer: 4 Enter third integer: 5 Product: 60 More details about the method you need to write are...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT