Question

USE while structure to create and control a loop Professor James asked you to write a...

USE while structure to create and control a loop

Professor James asked you to write a letter grade program for him.  The program should ask for score and display the appropriate letter Grade base on the following grading policy. Run the programs for 5 Students with grade of (90, 72,89,56, 62).

If  Grade >= 90   print  “A” and “excellent”

  Grade >= 80  print “B”  and “very Good”

  Grade >= 70  print  “C”  and “Good”

  Grade >= 60  print “D” and “passed”

  Below  60 is “F”

Submit the following :

1) Algorithm and flowchart    50

2) Source code   40

3) output           10


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

Code

#include<iostream>

using namespace std;

int main()

{

//declare variables

int i=0;

int Score;

while(i<5)//while loop till i is less then 5

{

//prompt user for asking the score

cout<<"Enter the "<<(i+1)<<" student's Score: ";

//store in score variable

cin>>Score;

cout<<"Letter Grade : ";

if(Score>=90)//check if the score is greater then or equals to 90 then print A

cout<<"A excellent"<<endl;

else if(Score >= 80 ) //check if the score is greater then or equals to 80 then print B

cout<<"B very Good"<<endl;

else if(Score >= 70 ) //check if the score is greater then or equals to 70 then print C

cout<<"C very Good"<<endl;

else if(Score >= 60 ) //check if the score is greater then or equals to 60 then print D

cout<<"D very Good"<<endl;

else//else it is less then 60 and print Fs

cout<<"F"<<endl;

cout<<endl<<endl;

i++;

}

return 0;

}

output

algorithm

Input: Student Score

1. if (the score is greater then or equal to 90)

then

print the Grade is A Excellent

End If

2. if (the score is greater then or equal to 80)

then

print the Grade is B Very Good

End If

3. if (the score is greater then or equal to 70)

then

print the Grade is C Good

End If

4. if (the score is greater then or equal to 60)

then

print the Grade is D Passed

End If

5. if (the score is less then to 6 0)

then

print the Grade is F

End If

End

Flow Chart

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
USE while structure to create and control a loop Professor James asked you to write a...
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
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