the grade of students

Ads
 

the grade of students

Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the student√Ę‚?¨‚?Ęs programming mark. Determine how many student get A+ and A for their grade and how many students get D and E based on the following table:

Marks Grades 85-100 A+ 80-84 A 75-79 B+ 70-74 B 65-69 B- 60-64 C+ 55-59 C 50-54 C- 45-49 D+ 40-44 D 0 E

View Answers

October 24, 2011 at 11:37 AM

import java.util.Scanner;

public class StudentMarks {

    double totalMarks;
    String grade;

    public void setTotalMarks(double totalMarks) {
        this.totalMarks = totalMarks;
    }

    public double getTotalMarks() {
        return totalMarks;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getGrade() {
        return grade;
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter number of students: ");
        int num = input.nextInt();
        StudentMarks data[] = new StudentMarks[num];
        for (int i = 0; i < data.length; i++) {
            System.out.println("Enter marks");
            double marks = input.nextDouble();
            data[i] = new StudentMarks();
            data[i].setTotalMarks(marks);
            if (marks < 40) {
                data[i].setGrade("E");
            }
            if (marks >= 40 && marks <= 44) {
                data[i].setGrade("D");
            }
            if (marks >= 45 && marks <= 49) {
                data[i].setGrade("D+");
            }
            if (marks >= 50 && marks <= 54) {
                data[i].setGrade("C-");
            }
            if (marks >= 55 && marks <= 59) {
                data[i].setGrade("C");
            }
            if (marks >= 60 && marks <= 64) {
                data[i].setGrade("C+");
            }
            if (marks >= 65 && marks <= 69) {
                data[i].setGrade("B-");
            }
            if (marks >= 70 && marks <= 74) {
                data[i].setGrade("B");
            }
            if (marks >= 75 && marks <= 79) {
                data[i].setGrade("B+");
            }
            if (marks >= 80 && marks <= 84) {
                data[i].setGrade("A");
            }
            if (marks >= 85 && marks <= 100)
                data[i].setGrade("A+");
        }

        int count1 = 0;
        int count2 = 0;
        int count3 = 0;
        int count4 = 0;
        for (int i = 0; i < num; i++) {
            StudentMarks show = data[i];
            String g = show.getGrade();
            if (g.equals("A+")) {
                count1++;
            }
            if (g.equals("A")) {
                count2++;
            }
            if (g.equals("D")) {
                count3++;
            }
            if (g.equals("E")) {
                count4++;
            }
        }
        System.out.println("Number of student getting A and A+ grade: "
                + (count1 + count2));
        System.out.println("Number of student getting D and E grade: "
                + (count3 + count4));
    }
}

Ads









Related Tutorials/Questions & Answers:
the grade of students
the grade of students  Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the student√Ę‚?¨‚?Ęs programming mark. Determine how many student get A+ and A for their grade
adding a method to calculate a students grade
adding a method to calculate a students grade  The Following program which displays a students name, id and mark works fine. But when i tried to add a method to display the grade based on the mark of the student i cant seem
Advertisements
ModuleNotFoundError: No module named 'grade'
ModuleNotFoundError: No module named 'grade'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'grade' How to remove the ModuleNotFoundError: No module named 'grade'
ModuleNotFoundError: No module named 'grade'
ModuleNotFoundError: No module named 'grade'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'grade' How to remove the ModuleNotFoundError: No module named 'grade'
Java programs on students assesment
Java programs on students assesment  1) Write a Java program... subject marks. (v) Follow the table for grading: Average of Marks Grade < 40...) Output the Student name, Student id, subject marks, average mark and the grade
Highest average score among 25 students
the user to enter grades of 25 students in a class and grade them into 4 lessons... again the grade) calculate average per student and will calculate the highest average among students who should be printed. how can i solve this problem
create examination slip for students
create examination slip for students  hello,can anyone help me how to create examination slip that include subject code,courses,credit hours,grade ,and status
array of students with marks list
array of students with marks list  There are 4 array of numbers... students have got against each examination. The order of students remain same across all lists and also the number of students (4 in this case). Marks List 1
Write a program to display grade message according to the marks
of students and their marks and display the grade according to student's marks... is a code that accepts the number of students and their marks and display the grade...Write a program to display grade message according to the marks  pls
internships for data science students
internships for data science students  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: internships for data science students Try to provide me good examples
ModuleNotFoundError: No module named 'ml_easy_peer_grade'
ModuleNotFoundError: No module named 'ml_easy_peer_grade'  Hi, My... named 'ml_easy_peer_grade' How to remove the ModuleNotFoundError: No module named 'ml_easy_peer_grade' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'grade-change-emailer'
ModuleNotFoundError: No module named 'grade-change-emailer'  Hi...: No module named 'grade-change-emailer' How to remove the ModuleNotFoundError: No module named 'grade-change-emailer' error? Thanks   Hi
ModuleNotFoundError: No module named 'grade-change-emailer'
ModuleNotFoundError: No module named 'grade-change-emailer'  Hi...: No module named 'grade-change-emailer' How to remove the ModuleNotFoundError: No module named 'grade-change-emailer' error? Thanks   Hi
ModuleNotFoundError: No module named 'ml_easy_peer_grade'
ModuleNotFoundError: No module named 'ml_easy_peer_grade'  Hi, My... named 'ml_easy_peer_grade' How to remove the ModuleNotFoundError: No module named 'ml_easy_peer_grade' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'UW-Grade-Conversion-Calculator'
ModuleNotFoundError: No module named 'UW-Grade-Conversion-Calculator' ...: No module named 'UW-Grade-Conversion-Calculator' How to remove the ModuleNotFoundError: No module named 'UW-Grade-Conversion-Calculator' error
data science internships for international students
data science internships for international students  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science internships for international students Try to provide
ai courses for high school students
ai courses for high school students  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ai courses for high school students Try to provide me good examples or tutorials
Write a JSP program to display the grade of a student by accepting the marks of five subjects.
Write a JSP program to display the grade of a student by accepting the marks of five subjects.  Write a JSP program to display the grade of a student by accepting the marks of five subjects
Internship in Delhi for Engineering Students
Internship in Delhi for Engineering Students Internship program in various software technologies for Engineering in Delhi & NCR. We are arranging the internship program in different software development technologies. All
Retrieve all the students in the same year(Java ArrayList)?
Retrieve all the students in the same year(Java ArrayList)?  ...); if(search != null){//if found 1 student by year do{//Search all students...;& !found_list.isEmpty()){ %> <html> "Displaying all the students
artificial intelligence course for high school students
artificial intelligence course for high school students  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: artificial intelligence course for high school students Try
Top 10 Cloud Applications for Students
Top 10 Cloud Applications for Students Students are the best receptors of any... we focus on the cloud applications for students. If we are to name two aspects... savvy students of our age. Here are our picks on top 10 cloud applications
1St Grade Reading Games
developing students dabase application implemented on oracle with support for object feature
developing students dabase application implemented on oracle with support for object feature   Design and develop a suitable Student Database application. One of the attributes to me maintained is the attendance of a student
write a java program to print marklist of n students. input Register number, name and marks of three subjects.
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.  write a java program to print marklist of "n " students. input Register number, name and marks of three subjects
Code to STOP Students from navigating anywhere else till the Online exam is over
Code to STOP Students from navigating anywhere else till the Online exam is over  hi guys i am a final year student of engineering and i am working on an ONLINE EXAMINATION SYSTEM just like GATE, GRE usually used by prometrics
c++ array find the average mark, highest mark, lowest mark, number of students passing,
c++ array find the average mark, highest mark, lowest mark, number of students passing,    i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array. 01
c++ array find the average mark, highest mark, lowest mark, number of students passing,
c++ array find the average mark, highest mark, lowest mark, number of students passing,    i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array. 01
What is Spring?
What is Spring?       Spring is great framework for development of Enterprise grade applications. Spring is a light-weight framework for the development
Java programming
Java programming       Java programming language is useful for development of enterprise grade applications. Java language comes in light from a language named Oak. Language Oak
Online business management courses in India
opportunity to the students for a brighter career in the field. Many top... are the reason that a large number of students are unable to enroll with the institutions and that is why today students are opting online courses for business

Ads