Write a Java application that computes and prints the grade of a student according to the following algorithm:

1) It should read from the user TMA score and MTA score.
2) If their sum is less than 15, the grade "FC" should be printed and the program will stop.
2b) Otherwise,
2b) It will read from the user final exam score.
- If it is less than 20, the grade "FF" should be printed and the program will stop.
- Otherwise,
- If the total score (sum of all scores) is less than 50, the grade "F" should be printed.
- Otherwise, the grade "P" should be printed

Hints:
- All scores are real numbers
- You could assume that the user will insert valid scores

Recommended Answers

All 5 Replies

That's just a copy of your assignment. Surely you didn't expect anyone to give you the solution? What help EXACTLY do you need?
What have you done so far?
Read the rules before continuing https://www.daniweb.com/community/rules

ps: Spec implies program will NOT stop if total score > 50. And the two "otherwise"s are redundant. Maybe whoever wrote that exercise needs to go a programming course themselves ;)

thanks for your reply

eeee.jpg

in the output print all grade what is the problem

You missed out the bits of the spec that said "and the program will stop".

You can make your program stop at any point by calling

System.exit(0);

there is a problem in my code becouse when i run the app and put the grade all grade printed !

Yes, I understood that from your previous post. I already explained why that happens, and gave you a HUGE hint as to how to fix it. Just re-read my previous post, and think.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.