1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
snow_lady [41]
3 years ago
6

Write a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average tes

t score by printing it to the terminal.

Computers and Technology
1 answer:
eduard3 years ago
5 0

Answer:

I am writing the program in C++ and Python.

C++ code:

#include <iostream>  // for input output functions

using namespace std;   // identifies objects like cin cout

int main() //start of main() function body

{  //  test scores variables are declared along with average and sum variables

 double test_score1, test_score2, test_score3, test_score4, test_score5, average, sum;      

   cout << "Enter 5 test scores: \n";  //prompts user to enter 5 test scores

   cin >> test_score1 >> test_score2 >> test_score3 >> test_score4 >> test_score5;  //reads values of five test scores entered by user

   sum = test_score1 + test_score2 + test_score3 + test_score4 + test_score5;  // calculates the sum of the five test scores

   average = sum / 5;      //computes the average of five test scores

   cout << "The average test score is: " << average;  

 //displays the computer average of the five test scores entered by the user

}

Explanation:

The program prompts the user to enter the values of 5 test scores. It the calculates the sum of all these 5 input test scores and stores the result in sum variable. In order to compute average test score the sum of these 5 test scores is divided by the total number of test scores that is 5 and the result is stored in average variable. Lastly it displays the average by displaying the value of the average stored in the average variable.

Python Program:

num=5  # total number of test scores

list=[]  #list to store values of 5 test scores

for i in range(0,num):  #loop to enter values of test scores

#prompts user to enter values for 5 test scores

   test_scores =int(input("Enter the five test scores"))

   list.append(test_scores)  #appends the input test scores in the list

average=sum(list)/num  #calculates sum of the values stored in list and #divides the value of sum with the total number of test scores i.e. 5

print("Average test score is: ",round(average,2))

#displays average of the five test scores rounding up to two decimal places

Explanation:

This is a small program in Python to compute average test score. If you want to take separate input for each of the five test scores you can use the following program:

#takes value for each test score seperately from user

testScore1 = int(input('Enter 1st test score: '))  

testScore2 = int(input('Enter 2nd test score : '))

testScore3 = int(input('Enter 3rd test score : '))

testScore4 = int(input('Enter 4th test score : '))

testScore5 = int(input('Enter 5th test score : '))  

#calculates sum of each test score

sum = (testScore1 + testScore2 + testScore3 + testScore4 + testScore5)  

#method to compute average test score

def average(sum):

   return sum / 5         #divide value of sum with total number of test scores  

#calls average function to display average test score using print statement

print("average test score is: " , average(sum))

The programs along with their outputs is attached in the screenshots.

You might be interested in
Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI).
dusya [7]

Explanation:

I have attached the answer as an image. I can't upload the file as it requires a licensed product and I only used demo version. I can provide the file too if you can give me your vlsig file required to use full software. However, If you just copy along the images on your Visual Studio, you will easily create the files yourself. Answer is provided for both scenarios as part A and part B, one which stops after 1 iteration and the one which loops until 0 height is given.

8 0
3 years ago
The ____ feature automatically locates specific text and then replaces it with desired text. Find and Replace Locator Locate and
jekas [21]
The "Find and Replace" feature automatically locates specific text and then replaces it with desired text.
8 0
4 years ago
The names of the governing body or organizationds that creates rules for information technology and information communication te
IceJOKER [234]

Answer:

Alliance for Telecommunications Industry Solutions

Explanation:

Alliance for Telecommunications Industry Solutions  is the main body that creates rules for information technology and information communication technology.

This agency create solutions to supports the release of new products and services into the communications marketplace. It also act as an agency that standardizes the  wireless and wireline networks activities. It is accredited by the American National Standards Institute (ANSI).

5 0
3 years ago
Which tab provide text formatting features
kirill [66]

Answer:

Home tab

Explanation:

Assuming that this question is based on providing text formatting features in Microsoft Word, this feature is found on the Home tab in the Font group or the Font dialog box. Some of these formatting features include underline style, colour, strikethrough, superscript, and subscript.

4 0
4 years ago
one business rule is that each project has one manager. Identify two (and no more than two) problems with the data structure or
Vinil7 [7]

Answer:

1. The data will not be tallying up - there will great variations and deviance.

2. There will be not enough data points

Explanation:

The management style, though it uses one manager, is not devoid of problems in the system. For example, there will be great difficulty in the collection of accurate data to properly define the system. This presents a great misinformation on the outcome of the data process. This is likely to be caused by the first factor that is the data having a lot of discrepancies. The discrepancy causes the data to be meaningless in terms of the trends displayed. In addition, the lack of enough points posses a challenge to the data collection and processing procedure. The data base management system can be used to concentrate data on a central point of reference.

3 0
3 years ago
Other questions:
  • Write a function cipher(plaintext, n) to shift all characters in a string of text. Your function should take 2 parameters, the p
    15·1 answer
  • Write a function namedadd_complex that adds the correspondingnumbers of its arguments (both complexstructures), then returns the
    5·1 answer
  • Riley is using access to collect data for a science project. he is creating a report and wants to apply predefined color and fon
    6·1 answer
  • Using the drop-down menus, correctly complete the sentences.
    5·2 answers
  • The file extension for Access 2007 and 2010 database filenames is .accdb. What is the file extension for older versions of Acces
    5·1 answer
  • Mobile Device Company (MDC) discovers that defamatory statements about its policies and products are being posted in an online f
    8·1 answer
  • What do workspaces allow a company to do?
    9·1 answer
  • Your company has purchased another company that also uses Windows Server 2016 and Active Directory. Both companies need to be ab
    11·1 answer
  • The following are three possible logon scenarios. Explain why option (c) below is preferable in terms of system security. a. Wel
    12·1 answer
  • What are the two different types of dns requests?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!