Question

You are required to write an interactive program that prompts the user for seven (7) real...

You are required to write an interactive program that prompts the user for seven (7) real numbers and performs the following tasks:

Reads and stores the numbers into one-dimensional array called A.

Calculates the sum of the numbers.

Find the average of the numbers.

Finds the smallest value of the numbers.

Prints all the results with proper headings.

Program requirements:

-     The program must contain at least five functions using necessary parameters. These functions should read the data, perform the above tasks, and print the results.

-     The program must be fully documented.

-    You must submit a hard copy of the source and a properly labeled output.

-     You should submit a digital copy of source code.

-     Test your program for different values using real numbers.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;
int main() {
double sum = 0, temp, min = 10000;
double A[7];
for(int i=0; i<7;++i){
cout<<"Enter numbers: ";
cin>>temp;
A[i] = temp;
sum = sum + A[i];
if(min > A[i])
min = A[i];
}
  
cout<<"Sum of 7 numbers is: "<<sum<<endl;
cout<<"Average of 7 numbers is: "<<sum/7<<endl;
cout<<"Minimum of 7 numbers is: "<<min<<endl;
}

====================================
See Output
Enter numbers: 12 Enter numbers: 32.1 Enter numbers: 56.3 Enter numbers: 78.5 Enter numbers: 32.1 Enter numbers: 100.1 Enter


Thanks, PLEASE RATE

Add a comment
Know the answer?
Add Answer to:
You are required to write an interactive program that prompts the user for seven (7) real...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You must write a C program that prompts the user for two numbers (no command line...

    You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using “a la russe” multiplication. The program must display your banner logo as part of a prompt to the user. The valid range of values is 0 to 6000. You may assume that the user will always enter numerical decimal format values. Your program should check this numerical range (including checking for negative numbers) and reprompt the user for...

  • write a c program for the above Write a program which prompts the user to enter...

    write a c program for the above Write a program which prompts the user to enter three integers (data type int) and then calculates the arithmetic average as a decimal number and prints the value with two decimal digits. If you have time also calculate and print the harmonic mean of the same numbers according to the following formula: 3. PT harmonic _mean-1 1 22x (Test with integer values of 4, 7, and 8. You may submit one program per...

  • Write a Java program which allows the user to perform simple tasks on a calculator. A...

    Write a Java program which allows the user to perform simple tasks on a calculator. A series of methods allows the user to select an operation to perform and then enter operands. The first method displays a menu, giving the user the choice of typing in any one of the following: +, -, *, /, or % representing the usual arithmetic operators (Each operation should be done on numbers negative(-) to positive(+), positive(+) to negative(-), negative(-) to negative(-), and positive(+)...

  •   Write codes that will produce the screen as shown Firstly, the program prompts user to...

      Write codes that will produce the screen as shown Firstly, the program prompts user to enter his name. Then it will display Hello <user name>. Next it prints out a menu which contains 5 options (1- add two integers, 2- add two strings, 3- compute factorial, 4- reverse a string, 5- quit program). Code all 5 tasks appropriately. When the task is completed (not including quitting program of course), the menu pops up again and asks user to try...

  • 1. Write a program called Numbers that a. prompts the user for a file name. b....

    1. Write a program called Numbers that a. prompts the user for a file name. b. reads that file assuming that its contents consist entirely of integers. c. prints the maximum, minimum, sum, count (number of integers in the file), and average of the numbers. For example, if the file numberinput.dat has the following content: 4 -2 18 15 31 27 Your program should produce the following output: csc% java Numbers Enter file name: numberinput.daft Maximum31 Minimum- -2 Sum -...

  • IN SPARC ASSEMBLY ONLY, write a program that prompts the user for two numbers and prints...

    IN SPARC ASSEMBLY ONLY, write a program that prompts the user for two numbers and prints the sum. THIS MUST BE IN SPARC ASSEMBLY. DO NOT WRITE IT IN NORMAL ASSEMBLY LANGUAGE. Sample: Enter Number 1: 2 Enter Number 2: 3 The sum of 2 and 3 is 5 Note: -Your program should contain .data, .bss, and .text sections -DO NOT try to optimize your code (i.e remove nops) -DO NOT write this in regular assembly, it must be in...

  • Python Code Write a program using functions and mainline logic which prompts the user to enter...

    Python Code Write a program using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. (You can use a wider range if you want, but the lower end of the range must be at...

  • write an 8086 assembly program that performs the following functions: Prompts the user to enter a set of student’s lab grades (array of 2-digit decimal numbers) and store it in the memory. Use ‘$’ sign as termination, i.e., the user enters ‘$’ at the end

    write an 8086 assembly program that performs the following functions: Prompts the user to enter a set of student’s lab grades (array of 2-digit decimal numbers) and store it in the memory. Use ‘$’ sign as termination, i.e., the user enters ‘$’ at the end of the numbers. You can assume that the maximum number of students in the lab is 20.

  • Please and thank you 2) (5 pts) Arrays & Vectors: write a program which prompts the...

    Please and thank you 2) (5 pts) Arrays & Vectors: write a program which prompts the user to enter numbers (terminated with a non-numeric), reads them simultaneously into an array of doubles and into a vector of doubles, then prints A) the array elements in the original order B) the vector elements in reverse order C) the average of the vector elements D) the largest of the vector elements Example program output, user input shown underlined Enter a list of...

  • Write a program called CountCoins.java that prompts the user for the input file name (you can...

    Write a program called CountCoins.java that prompts the user for the input file name (you can copy the getInputScanner() method given in the ProcessFile assignment) then reads the file. The file contains a series of pairs of tokens, where each pair begins with an integer and is followed by the type of coin, which will be “pennies” (1 cent each), “nickels” (5 cents each), “dimes” (10 cents each), or “quarters” (25 cents each), case-insensitively. Add up the cash values of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT