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 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));
    }
}









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
final grade
a student?s final grade from 50-100. Evaluate the Final grade and display the Point...?s final grade from 50-100. Evaluate the Final grade and display the Point... final grade from 50-100. Evaluate the Final grade and display the Point
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
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
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
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 '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 '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
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
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
1St Grade Reading Games
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
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
Arithmetic Testing for School Students
Arithmetic Testing for School Students In this section, we have created an application that helps an elementary school student to learn arithmetic operations. This application allows the student to select the arithmetic operation
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
Record management application for a school
Record management application for a school In this section, we are going to create an application to record the information of all the students. All the data... of new students, edit the record of students and can delete the record
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
MCA Project Training
; The training is designed for the MCA students who want to speed up... students. The students who have appeared for the fourth semester exam may also apply... Science students may also apply for the course Core Java knowledge is required
Java Training Online Class
. The competition in the field is fierce and students and professionals often look... of the students RoseIndia, offers online Java training classes to them. These online Java training classes are much in demand among students and professionals
Java Example Codes and Tutorials
Java Tutorials - Java Example Codes and Tutorials Java is great programming language for the development of enterprise grade applications. This programming... programming language is useful for development of enterprise grade applications
Java Web Services Online Training
students and learners to make interactive web based services using Java and its..., Rose India offers customized training to the students so that they can master... services online training to the students so that they can master the various parts
MySQL Network
-grade software, support and services directly from the developers of MySQL... problems before they occur  *Includes enterprise-grade software, support...; MySQL Network- Enterprise grade Database Achieving the highest levels
Java Online Training from Hyderabad
among students as it offers quality training to the students thanks to its... of students and professionals seek Java online training from Hyderabad as it offers
Student Result Application
a table for annual examination results for 10 students. For this, we have allowed...: a) Total marks obtained by each students b) The highest marks in each subject and roll no of the students who have secured it. c) The student who obtained
Please help with this code
= input.next(); System.out.println("What is the students grade...(); student.setName(name); student.setGrade(grade); students... for: "); int grade = input.nextInt(); if (result(grade, students
Be a Sun Certified Java Programmer
students can qualify one of the toughest exams of IT industry. There are millions of students attempt every year to crack SCJP certification exams, but only few hundred outstanding students can be able to grab certificate, while a large number
Java Online Class
Java Online Class The advent of e-learning has made learning fun, as students.... Students with interest in technology often wish to attain mastery over Java... of various institutions offering classroom courses. For those students
Ask Questions
Ask Questions       In the move of resolving the queries of software developers, professions, students and learners, we have initiated a new service ‘Ask
Best Java Online Training Class
after among students and professional as Java programming is ruling the roost... and a good grounding in the subject could be of great advantage. To make students... to a wide spectrum of learners including students and working professionals
Elasticsearch Tutorial
performance enterprise grade full text indexing and search functionality. What
Elasticsearch Tutorial
performance enterprise grade full text indexing and search functionality. What
Elasticsearch Tutorial
performance enterprise grade full text indexing and search functionality. What
Elasticsearch Tutorial
performance enterprise grade full text indexing and search functionality. What

Ads