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
Levart [38]
2 years ago
8

A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to

a student, based on the average of his or her four test scores: 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a program that uses an array of string objects to hold the five student names, an array of five characters to hold the five students' letter grades, and five arrays of four doubles to hold each student's set of test scores. The program should allow the user to enter each student's name and his or her four test scores. It should then calculate and display each student's average test score, and a letter grade based on the average. Input Validation: Do not accept test scores less than 0 or great than 100.
Computers and Technology
1 answer:
AlladinOne [14]2 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int main()

{

const int numofStudents = 5;//number of students

const int numofTests = 2;//number of tests taken by students

const int grade = 5;//number of grades available

char letter[grade] = { 'A','B','C','D','F' };

double table[numofStudents][numofTests];//defining 2darray with names and scores

string names[numofStudents];//storing names of students

for (int num = 0; num < numofStudents; num++)//storing names and scores of students

{

 cout << "Enter student's name: ";

 cin >> names[num];

 for (int test = 0; test < numofTests; test++)//scores loop

 {

  cout << "Enter the test score: ";

  cin >> table[num][test];

  if (table[num][test] < 0 || table[num][test]>100)//input validation

  {

   cout << "Invalid input. Try again" << endl;

   cin >> table[num][test];//input again

  }

 }

}

for (int i = 0;i < numofStudents;i++)//calculating averages and grades

{

 int sum = 0;

 cout << "Test scores for " << names[i] << ": " << endl;

 for (int j = 0;j < numofTests;j++)

 {

  cout << table[i][j] << " ";

  sum += table[i][j];//summing scores

 }

 cout << endl;

 float average = (float)sum / numofTests;//calculating the average

 cout << "Making an average of: "<< average;

 if (average <= 100 && average >= 90)//assigning a grade

 {

  cout << " and has received an " << letter[0];

 }

 else if (average <= 89 && average >= 80)

 {

  cout << " and has received a " << letter[1];

 }

 else if (average <= 79 && average >= 70)

 {

  cout << " and has received a " << letter[2];

 }

 else if (average <= 69 && average >= 60)

 {

  cout << " and has received a " << letter[3];

 }

 else if (average <= 59 && average >= 0)

 {

  cout << " and has received an " << letter[4];

 }

 else

 {

  cout << "Invalid scores entered." << endl;

 }

 cout << endl;

}

 return 0;

}

Explanation:

We first define the number of students, number of tests and number of grades available for assignments. We then fill in the 2D array of students names and their scores making sure assigning more than 100 and less than 0 is not allowed. We then sum the scores and retrieve an average. Using the average, a letter grade is assigned to that individual.

You might be interested in
A county collects property taxes on the assessed value of property, which is 60 percent of its actual value. For example, if a h
Zolol [24]

Answer:

actual_value = float(input("Enter the actual value of a piece of property: "))

tax_rate = float(input("Enter the current tax rate for each $100.00 of assessed value: "))

assessed_value = actual_value * 0.6

tax = (assessed_value * tax_rate) / 100

print("The annual property tax is $" + str(tax))

Explanation:

*The code is in Python.

Ask the user to enter the actual value and the tax rate

Calculate the assessed value, multiply the actual value by 0.6

Calculate the tax, multiply the assessed value by the tax rate and divide result by 100

Print the tax

7 0
3 years ago
write the algorithm, flowchart and BASIC program to calculate the area of the rectangle length 50m and width 30m.​
GalinKa [24]

Answer:

The Basic Program is as follows:

10 LENGTH = 50

15 WIDTH = 30

20 AREA = WIDTH * LENGTH

25 PRINT AREA

30 END

The Algorithm is as follows:

1. Start

2. Let Length = 50

3. Let Width = 30

4. Compute Area = Length * Width

5. Display Area

6. Stop

See Attachment for flowchart (flowchart is designed using draw io tools)

Explanation:

The flowchart, algorithm and basic program all follow the same sequence and explanation

Using the basic program as a case study;

Line number 10: The program starts by initializing LENGTH to 50

Line number 15: It then initializes WIDTH to 30

Line number 20: The AREA is calculated by LENGTH * WIDTH

Line number 25: The value of AREA is printed afterwards

Line number 30: Lastly, the program stops execution

8 0
3 years ago
The code selection above is taken from the Color Sleuth activity you just completed. This selection would count as an abstractio
Vinvika [58]

Answer:

b

Explanation:

4 0
3 years ago
What does the headgear of a mine do
deff fn [24]
Hard to answer to short but I will try the head gear let's you talk to people on the internet
5 0
3 years ago
Read 2 more answers
Select the correct answer from each drop-down menu. Select the correct type of address reference.
Reika [66]

<u><em>[ Absolute ]</em></u><em> Addresses do not change if you copy them to a different cell.</em>

<u><em>[ Relative ]</em></u><em> </em><em>Addresses change depending on the cells you copy them to.</em>

8 0
2 years ago
Read 2 more answers
Other questions:
  • : How does the founder of Wikipedia keep a tight reign on accuracy? HELP PLEZ AT LEAST A PARGRAPH PLES
    6·1 answer
  • For a wire with a circular cross section and a diameter = 3.00mm calculate the following: (m means meter. mm means millimeter. c
    5·1 answer
  • Is a network where connected devices are located within the same building.
    5·2 answers
  • Casey, a woodworker, is developing his own website. He plans to use the site as a means of selling his handmade furniture. While
    10·1 answer
  • python Write a program that will take a file named Celsius.dat that contains a list of temperatures in Celsius (one per line), a
    9·1 answer
  • An organization's Finance Director is convinced special malware is responsible for targeting and infecting the finance departmen
    13·1 answer
  • Which type of error occurred in the following lines of code?
    13·1 answer
  • What form of contacts can be shared in Outlook 2016?
    9·2 answers
  • The memory used by the CPU to temporarily hold data while processing is called _______. random access memory central processing
    5·1 answer
  • What kind of AR target category makes sense for a playing card with a picture on it?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!