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
alex41 [277]
3 years ago
6

(a) Write a program which calculates and displays the obtained marks, percentage in six subjects and assigns grades based on per

centage obtained by a student.
i. if the percentage is above 90, assign grade A
ii. if the percentage is above 75, assign grade B+
iii. if the percentage is above 70, assign grade B
iv. if the percentage is above 65, assign grade C+
v. if the percentage is above 60, assign grade C
vi. if the percentage is above 55, assign grade D+
vii. if the percentage is less than 50, assign grade F
(Hint: using logical operators)
c++ programming
Computers and Technology
1 answer:
dangina [55]3 years ago
5 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int scores[6];

   int sum =0;

   string grade;

   for(int i =0; i < 6; i++){

       cin>>scores[i];

       sum+=scores[i];    }

   double percent = sum/6.0;

   if(percent > 90){        grade ="A";    }

   else if(percent>75){        grade ="B+";    }

   else if(percent>70){        grade ="B";    }

   else if(percent>65){        grade ="C+";    }

   else if(percent>60){        grade ="C";    }

   else if(percent>55){        grade ="D+";    }

   else if(percent<50){        grade ="F";    }

   cout<<grade;

   return 0;

}

Explanation:

This declares the 6 scores using an array

   int scores[6];

This initializes the sum of all scores to 0

   int sum =0;

This declares the grade as string

   string grade;

This iterates through the scores

   for(int i =0; i < 6; i++){

This gets input for each score

       cin>>scores[i];

This adds up the scores

       sum+=scores[i];    }

This calculates the percentage

   double percent = sum/6.0;

The following if statements determine the grade

<em>    if(percent > 90){        grade ="A";    }</em>

<em>    else if(percent>75){        grade ="B+";    }</em>

<em>    else if(percent>70){        grade ="B";    }</em>

<em>    else if(percent>65){        grade ="C+";    }</em>

<em>    else if(percent>60){        grade ="C";    }</em>

<em>    else if(percent>55){        grade ="D+";    }</em>

<em>    else if(percent<50){        grade ="F";    }</em>

This prints the grade

   cout<<grade;

You might be interested in
Suggest two other subtasks that may be performed in a dice game?
saul85 [17]
I do not even know wht to tell u
4 0
3 years ago
Read 2 more answers
When using a template to compose a memorandum which key on the keyboard moves the cursor to the next field
marishachu [46]
The tab key moves the cursor to the next field in the tab order, which is set by the programmer.
8 0
3 years ago
What is better electric or gas cars.
MArishka [77]

Answer:electric

Explanation:better for the environment and cheaper.

5 0
3 years ago
Read 2 more answers
What is the most popular genre of video games?
marissa [1.9K]

Explanation: Battle Royale games are currently the market's most popular genre of games. These types of games fall under the action category.

Answer:  

A. Action

6 0
3 years ago
Read 2 more answers
What will be the value of input_value if the value 5 is input at run time?
Lunna [17]

Answer:

15

Explanation:

The if else state is used for checking the condition and if the condition is TRUE and program can execute the statement  within the if else.

Initially input_value is 5

then the if statement check the condition 5>5, condition FALSE because 5==5

it not less than 5.

then program move to else if and check condition 5>2, condition TRUE.

then, input_value = 5 + 10=15 execute and update the value to 15.

After that, program terminate the if else statement.

Therefore, the answer is 15.

5 0
4 years ago
Other questions:
  • What are the example of dedicated computers?
    5·1 answer
  • What type of engine is common on boats designed for shallow water?
    13·1 answer
  • The list below represents the contents of a computer's main memory. I've left every other byte blank. Assume that the letters at
    14·1 answer
  • The idea behind ____ is that the peripheral can simply be plugged in and turned on, and that the computer should dynamically rec
    10·1 answer
  • Answer the following
    11·1 answer
  • What sound signal tells another boater that you wish to pass on your starboard (right) side?
    15·1 answer
  • Select the correct answer.
    6·2 answers
  • I have this assignment due TONIGHT BEFORE 10PM! Please help. 50 points for whoever will help!! Here is the assignment.
    7·1 answer
  • Why do you think it is important to consider ethical considerations when reviewing technology and assessing the impact of partic
    9·1 answer
  • Does anyone know what to do when brainly won't let you answer questions? I click on answer question and then it just sits there
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!