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]
3 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]3 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
A sonar operator on a battleship looks at a display that contains a spatial layout of the distribution of echoes from the surrou
ankoles [38]

Answer:

The sonar operator looks at the display a forms an internal representation of the strength of the evidence that a submarine is present. If this exceeds an internal, subjective threshold,the sonar operator tells the captain that a submarine is present.

8 0
3 years ago
Suppose we are sorting an array of nine integers using heapsort, and we have just finished one of the reheapifications downward.
Ilia_Sergeevich [38]

Answer:

3

Explanation:

Heap sort pick an item from the first or last position in an array and compares it with other items in other positions in the array, swapping position if they meet the condition.

The array above has three maximum items arranged sequentially in the array, this is prove that there have been 3 reheapifications in the array.

7 0
3 years ago
Where can page numbers appear? Check all that apply.
umka2103 [35]

Answer:

in the header in the footer

Hope it helps!!!

Explanation:

4 0
2 years ago
Research and discuss the similarities and differences between cloud computing and client-server computing. Discuss the pros and
harkovskaia [24]

Answer:

Cloud computing as a virtual hosting tool, is much more theoretical. Both servers, applications, and communications are hosted in the cloud, off property, rather than being available via computer machine whereas In computing client/server, a controller gets client requests mainframes and needs to share its services, programs and/or data of one sometimes more client systems on the internet, and a client would be a portable platform that specific portions with a server and make use of a finite resource.

Explanation:

<u>Similar to cloud computing and client-server computing: - </u>

  • The cloud computing and client-server networking underpinning principles are the same. That is contact between client and server.
  • Throughout networking and client-server networking, user nodes can communicate (queries) with databases that live locally or are located in many other networks.

<u>Difference between computing and client-server computing: </u><u>- </u>

Resources: -

  • In computing client-server, the corporation or association controls the tools.
  • The services are offered in cloud computing by third parties or other businesses.

<u>The purpose of cloud computing and client-server computing is different:- </u>

  • Client-server computing is targeted at use. In computation, client-server clients request a product from the cloud. The operating system runs the test, then returns it.
  • Cloud computing is a sort of system in which the IT-related services are leased to the clients as a contract.

<u>Pros and cons of Cloud Computing:- </u>

The Pros:-

  • Lower costs for business:-The cloud is saving a lot of money for a medium-sized or small enterprise.
  • Better Reliability:- A dedicated group of experts performs all programming with such a cloud computing alternative.

The Cons:-

  • Limited Control:- When a firm stores cloud data, they have very limited control of it.
  • There have been security issues. The cloud isn't too attuned for every company to position some information on even a cloud.

<u>Pros and cons of client-server computing:- </u>

The Pros:-

  • Improved data sharing:- Data stored via the normal business method and processed on a server is available over an approved connection for the intended users.
  • Security:- Database has stronger access control and methods to ensure data could only be accessed or abused by approved clients.

The Cons:-

  • Overloaded Servers:- When multiple simultaneous requests from the client are made, the server is significantly overloaded, causing congestion in traffic.
  • Impact of centralized architecture:- Because it is centralized if a vital server fails to satisfy customer requests, the client-server then lacks good network robustness.

5 0
3 years ago
Drag the tiles to the correct boxes to complete the pairs.
ra1l [238]

Answer:

ac be df

Explanation:

7 0
3 years ago
Other questions:
  • The first step in creating photographs with good backgrounds is which of the following? Learning to see the background before ta
    11·2 answers
  • In the mouse properties Window, you Can
    6·1 answer
  • A keyboard is a/an _____. interconnector port packet NAS
    7·1 answer
  • If a piece of software designed to run on Windows XP can run on the latest version of Windows, we say the latest version of Wind
    14·1 answer
  • What kind of a computer language could PROGRAM A be referred as?
    8·1 answer
  • When was kale discovered?
    9·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • Digital on a smart phone means the camera is actually zooming in on the photo itself not the subject that you are shooting true
    8·1 answer
  • What gaming PC should I get
    14·2 answers
  • Answer for 5,6,7 any one know plz
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!