Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners the grade of students
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ninenan
the grade of students
1 Answer(s)      2 years and 11 months ago
Posted in : Java Beginners


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


Advertisement
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
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
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
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
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
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 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
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
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... is useful for development of enterprise grade applications. Java language comes
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
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
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... may also apply for the course Computer Science students may also apply
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 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
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
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
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
Advertisements
 

 

 

DMCA.com