I am new to Java Programming, I need help on this.. Any help would be appreciated.

Write a java program that generates a random number between 50 and 100 for a student grade and determines the letter grade of the student. The student grade is determined based on the following criteria:

90-100 A

80-89 B

70-79 C

60-69 D

Less than 60 F

In your program, you can use the following statement to generate a random number between 50 and 100

int grade = (int)(Math.random() * 50) + 50;

Use a loop to to generate 5 random grades and output the letter grade for each. The output of your program should be similar to:

Student grade is 73 which is a C.

Student grade is 52 which is a F.

Student grade is 90 which is a A.

Student grade is 88 which is a B.

Student grade is 82 which is a B.

Recommended Answers

All 2 Replies

Welcome to the forums. Here you'll share your code and point to where you are having an issue on such and such a line. Maybe there are homework forums but here, you share your code and members try to resolve the error.

If we wrote your code, you would not have learned what the course is teaching.

Hi,

I think you're juste starting so let's be simple :

  1. You already have the statement that generates the random number,
  2. All you need to do is an if...else to check if the random number is > 90 && < 100 to display A
  3. Start by one value of the random integer and only one grade letter
  4. Adding some else if should be easy after that
  5. Puting the whole thing in a loop should also be easy.
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.