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
What attack cracks a password or encryption key by trying all possible valid combinations from a defined set of possibilities (a
ss7ja [257]

Answer:

Brute Force attack.

Explanation:

A network is a platform where end user devices like computers are connected to communicate and share resources. There are public networks and private networks.

A public network has its end devices and servers configured with a public IP address, which is routable on the internet, while private networks uses private IP addresses which can be used on the internet.

Private networks can be made accessable to public users by configuring an authentication and authorization policy, which could be one or a multi factor authentication. These requires a password and other factors to access the services of a private network.

An attacker can easily access a one factor or a password accessible user account, if the password is weak by using the process called a brute Force attack.

The brute Force attack exploits the vulnerability of weak passwords by entering possible valid combination from a defined set of possibilities.

6 0
3 years ago
The point at coordinates (2, -18) is in what direction from the origin?
laila [671]
On a graph, move 2 spaces to the right and from there move 18 spaces down. Now, where you've ended, make a dot. The distance fro the origin is -2/18 (as a fraction).
4 0
3 years ago
Has replaced the need for landline telephones in many instance​
Vladimir79 [104]

Explanation:

million landlines. During this same time the number of mobile phone lines that have been subscribed to has ...

Characteristics

7 0
3 years ago
Today car-buying customers can enter negotiation armed with accurate facts and figures about a car. Describe how car buyers felt
cluponka [151]
Since there was no internet back then, life was hard, the buyers had to pay more money, and it was very difficult. Nowadays it's different. People could just stay home go on the internet and choose a car, then the next day or a few more days, there car is right in their parking lot. Hoped this helps! :)
3 0
3 years ago
Chapter 20 reading and vocab review
aev [14]

Answer:

Essentially additive editing and stringing “the good stuff” together, whereas subtractive is more about stringing all your raw footage together and “removing the bad stuff”

Additive editing feels confident and concerned with the pursuit of a specific, existing vision. And it’s faster. Subtractive editing feels like a deeper listening to what the footage is saying, and holding on to many potential permutations.

Explanation:

Addictive editing -  creating a program from raw footage by starting by starting with nothing and adding selected components

Subtraction editing  - creating a program by removing redundant or poor quality material from the original footage

7 0
2 years ago
Other questions:
  • You are attempting to update a Windows image that has been mounted under C:\mount on your local system. What command must you us
    13·1 answer
  • 25 POINTS + BRAINLIEST PLS HELPWhere should you put the argument for a command?
    13·1 answer
  • Give me give me keyboard on this phone please provide nice I can't type where is the keyboard.Give me give me keyboard on this p
    6·2 answers
  • The part of the computer that provides access to the internet is the-?
    15·2 answers
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    8·1 answer
  • Consider a channel that can lose packets but has a maximum delay that is known. Modify Protocol rdt2.1 to include sender timeout
    11·1 answer
  • How is the bootstrap program started?
    6·2 answers
  • In which of the following scenarios would you choose to embed versus import data?
    8·1 answer
  • How do you change your name on brainly after you have made an account​
    5·1 answer
  • Explain the different type of shift register counter ​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!