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
saveliy_v [14]
2 years ago
11

Write a program that has an input as a test score, and figures out a letter grade for that score, such as "A", "B", "C", etc. ac

cording to the scale: 90 or more - A 80 - 90 (excluding 90) - B 70 - 80 (excluding 80) - C 60 - 70 (excluding 70) - D else - F The program should print both a test score, and a corresponding letter grade. Test your program with different scores. Use a compound IF-ELSE IF statement to find a letter grade.
Computers and Technology
1 answer:
Marizza181 [45]2 years ago
6 0

Answer:

The program in csharp for the given scenario is shown.

using System;

class ScoreGrade {

static void Main() {

//variables to store score and corresponding grade

double score;

char grade;

//user input taken for score

Console.Write("Enter the score: ");

score = Convert.ToInt32(Console.ReadLine());

//grade decided based on score

if(score>=90)

grade='A';

else if(score>=80 && score<90)

grade='B';

else if(score>=70 && score<80)

grade='C';

else if(score>=60 && score<70)

grade='D';

else

grade='F';

//score and grade displayed  

Console.WriteLine("Score: "+score+ " Grade: "+grade);

}

}

OUTPUT1

Enter the score: 76

Score: 76 Grade: C

OUTPUT2

Enter the score: 56

Score: 56 Grade: F

Explanation:

1. The variables to hold the score and grade are declared as double and char respectively.

int score;

char grade;

2. The user is prompted to enter the score. The user input is not validated and the input is stored in the variable, score.

3. Using if-else-if statements, the grade is decided based on the value of the score.

if(score>=90)

grade='A';

else if(score>=80 && score<90)

grade='B';

else if(score>=70 && score<80)

grade='C';

else if(score>=60 && score<70)

grade='D';

else

grade='F';

4. The score and the corresponding grade are displayed.

5. The program can be tested for different values of score.

6. The output for two different scores and two grades is included.

7. The program is saved using ScoreGrade.cs. The .cs extension indicates a csharp program.

8. The whole code is written inside a class since csharp is a purely object-oriented language.

9. In csharp, user input is taken using Console.ReadLine() which reads a string.

10. This string is converted into an integer using Convert.ToInt32() method.

score = Convert.ToInt32(Console.ReadLine());

11. The output is displayed using Console.WriteLine() or Console.Write() methods; the first method inserts a line after displaying the message which is not done in the second method.

12. Since the variables are declared inside Main(), they are not declared static.

13. If the variables are declared outside Main() and at the class level, it is mandatory to declare them with keyword, static.

You might be interested in
To draw a clustered cylinder chart, first select the data to be charted and then click the column button (insert tab | charts gr
d1i1m1o1n [39]
It is true that to <span>draw a clustered cylinder chart, first select the data to be charted and then click the column button (insert tab | charts group).</span>
5 0
3 years ago
How to delete account on this
qwelly [4]

Answer:

Explanation:

Go and edit your profile then go on prefernces you will see that its written delete my account and that's how you delete your account on brainly.com and if you want to delete you account on phone then

Open your phone's Settings app.

Tap Accounts. If you don't see "Accounts," tap Users & accounts.

Tap the account you want to remove Remove account.

If this is the only Google Account on the phone, you'll need to enter your phone's pattern, PIN, or password for security.

Hope this helped you!

5 0
2 years ago
Read 2 more answers
Jose is upgrading the memory on his laptop. The laptop has two slots for RAM, but one of them is currently being occupied. He ha
inn [45]

Answer:

Reseat the new stick of RAM

Explanation:

Joe needs to reseat the new stick of the RAM. For that, he should gently release the clips which hold RAM in the correct posture, and one on each side. Joe is required to do this for each of the available memory modules. And then he will have the cautiously replace all the memory modules( 2 in number) through to DIMM slots which are on the motherboard. Make sure that you have noted down the locations of each notches on the RAM as well as the DIMM slots.

3 0
3 years ago
Wendy wants to learn how to write a computer program that can get the dimensions of a rectangle from the user and then tell the
otez555 [7]

Answer:

algorithms for finding the area

Explanation:

you need algorithms to find out any computer input information.

4 0
3 years ago
Read 2 more answers
Beth’s multimedia business specializes in sound integration and editing. A New project requires video editing and the creation o
ANEK [815]

Answer:

A. Adobe illustrator

Explanation:

4 0
3 years ago
Other questions:
  • . When you create a template class, ___________.
    15·1 answer
  • Which of the following is NOT a Boolean Search term used to refine search engine results? A. AND B. With C. OR D. NOT
    14·2 answers
  • The section called Breaking Substitution Ciphers (p. 166) describes a "random substitution cipher," in which each letter of the
    11·1 answer
  • Can you combine a wireless and wired lan in the same home
    14·1 answer
  • Banks use _____, which are electronic transmissions of account exchange information over private communications’ networks.
    14·1 answer
  • What connectors are available for components to be connected externally to the motherboard
    12·2 answers
  • Plz tell the answer I I'll mark u as the brainliest
    14·1 answer
  • High level languages are closer to machine language than humans yes or no​
    12·2 answers
  • You are going to create an Arduino sketch where you have two push buttons, one piezo, one
    10·1 answer
  • How does applying Fontworks effects to text on an advertising flyer change the text?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!