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
What is the easiest way of ensuring that others can access a presentation that a user has created and make changes to it, while
Yakvenalex [24]

Answer:

You can share the presentation with your group. Share the presentation with everyone by email so everyone can work on it at once. Give your group members their own part to work on.

Explanation:

4 0
4 years ago
A Color class has three public, integer-returning accessor methods: getRed, getGreen, and getBlue, and three protected, void-ret
jek_recluse [69]

Answer:

The following code are:

public void dissolve() {

setRed(getRed()+1);

setGreen(getGreen()+1);

setBlue(getBlue()+1);

alpha+=1;

}

Explanation:

Here, we define the void type function "dissolve()" inside it, we set three function i.e, "setRed()", "setGreen()", "setBlue()" and then we increment the variable "alpha" by 1.

Inside those three mutators method we set three accessor methods i.e, "getRed()", "getGreen()" , "getBlue()" and increment these accessor by 1.

The values will not be returned by the mutator functions, the accessor will be returned the values.

6 0
3 years ago
Five features of any window​
Vesna [10]

Answer:

The features of any windows are

1. Start menu

2. Notification area or task bar

3. Window snipping tools

4. Using Local Area Networks

5. Windows explorer libraries

Explanation:

8 0
3 years ago
Some designer suggest that speech recognition should be used in tale phone menu system. This will allow users to interact with t
Sergio [31]

Answer:

My two arguments against the proposal are based on physical side effects and background noise interference.

Explanation:

To start with physical side effects, the use of speech recognition technology might make users experience physical discomfort. This is due to the fact that users who interact with the system by speaking for a long period would experience dry mouth, temporary loss of voice, vocal problems and muscle fatigue. In addition, the fact that users would always speak in an unnatural way to make the system interpret commands effectively could lead to voice strain.  

Also, users need to be in a quiet environment before they can get the best out of speech recognition technology. This is because background noise can interfere with commands and create a mix-up which the system cannot interpret. In other words, when an environment is noisy, speech recognition technology would find it difficult to differentiate between users voice and background noise.

4 0
3 years ago
Use search engines and websites to research the following WAN technologies to complete the table below:
Yuki888 [10]

Answer:

Explanation:

I am attaching the table as an image with updated table containing required information for the following WAN technologies.

T1/DS1 => Digital Signal 1 (T-Carrier 1),

T3/DS3 => Digital Signal 3 (T-Carrier 3),

OC3 (SONET) => Optical Carrier 3 (Synchronous Optical Networking),

Frame Relay,

ATM => Asynchronous Transfer Mode,

MPLS => Multi-protocol Label Switching,

EPL => Ethernet Private Line.

Although you have mentioned most of the information yourself, there were some wrong data in it.  So I have updated them with correct information in the attached table.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which error produces incorrect results but does not prevent the program from running?
    7·1 answer
  • Ada lovelace designed the first computer
    7·1 answer
  • you have obtained a program under development to test on your computer. While you are using the program, it crashes with a messa
    9·1 answer
  • Describe Format Painter by ordering the steps Jemima should follow to make the format of her subheadings more
    6·1 answer
  • What is a web designer's favorite snack
    12·2 answers
  • What is an Odometer (Driver's Ed)
    7·2 answers
  • The various protocols in use on the internet are said to operate in layers in which the protocol(s) at each layer solve one prob
    5·2 answers
  • What relationship do MP3s and MP3 players have with video files?
    11·1 answer
  • In a typical day, what types of Computer-Mediated Communication do you use?
    8·1 answer
  • Decrypt this secret message if your able to a lot will come..
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!