-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentGradeLoopOrganized.java
More file actions
39 lines (32 loc) · 966 Bytes
/
StudentGradeLoopOrganized.java
File metadata and controls
39 lines (32 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Computer Programming 1
Student grade with loop
*/
import java.io.*;
import java.util.*;
public class StudentGradeLoopOrganized //Array example
{
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
int grade;
String [] students = {"Ali","Ahmed","Saleh","Salim","Ibrahim"};
//multiple conditions with for loop
for(int i=0;i< 5;i++){
System.out.print("Enter "+students[i]+"\'s grade ==>\t");
grade = read.nextInt(); //we get the grade from the console
if(grade >= 90){
System.out.print(" \t== > A \n");
}else if(grade >=80){
System.out.print(" \t== > B \n");
}
else if(grade >= 70){
System.out.print(" \t== > C \n");
}
else if(grade >= 60){
System.out.print(" \t== > D \n");
}
else{
System.out.print(" \t== > F \n");
}
}
}
}