Home Answers Viewqa IDE-Questions Problem analysis and algorithm design (i.e.: flowchart, algorithm)

 
 


ninenan
Problem analysis and algorithm design (i.e.: flowchart, algorithm)
1 Answer(s)      a year and 8 months ago
Posted in : IDE Questions

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 Pages:
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
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
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
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
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...("Time required for sequential rsa algorithm:"+(endtime-starttime)+"millisecond
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
Software Design
Software Design     ... solution is known as software design. In this process, first the purpose... as well as the issue of algorithm implementation and low level component
computer graphics - Design concepts & design patterns
computer graphics  Digitise a line with endpoints (0, 1) and (11, 16) using (i) DDA algorithm and (ii) Bresenham Algorithm. Which of two lines is of better quality? Explain your answer
pattern matching --four way technique........brute force algorithm
pattern matching - four way technique  Hi, here's my question.. I am trying to implement pattern matching using brute force algorithm where I am trying to apply four way technique to search a given pattern in a text.in
Google Penguin Algorithm update issues and How to Recover
of the year 2013 and will "go deeper". Like all other Google algorithm updates
Assignment problem
Assignment problem  hello, I am designing a program partaining job assingment using hungarian algorithm,but i am totally confused, please help me out
Design Pattern
Design Pattern         Template Design Pattern These types of design patterns are used as templates. These design patterns
java compilation - Design concepts & design patterns
java compilation  write an algorithm which uses a stack to print a given string in reverse order. For example, if the string is `Fat cat`, the output should be `tac taf`. Use the usual stack methods and a method nextChar(S
Open Source Images
Open Source Images Open Source Image analysis Environment TINA... the process of image analysis research. TINA provides functionality to assist in all areas of image analysis including handling of image, image feature and geometrical
java
java  Problem analysis and algorithm design (i.e.: flowchart, algorithm)and explanation for a Java program that prompt user to input a number of students in a class. Then, prompt user to input the studentââ?¬â?¢s programming
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
Analysis tool - SourceGlider for Eclipse
Analysis tool - SourceGlider for Eclipse  ... programs make heavy use of methods overloading, polymorphism and subtle design... and tracing the program. Static code analysis allows to get this information
PESTLE analysis
PESTLE analysis   What is PESTLE analysis used in Business Analysis Techniques
Business Analysis
Business Analysis  What is Business Analysis
SWOT Analysis
SWOT Analysis  What is SWOT Analysis and how it is used for effective business analysis?   SWOT analysis is performed to find the existing...) Opportunities (O) Threats (T) To get more information about SWOT analysis
java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution ( analysis & design & unit test plan & code & test criteria ) to the following problem to the following mail id : Problem : upload excel file data into oracle
java implementation problem
java implementation problem   I want to implement following in java code : Main thread Create three threads wait for completion of stage 2 of all... the algorithm if required. Please help me
Design patterns - Design concepts & design patterns
Design patterns  I am new to design patterns and desigining . Please refer me some tutorial or pdfs of design patterns and desigining in easy... (and recurring) solution to a problem in a context. Each pattern describes a problem which
I have a small problem in my datagridview - Design concepts & design patterns
I have a small problem in my datagridview  i have datagridviewer in c#(platform) and i try that change cell beckground, this cell Should be for example 5(integer!) if in my datagridwiewer Will be 5(whatwhich should be take in my
Java implementation problem
will expain the algorithm if required. Please help me.   there is some problem in your post previews. please consider 1. 2. points just after main.../answers/viewqa/Java-Beginners/28578-java-implementation-problem-.html
bliffoscope data analsys problem
bliffoscope data analsys problem  Bliffoscope Data Analysis Problem... problem you have is detecting the Rejectos spaceships and slime torpedos, because... image of a Rejectos starship. Your task is to do the following: 1. Design
For reqirment - Design concepts & design patterns
For reqirment  I have to design loyalty card system which is related with Point of sale. Please send some document related to loyalty card. I have no idea related to this so please help me to resolve this problem as soon
Business Analysis Certifications
Business Analysis Certifications  What are the certifications available for business analyst in India
HEPTALYSIS technique in Business Analysis
technique in Business Analysis?   HEPTALYSIS is a Business analysis technique... To get more information about HEPTALYSIS analysis and business analysis techniques, you can go to the link below: Business Analysis Techniques What
mvc - Design concepts & design patterns
the problem. For more information on MVC visit to : http
PHP - Design concepts & design patterns
PHP  How can run a php program.   Hi friend, Some Points to be remember to solving the problem : Download this software called, WAMP Server install it Copy & paste the PHP file in the WWW Directory. U can
general - Design concepts & design patterns
.. Your problem is a big issue to solve becoz u want to work in a project then we
MOST technique in Business analysis
in Business analysis?   This MOST analysis technique is performed to analyse... maximum results. To get more information about MOST analysis and business analysis techniques, you can go to the link below: Business Analysis Techniques
JSF security design problem - Java Server Faces Questions
JSF security design problem  Hi! I have to manage security (the quantity of roles and groups is rather huge) in java ee 5 + jsf (1.x) project... jsf at all? Please, provide your ideas of solving this problem. Thanks
Object oriented design - Java. - Design concepts & design patterns
Object oriented design - Java.  Hi, Everyone.Pls help me to develope my project of Object oriented design, as I have to submit it on thursday,3rd... on this project. Pls help me to do so. Money will not be the problem, I'll pay You
Design Pattern
issues (problems). When you design a problem, you should know some common...Design Pattern          What is a design pattern? The design patterns
Content Analysis
Content Analysis Content analysis is systematic replicable... of the content by checking it's authorship using content analysis technique. Criteria: The Criteria of Content analysis is not so easy to do. A set
result analysis issue
result analysis issue  i have given 100 users in my thread group for http sampler.some threads r getting response and some threads r getting error response.the error response shown in view results tree listener is as shown below
Design Patterns
Design Patterns       Design Patterns: Patterns are solutions for the specific problem in a specific context.  (OR) Patterns are solutions to recurring problem
design papttern - Development process
design papttern   Hi i have problem in observer design pattern.my problem is once implement the observer pattern ,after that i can use Subject class.but ,it is not existing.tell me whY? code is like this Rover rover1=new