Problem analysis and algorithm design (i.e.: flowchart, algorithm)

Problem analysis and algorithm design (i.e.: flowchart, algorithm)

Problem analysis and algorithm design (i.e.: flowchart, algorithm)for this question.Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the students 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:
Problem analysis and algorithm design (i.e.: flowchart, algorithm)
Problem analysis and algorithm design (i.e.: flowchart, algorithm)  Problem analysis and algorithm design (i.e.: flowchart, algorithm)for this question.Write a Java program that prompt user to input a number of students
algorithm
algorithm  convert this algorithm to java code IsSample_PAS: 1.for every attribute value aj belongs to ti do begin (here aj=1,2...,ti=1,2..) 2.if(CF... false; (this is algorithm from ieee paper QUALITY AWARE SAMPLING AND ITS
Advertisements
algorithm
algorithm  Hi all, i have a task which is create an algorithm from a java code.and i need help from u guys to check on my algo put a comment... on this matter... thanks a lot. here is my algorithm: > Input
Algorithm - Java3D
Algorithm  what is NaiveSimilarity algorithm? How we use this algorithm to recognize a face in face recognition (using Java)? which is the steps involved in this? Which is the database used to store an image
efficiency of an algorithm
efficiency of an algorithm  how can we calculate the best or worst case efficiency of an algorithm
efficiency of an algorithm
efficiency of an algorithm  how can we calculate the best or worst case efficiency of an algorithm
C4.5 ALGORITHM
C4.5 ALGORITHM  I am doing my project in data mining.Any body having code for C4.5 decision tree algorithm in java with output.Help me Friends
Conflation Algorithm
Conflation Algorithm  implementation of conflation algorithm is possible using java?? conflation requires file handling a text contains stop words(is,or,and,.,)remove this words remove suffix(ing,ed..) remove equal words count
Algorithm
ModuleNotFoundError: No module named 'algorithm'
ModuleNotFoundError: No module named 'algorithm'  Hi, My Python... 'algorithm' How to remove the ModuleNotFoundError: No module named 'algorithm' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'algorithm'
ModuleNotFoundError: No module named 'algorithm'  Hi, My Python... 'algorithm' How to remove the ModuleNotFoundError: No module named 'algorithm' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'algorithm'
ModuleNotFoundError: No module named 'algorithm'  Hi, My Python... 'algorithm' How to remove the ModuleNotFoundError: No module named 'algorithm' error? Thanks   Hi, In your python environment you
Algorithm - Java Beginners
Algorithm  (a) Describe the manual procedure, if one has to use the above algorithm and the first element as the pivot to sort the sequence... the algorithm you want to use to sort the sequence. Thanks
Asymmetric algorithm - Java Beginners
Asymmetric algorithm  hybrid Digital image embedding using invisible watermarking with rsa and dct algorithm? please send me this project with source code........ regards subramanian
ModuleNotFoundError: No module named 'algorithm-toolkit'
ModuleNotFoundError: No module named 'algorithm-toolkit'  Hi, My... named 'algorithm-toolkit' How to remove the ModuleNotFoundError: No module named 'algorithm-toolkit' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'melange-algorithm'
ModuleNotFoundError: No module named 'melange-algorithm'  Hi, My... named 'melange-algorithm' How to remove the ModuleNotFoundError: No module named 'melange-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'ML-algorithm'
ModuleNotFoundError: No module named 'ML-algorithm'  Hi, My Python... 'ML-algorithm' How to remove the ModuleNotFoundError: No module named 'ML-algorithm' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'snowland-algorithm'
ModuleNotFoundError: No module named 'snowland-algorithm'  Hi, My... named 'snowland-algorithm' How to remove the ModuleNotFoundError: No module named 'snowland-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'algorithm-x'
ModuleNotFoundError: No module named 'algorithm-x'  Hi, My Python... 'algorithm-x' How to remove the ModuleNotFoundError: No module named 'algorithm-x' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dempster-algorithm'
ModuleNotFoundError: No module named 'dempster-algorithm'  Hi, My... named 'dempster-algorithm' How to remove the ModuleNotFoundError: No module named 'dempster-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'genetic-algorithm'
ModuleNotFoundError: No module named 'genetic-algorithm'  Hi, My... named 'genetic-algorithm' How to remove the ModuleNotFoundError: No module named 'genetic-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'algorithm-x'
ModuleNotFoundError: No module named 'algorithm-x'  Hi, My Python... 'algorithm-x' How to remove the ModuleNotFoundError: No module named 'algorithm-x' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lmso-algorithm'
ModuleNotFoundError: No module named 'lmso-algorithm'  Hi, My... named 'lmso-algorithm' How to remove the ModuleNotFoundError: No module named 'lmso-algorithm' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sam-algorithm'
ModuleNotFoundError: No module named 'sam-algorithm'  Hi, My... 'sam-algorithm' How to remove the ModuleNotFoundError: No module named 'sam-algorithm' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'yass-algorithm'
ModuleNotFoundError: No module named 'yass-algorithm'  Hi, My... named 'yass-algorithm' How to remove the ModuleNotFoundError: No module named 'yass-algorithm' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'abc_algorithm'
ModuleNotFoundError: No module named 'abc_algorithm'  Hi, My... 'abc_algorithm' How to remove the ModuleNotFoundError: No module named 'abc_algorithm' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'algorithm-toolkit'
ModuleNotFoundError: No module named 'algorithm-toolkit'  Hi, My... named 'algorithm-toolkit' How to remove the ModuleNotFoundError: No module named 'algorithm-toolkit' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'algorithm-logger'
ModuleNotFoundError: No module named 'algorithm-logger'  Hi, My... named 'algorithm-logger' How to remove the ModuleNotFoundError: No module named 'algorithm-logger' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'melange-algorithm'
ModuleNotFoundError: No module named 'melange-algorithm'  Hi, My... named 'melange-algorithm' How to remove the ModuleNotFoundError: No module named 'melange-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'topsis-Algorithm'
ModuleNotFoundError: No module named 'topsis-Algorithm'  Hi, My... named 'topsis-Algorithm' How to remove the ModuleNotFoundError: No module named 'topsis-Algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'algorithm-logger'
ModuleNotFoundError: No module named 'algorithm-logger'  Hi, My... named 'algorithm-logger' How to remove the ModuleNotFoundError: No module named 'algorithm-logger' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'dempsters-algorithm'
ModuleNotFoundError: No module named 'dempsters-algorithm'  Hi, My... named 'dempsters-algorithm' How to remove the ModuleNotFoundError: No module named 'dempsters-algorithm' error? Thanks   Hi
Version of cn.featherfly>featherfly-algorithm dependency
List of Version of cn.featherfly>featherfly-algorithm dependency
ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator'
ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator'  Hi...: No module named 'Luhn_Algorithm_Validator' How to remove the ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator' error? Thanks  
ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator'
ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator'  Hi...: No module named 'Luhn_Algorithm_Validator' How to remove the ModuleNotFoundError: No module named 'Luhn_Algorithm_Validator' error? Thanks  
ModuleNotFoundError: No module named 'pro-net-algorithm'
ModuleNotFoundError: No module named 'pro-net-algorithm'  Hi, My... named 'pro-net-algorithm' How to remove the ModuleNotFoundError: No module named 'pro-net-algorithm' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'simple_paths_algorithm'
ModuleNotFoundError: No module named 'simple_paths_algorithm'  Hi...: No module named 'simple_paths_algorithm' How to remove the ModuleNotFoundError: No module named 'simple_paths_algorithm' error? Thanks   Hi
ModuleNotFoundError: No module named 'snowland-algorithm-python'
ModuleNotFoundError: No module named 'snowland-algorithm-python'  Hi...: No module named 'snowland-algorithm-python' How to remove the ModuleNotFoundError: No module named 'snowland-algorithm-python' error? Thanks  
ModuleNotFoundError: No module named 'sorting-algorithm-visual'
ModuleNotFoundError: No module named 'sorting-algorithm-visual'  Hi...: No module named 'sorting-algorithm-visual' How to remove the ModuleNotFoundError: No module named 'sorting-algorithm-visual' error? Thanks  
Maven Dependency featherfly-algorithm >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of cn.featherfly >> featherfly-algorithm version1.0.1 in your project
Maven Dependency featherfly-algorithm >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of cn.featherfly >> featherfly-algorithm version1.0.2 in your project
Maven Repository/Dependency: cn.featherfly | featherfly-algorithm
Maven Repository/Dependency of Group ID cn.featherfly and Artifact ID featherfly-algorithm. Latest version of cn.featherfly:featherfly-algorithm dependencies. # Version Release Date
Maven Repository/Dependency: com.github.brunotl | boost_algorithm
Maven Repository/Dependency of Group ID com.github.brunotl and Artifact ID boost_algorithm. Latest version of com.github.brunotl:boost_algorithm dependencies. # Version Release Date You
Maven Repository/Dependency: cn.featherfly | featherfly-algorithm
Maven Repository/Dependency of Group ID cn.featherfly and Artifact ID featherfly-algorithm. Latest version of cn.featherfly:featherfly-algorithm dependencies. # Version Release Date
Maven Repository/Dependency: cn.featherfly | featherfly-algorithm
Maven Repository/Dependency of Group ID cn.featherfly and Artifact ID featherfly-algorithm. Latest version of cn.featherfly:featherfly-algorithm dependencies. # Version Release Date
flowchart and algorithm
flowchart and algorithm  import java.util.Scanner; public class StudentMarks { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; } public double getTotalMarks
How to write a rsa algorithm using thread
How to write a rsa algorithm using thread   Hi... This my **rsa algorithm sequential code..can u anyone plz change/convert to concurrent...(); System.out.println("Time required for sequential rsa algorithm:"+(endtime-starttime
implementing an algorithm using multi threads - Java Beginners
implementing an algorithm using multi threads  Hi i need to implement an algorith in multi threads.Algorithm has data dependency so i need to pass data from one thread to another thread. I am posting my algorithm which needs
problem java - Design concepts & design patterns
problem java  Please help me again, i will try to create to txt with script you give to me but many error please help me to combine your script... the problem : import javax.swing.JOptionPane; public class FileWrite{ public static
JSP & CSS problem - Design concepts & design patterns
. There is a problem in css file. Try the following code. step1- JSP code

Ads