Ameerroot4's blog

By Ameerroot4, history, 2 years ago, In English
**Printing The Letter Grade**

                                        time limit per test: 1 second                         
                                     memory limit per test: 64 megabytes
                                             input:standard input
                                            output:standard output

One Day in school, There is a Math Teacher called Mike, He decided to move on to another country to live with his uncle, When mike found a new job in school in that country He is Facing a problem to Determine The Proper Letters Grades For his Students for their markes, Because The education system in that country is different from the one that who used to. So He Decided to write a code to Help Him to pick The Right Letter Grade at the same time He didn't know much information about coding like functions, if statements, switch, logical operators , Relational Operators, or maybe pointers or anything advance, But He is good in Variables and their types, Arithmetic Operators(+ , — , * , / , %) and their Priorities, So He decided using an equation in math and The Ascii code table to know what is letter's code number. help Mike to Write That Equation.

Write a program that reads a grade from The User and prints the following :

if the grade between 99.9-90 =====> The Program will print 'A'

if the grade between 89.9-80 =====> The Program will print 'B'

if the grade between 79.9-70 =====> The Program will print 'C'

if the grade between 69.9-60 =====> The Program will print 'D'

if the grade between 59.9-50 =====> The Program will print 'E'

if the grade between 49.9-40 =====> The Program will print 'F'

if the grade between 39.9-30 =====> The Program will print 'G'

if the grade between 29.9-20 =====> The Program will print 'H'

if the grade between 19.9-10 =====> The Program will print 'I'

for example Input : 90

========>>> Output : A

for example Input : 88.6

========>>> Output : B

for example Input : 76.54

========>>> Output : C

and so on.

Input : The Grade.

Output : The Proper Letter Grade.

(Remember Without using functions loop, nested loop, if statements, switch, logical operators , Relational Operators, or maybe pointers or anything advance).

Notes:

*You Need To Know The Solution is different from one to another.

**You can make more than one equation in your code feel free.

*** You don't need to make a range for those numbers(grades) above, I mean if the user input 100 , 0 , -1..., or maybe 1-9 will print (?), it's ok. the equation will not prevent those numbers from coming up. (You can include those numbers too).

**** You can solve the problem in your way for example(if the user enter 90 or 80 , 78.6) the output respectively is lower case('a' , 'b' , 'c')....., It is not necessary Upper Case.

Here Some Hints And Some Steps To Make It Easy On You :

First you need to identify The Variables like this: int x; and variable x contains the first equation(This equation help us if the user input for example floating point like these numbers : (99.2, 89.45 or 75.9) will get rid of the floating point, at the same time the number grade will change like these numbers respectively (9, 8 or 7). You need to use the result from the first equation and put the result for another equation(equation(2)) contains (mathematical operation) To get the Grade number Back again, The number that the user entered for the first time, without floating point and some changes on those numbers respectively (90 , 80 or 70). At the end, the result from second equation will put it for the third equation You need use Arithmetic Operators(+,-,*,/,%) and think about the connection between the result for example (90 , 80 or 70 ....)(The result from equation(2)) and the number of ascii code.

Here Some Hints :

Hint #1:

There is a special number in math we can use it in equation number Three and some mathematical operators to get the ascii code.

Hint #2:

Think First How Can I convert The Grade Number To The Ascii code. If The user input 90-99.9, The Proper Letter code in ascii code is (65) and we use char(65) and the program will print 'A'.

Hint #3:

For The First Time let the program works on Whole number (Integer Numbers) without floating point, After That Think How We can do it if the user input floating point with grade. For example 90 ====> 'A' / 80 ====> 'B' and so on.

Hint #4:

There is a connection Between The Three equations.

conclusion:

user entered 99.7 ====> equation(1) ====> 9 ====> equation(2) ====> 90 ====> equation(3) ====> 'A'

Another Example:

user entered 84.76 ====> equation(1) ====> 8 ====> equation(2) ====> 80 ====> equation(3) ====> 'B'

and so on.

ASCII CODE Table for Letters :

http://sticksandstones.kstrom.com/appen.html

Feel Free To Text Me If You Have Any Problem Or Something Is Not Clear To You.

  • Vote: I like it
  • -28
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
  Vote: I like it +21 Vote: I do not like it

Very difficult problem, please give hints

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Ameerroot4 (previous revision, new revision, compare).