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



Home Answers Viewqa IDE-Questions flowchart and algorithm

Have Programming Question? Ask it here!
 
 
 


ninenan
flowchart and algorithm
1 Answer(s)      2 years and 6 months ago
Posted in : IDE Questions


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

}


Advertisement
View Answers

October 27, 2011 at 4:36 PM


Explanation:

In the code, the user is allowed to enter the number of students appearing for the exams and enter their marks one by one. These marks is then checked for the grade. There is an scale to get the grade according to that scale. The grades is to be stored for the particular marks with setGrade() method. The four counters is initialized in order to count the number of students getting A, A+, D and E grade. To count the number of students getting A and A+, the counter values of A and A+ is added. Similarly, the counter values of D and E is added in order to find out the number of students getting A and E marks.



Related Tutorials/Questions & Answers:
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
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
Advertisements
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
flowchart - Java Beginners
flowchart  plss make me a flowchart of this program: import java.io.*; import javax.swing.JOptionPane; public class fibb { public static void main(String[] args)throws IOException { int[] fib=new int[100]; fib[0
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
Draw a Flowchart
Draw a Flowchart       This section illustrates you how to draw a Flowchart to compute the sum of first 50 natural numbers. To draw a flowchart, we have used
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
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
if-else Flowchart equivalent
Java Notesif-else Flowchart equivalent Example of using if-else flowchart. In if-else you can use elseif multiple times. Learn how to use if-else flowchart. There are several graphical ways to show the flow of programs
JRequisite - Requirement Management Tool
JRequisite - Requirement Management Tool       JRequisite 0.0.1 is released! The first version includes a flowchart diagram editor. See more about this agile requirement
just askin - Java Beginners
just askin  were can i find a website,, who have a java bean program which include its code, algorithm and flowchart? plsss
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
C array sort example
the implementation of quicksort algorithm to sort the elements of an array. Syntax
Selection Sort in Java
. In selection sorting algorithm, the minimum value in an array is swapped... sort is probably the most spontaneous sorting algorithm. Selection sort... in Java. In selection sort algorithm, first assign minimum index in key as index
Google Penguin Update vs. Black Hat SEO
, but it is more important as this new algorithm of Google is to make web user experience... by this new algorithm and this time the target is mainly the spammers and bad links... through its webmaster guidelines and algorithm updates to put it into actual
Insertion Sort Java
Insertion Sort in Java is an algorithm that is used to sort integer values. It can be implemented very easily and is efficient for small data sets. However.... In insertion sorting, algorithm divides the elements in two parts, one which
Google Penguin 2.0: Real SEO Strategy to avoid Penalty
the potential threat of penalty by Penguin 2.0 algorithm update, SEO's... the situation. Following the strictness of Google in the recent Penguin algorithm update... to overcome the threat of Penguin algorithm update penalty and hence followed
JDBC Nested Resultset
JDBC Nested Resultset       The JDBC Nested Result Set  is the simplest join algorithm. In this case for each tuple in the outer join relation, the entire inner
C# Programming Books
C# Programming Books         Data Structure and Algorithm All rights reserved. No part of this publication may be reproduced
Quick Sort in Java
Quick sort in Java is used to sort integer values of an array. It is a comparison sort. Quick sort is one of the fastest and simplest sorting algorithm...) and in the worst case is Θ(n2). In quick sort algorithm, an element
How to Save Your Site from Google Penguin Update
Every Google algorithm has created some uproar among the websites... deep treading algorithm to strike more websites with detrimental practices... already following previous Google algorithm updates, but churned or slightly
Google Penguin Update at a Glance
algorithms latest Google Penguin update is just the algorithm geared towards putting... algorithm update followed by cloaking, duplicate content, bad link scheme
Google Penguin Update 2013
Google Penguin is an algorithm that Google uses to restrict spam websites or blogs. Till today, Google has rolled out three updates to original Google Penguin. With Google Penguin latest update, it is trying to improve the quality
10 Ways Google Penguin Update will affect SEO
Google Penguin update, the SEO algorithm from Google that already... becoming targets of Google webmaster guidelines and algorithm updates. One... if it had been a decade before, but with new Google algorithm you cannot get away
How to Recover from Google Penguin Effects
in regard to the new Google algorithm to come into terms with the reality... question marks on you. As per the new Google algorithm heaping up huge amount... after new Google algorithm update. Reduce inappropriate keyword density
Top 20 SEO Techniques for Google Search Ranks
While Google penguin update as the latest algorithm to slash on websites with poor and questionable SEO is already creating enough panic among the webmasters, some of the good old SEO techniques have never been so important. Once again
The Difference between Google Penguin and Google Panda
mastermind behind the new algorithm specified that new Google Penguin update... is an algorithm that is mainly rolled in order to down raking those sites and web pages
Bubble Sort in Java
Bubble Sort aka exchange sort in Java is used to sort integer values. This algorithm compares and swaps each pair of adjacent elements till the list is sorted. Swapping is followed carried out repeatedly till the list is sorted. Bubble
Binary Search in Java
value with the middle element of the array. If they match the algorithm stops
Most Important Areas of SEO Strategy
algorithm, Google penguin update
need help with a program - Java Beginners
Java algorithm - need help with a program  Java algorithm - need help with a program
flowcharts using javascript/HTML - Development process
flowcharts using javascript/HTML  Hi I want to create flowchart diagram using html/javascript.. is that possible.. please guide me Thanks!  Check this linkhttp://www.roseindia.net/jdbc/jdbc-driver-and-its-types.shtml
database
database  i need optimised searching algorithm to retrieve the data from the database and optimised ranking algorithm to display the reults into the user
need help with a program - Java Beginners
need help with a program   Part I An algorithm describes how... by the user. The output of the program should be the length and width (entered.... First you would need to make up the "test data". For this algorithm, the test data
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
image Processing
image Processing   BCIF Image Compresssion Algorithm s alossless image Compression algorithm ,Pleas Help Me weather it can support only 24 bit bmp images
what technique - Java Beginners
what technique  what technique or algorithm i need to use to develop a system a scheduling time table in java
video compression - Java Beginners
video compression  Hello i need source code of any video compression algorithm in java thanks a lot
 

 

 

DMCA.com