Answer to Question #255428 in Java | JSP | JSF for Pinehas Mumbashu

Question #255428

Create a program that takes in a student first name and average mark obtained, the system should the group the students using the first vowel in their name. For example if the student name is Jena, then the student belongs to group E and if the name was Jack then the student belongs to group A[HINT: Make use of the indexOf() and contains() methods from the string class]. The program should further categorize the mark is follows:

 

 Marks obtained

Grade Level

Message

80 – 100

1

Magnificent!!

70 – 79

2

Excellent!!

60 – 69

3

Good work!!

50 – 59

4

Good!!

0 – 49


Fail – Try again next Year!!

Greater than 100 or

less than 0

X

Invalid Marks!!, Marks too high. Or Invalid Marks!!, Negative marks not allowed.

 

Sample run 1:

Enter student full names: Johnathan

Enter average mark obtained: 88

Output: Hi Johnathan, you were placed in group O

Grade Level: 1

Comment: Magnificent!!



1
Expert's answer
2021-10-23T03:04:30-0400
public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    System.out.println("Enter student full names: ");
    String name = in.next();
    System.out.println("Enter average mark obtained: ");
    int mark = in.nextInt();
    System.out.println("Hi " + name);
    if (0 <= mark && mark < 50) {
      System.out.println("Grade Level: 0");
      System.out.println("Comment: Fail – Try again next Year!!");
    } else if (50 <= mark && mark < 60) {
      System.out.println("Grade Level: 4");
      System.out.println("Comment: Good!!");
    } else if (60 <= mark && mark < 70) {
      System.out.println("Grade Level: 3");
      System.out.println("Comment: Good work!!");
    } else if (70 <= mark && mark < 80) {
      System.out.println("Grade Level: 2");
      System.out.println("Comment: Excellent!!");
    } else if (80 <= mark && mark < 100) {
      System.out.println("Grade Level: 1");
      System.out.println("Comment: Magnificent!!");
    } else {
      System.out.println("Grade Level: X");
      System.out.println("Invalid Marks!!, Marks too high. Or Invalid Marks!!, Negative marks not allowed.");
    }
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS