Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added by Hammad #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Project(Week 1)/Grading of Students/Grades.class
Binary file not shown.
49 changes: 49 additions & 0 deletions Project(Week 1)/Grading of Students/Grades.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import java.util.Scanner;
import java.util.Arrays;
public class Grades {
float marks[];
String grade[];
String stu[];
Scanner sc;

public void get_data() {
for(int i=0;i<10;i++) {
System.out.println("Enter name");
stu[i]=sc.next();
System.out.println("Enter marks");
marks[i]=Float.parseFloat(sc.next());
}
set_grades();

}

private void set_grades() {
Arrays.sort(marks);
for(int i=0;i<10;i++) {
if(marks[i]>=40 && marks[i]<=50)
grade[i]="PASS";
else if(marks[i]>=51 && marks[i]<=75)
grade[i]="MERIT";

else if(marks[i]>=76)
grade[i]="DISTINCTION";
else
grade[i]="FAIL";
}
}

public void display() {
System.out.println("Name\t\t\tMarks\t\t\tGrades");

for(int i=0;i<10;i++) {
System.out.println(stu[i]+"\t\t\t"+marks[i]+"\t\t\t"+grade[i]);
}
}
public Grades(){
marks=new float[10];
grade=new String[10];
stu=new String[10];
sc = new Scanner(System.in);
}

}
49 changes: 49 additions & 0 deletions Project(Week 1)/Grading of Students/Grades.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import java.util.Scanner;
import java.util.Arrays;
public class Grades {
float marks[];
String grade[];
String stu[];
Scanner sc;

public void get_data() {
for(int i=0;i<10;i++) {
System.out.println("Enter name");
stu[i]=sc.next();
System.out.println("Enter marks");
marks[i]=Float.parseFloat(sc.next());
}
set_grades();

}

private void set_grades() {
Arrays.sort(marks);
for(int i=0;i<10;i++) {
if(marks[i]>=40 && marks[i]<=50)
grade[i]="PASS";
else if(marks[i]>=51 && marks[i]<=75)
grade[i]="MERIT";

else if(marks[i]>=76)
grade[i]="DISTINCTION";
else
grade[i]="FAIL";
}
}

public void display() {
System.out.println("Name\t\t\tMarks\t\t\tGrades");

for(int i=0;i<10;i++) {
System.out.println(stu[i]+"\t\t\t"+marks[i]+"\t\t\t"+grade[i]);
}
}
public Grades(){
marks=new float[10];
grade=new String[10];
stu=new String[10];
sc = new Scanner(System.in);
}

}
Binary file not shown.
25 changes: 25 additions & 0 deletions Project(Week 1)/Grading of Students/StudentGrades.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public class StudentGrades {

public static void main(String args[]) {


Grades g1=new Grades();
g1.get_data();
g1.display();

}

}













25 changes: 25 additions & 0 deletions Project(Week 1)/Grading of Students/StudentGrades.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public class StudentGrades {

public static void main(String args[]) {


Grades g1=new Grades();
g1.get_data();
g1.display();

}

}













74 changes: 74 additions & 0 deletions Project(Week 1)/Grading of Students/complete code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import java.util.Scanner;
import java.util.Arrays;
public class Grades {
float marks[];
String grade[];
String stu[];
Scanner sc;

public void get_data() {
for(int i=0;i<10;i++) {
System.out.println("Enter name");
stu[i]=sc.next();
System.out.println("Enter marks");
marks[i]=Float.parseFloat(sc.next());
}
set_grades();

}

private void set_grades() {
Arrays.sort(marks);
for(int i=0;i<10;i++) {
if(marks[i]>=40 && marks[i]<=50)
grade[i]="PASS";
else if(marks[i]>=51 && marks[i]<=75)
grade[i]="MERIT";

else if(marks[i]>=76)
grade[i]="DISTINCTION";
else
grade[i]="FAIL";
}
}

public void display() {
System.out.println("Name\t\t\tMarks\t\t\tGrades");

for(int i=0;i<10;i++) {
System.out.println(stu[i]+"\t\t\t"+marks[i]+"\t\t\t"+grade[i]);
}
}
public Grades(){
marks=new float[10];
grade=new String[10];
stu=new String[10];
sc = new Scanner(System.in);
}

}
public class StudentGrades {

public static void main(String args[]) {


Grades g1=new Grades();
g1.get_data();
g1.display();

}

}