Need help in java programming

Need help in java programming

Hello. Can someone please help me with writig the following programm. Assignment 20% Presentation 10% Mini Test 10% Exam 60%

Java program that accepts the following details: student ID number, full name and marks for the 4 assessments above as input. It should then determine and output the final mark and grade for each student. The grade awarded is based on the following scheme:

Final mark Grade Less than 40 Fail Less than 60 Pass Less than 70 Credit More than or equal to 70 Distinction The students ID number should contain 2 numbers and 2 letters. E.g. 33GG

The application should display the details of the student and final mark and grade. to provide a menu of options to the user including adding a student and terminating the application.

Regards!

View Answers

October 22, 2010 at 12:01 PM

Hi Friend,

Try the following code:

import java.util.*;

public class StudentResult{
    String studentID;
    String name;
    double assignment;
    double presentation;
    double test;
    double exam;
    double total;
    String grade;
public void setStudentID(String studentID){
    this.studentID=studentID;
}
public String getStudentID(){
    return studentID;
}
public void setName(String name){
this.name=name;
}
public String getName(){
    return name;
}
public void setAssignment(double assignment){
this.assignment=assignment;
}
public double getAssignment(){
    return assignment;
}
public void setPresentation(double presentation){
this.presentation=presentation;
}
public double getPresentation(){
    return presentation;
}

public void setTest(double test){
this.test=test;
}
public double getTest(){
    return test;
}
public void setExam(double exam){
this.exam=exam;
}
public double getExam(){
    return exam;
}
public void setTotal(double total){
this.total=total;
}
public double getTotal(){
    return total;
}
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);
    int menu = 0;
System.out.println("Student Result");
System.out.println();
System.out.println("1. Add a student");
System.out.println("2. Exit");
boolean quit = false;
do{
System.out.print("Please enter your choice: ");
menu = input.nextInt();
System.out.println();

switch(menu) {
    case 1:
StudentResult data[]=new StudentResult[2];
for (int i=0; i<data.length; i++) {
    int j=i+1;
System.out.println("********Student "+j+"*********");
System.out.println("Enter Matric No");
            String no=input.next();
            System.out.println("Enter Name: ");
            String n=input.next();
            System.out.println("Enter Assignment marks");
            double m1=input.nextDouble();
            System.out.println("Enter Presentation marks");
            double m2=input.nextDouble();
            System.out.println("Enter Test marks");
            double m3=input.nextDouble();
            System.out.println("Enter Exam marks");
            double m4=input.nextDouble();
            double tm=.20*m1+.10*m2+.10*m3+.60*m4;
            System.out.println("Total Marks="+tm);
            data[i] = new StudentResult();
data[i].setStudentID(no);
data[i].setName(n);
data[i].setAssignment(m1);
data[i].setPresentation(m2);
data[i].setTest(m3);
data[i].setExam(m4);
data[i].setTotal(tm);
if(tm<40){
data[i].setGrade("Fail");
}
if(tm>40&&tm<60){
    data[i].setGrade("D");
}
if(tm>60&&tm<70){
    data[i].setGrade("C");
}
if(tm>70&&tm<90){
    data[i].setGrade("B");
}
if(tm>90){
    data[i].setGrade("A");
}
}
for(int i=0;i<2;i++){
      StudentResult show = data[i];
      String ide=show.getStudentID();
      String nn=show.getName();
        double as=show.getAssignment();
          double pr=show.getPresentation();
            double tt=show.getTest();
              double ee=show.getExam();
                double tot=show.getTotal();
                 String g = show.getGrade();
      System.out.println(ide + "  " + nn + "  " + as+"  "+pr+"  "+tt+"  "+ee+"  "+tot+"  "+g);
      }
      break;
      case 2:
          quit = true;
break;
default:
System.out.println("Invalid Entry!");
 }
}
while (!quit);
}
}

Thanks









Related Tutorials/Questions & Answers:
Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
Need help in java programming
Need help in java programming  Hello. Can someone please help me with writig the following programm. Assignment 20% Presentation 10% Mini Test 10% Exam 60% Java program that accepts the following details: student
Advertisements
Java Programming Need Help ASAP
Java Programming Need Help ASAP  You are required to develop..., their year (you can assume they all start in year 1), their programming mark, maths mark, communications mark. You will then need accessor and mutator methods
hi need help with C++ programming!
hi need help with C++ programming!  how do i : b. Store numbers / characters into the file (output) c. Retrieve numbers / characters from the file (input thanks!   b) #include <iostream> #include <
need help - Java Beginners
need help  Need help in programming in Java  Simple java program that will show the output within quotes using system.out.println();DISPLAYING OUPUT " * " ," *** " ........I used System.out.print
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have... using JAVA JSP). e.g. Tool does not adjust with the resolution of the screen(need to know how I can adjust it based on the cureen system's screen resolution
Java Programming Help
Java Programming Help  Hello ! I m the student of last year and i need your help to complete my java project. I going to make a site like youtube... with controls .. I Just want to use jsp and applet in my project . Please help me
Need Help - Java Beginners
Need Help  Hello Sir, Am a beginner of Java. Also i did course... projects in Java as well as J2EE... Can u help me and guide to do a project.../reference/tutorials/ http://netbeans.org/kb/trails/java-ee.html http
Need help - Java Beginners
Need help   To Write a Java program that asks the users to enter a m * n matrix of integers, m and n being the number of rows and columns...; Hi Friend, Please try the following code. We hope that this code will help
need help with a program - Java Beginners
Java algorithm - need help with a program  Java algorithm - need help with a program
Java Programming Code HELP
Java Programming Code HELP  Hi, sir/madam. I am new here and currently developing a program whereby it can read the Java source file... the expert can help me to solve this problem and pull out the attribute name. Can sir
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
PLZ Need some help JAVA...HELP !!
PLZ Need some help JAVA...HELP !!  Create a class names Purchase Each purchase contains an invoice number, amount of sale and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set
Need *Help fixing this - Java Beginners
Need *Help fixing this  I need to make this program prompt user... and maybe add retrieve function //need help with this one badly. Thanks guys for all the help. import java.text.*; import javax.swing.*; import java.awt.event.
Java programming using ArrayList Help?
Java programming using ArrayList Help?  Hi,can anybody help and guide me on doing this java program? (Largest rows and columns)Write a program... row index : 2 The largest column index : 2,3 Any help would be greatly
Java programming using ArrayList Help?
Java programming using ArrayList Help?  Hi,can anybody help and guide me on doing this java program? (Largest rows and columns)Write a program... The largest row index : 2 The largest column index : 2,3 Any help would be greatly
Craps Game Java Programming Help
Craps Game Java Programming Help  Craps is a casino game that involves the throwing of a pair of dice. Based on the throw, the thrower either gets... roll. You may wish to print the roll sequence to help you debug. Output
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need help
Need help  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another drop.... This name list should get from the database. Please help me. By the way, I'm
Java programming help - Java Beginners
Java programming help  Write a program that asks the user for an integer, and if the input is positive, puts stars on the screen - one star on line... for more information. http://www.roseindia.net/java/ Thanks
Urgent java programming question.Pls help
Urgent java programming question.Pls help  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
Need help with this!
Need help with this!  Can anyone please help me... to a file at all at this time. Any help would be greatly appreciated, thank you... to effectivly end the loop with out the need to break it. for(i=(0); i <
need help on writing a program. - Java Beginners
Writing first Java Program  Hi, I need help to write my first Java... roseIndia to get your query solved. check given link to see the solution of your Java problem.http://www.roseindia.net/java/simple-java-program.shtmlThanks
Need Help with Java-SWING progrmming - Swing AWT
Need Help with Java-SWING progrmming  Hi sir, I am a beginner in java-swing programming. I want to know how we can use the print option with a program in swing. Could you help me with an example? Regards Sreejith 
Sales System.. Need Help!! - Java Beginners
Sales System.. Need Help!!  were going to make a sales system in our... help us.. Thank you very much for your reply in my past questions you are a big help.. Thank you so much. Hope you will help me again thanks!! God Bless and more
Java Question Anyone need some HELP !!
Java Question Anyone need some HELP !!  Create a file that contains... of the two files. Note: For the above code, you need POI api. import... and poi-scratchpad-3.2-FINAL-20081019.jar files into the following path: \Java
need help with java program as soon as possible
need help with java program as soon as possible  So my assignment is to write a program that used while loops to perform 6 different things. 1. prompt the users to input two integers: firstNum and secondNum (firstNum must be less
need help pleaseee....i weak in java
need help pleaseee....i weak in java  QUESTION 1 You are required to write an application called Customer Billing System. This system... meter reading, current meter reading and charges. Write a structured Java program
I need your help - Java Beginners
I need your help  What is the purpose of garbage collection in Java, and when is it used?  Hi check out this url : http://www.artima.com/insidejvm/ed2/gc.html http://java.sun.com/javase/technologies/hotspot
( Inheritance,need help in Polymorphism, Overriding) - Java Beginners
( Inheritance,need help in Polymorphism, Overriding)  can any one please help me create this application,thank you Advanced Concepts with Classes( Inheritance, Polymorphism, Overriding) Employees in a company are divided
Need Help To Connect XML as backend in Java-Swing
Need Help To Connect XML as backend in Java-Swing  Seat arrangment swing screenshot I made XML program to connect to swing like this. <?xml... problem is if i click the B1 label it need to change as(occupied-grey colour
need help creating a lift program - Java Beginners
need help creating a lift program  Classes, Methods, Constructors please i need help to create an elevator program Simulating an Elevator write... for any help rendered
i need your help - Java Interview Questions
i need your help  Write a java program that: i. Allows user to enter 2 numbers from the keyboard ii. Uses a method to compare the two numbers to determine which is larger iii. Print to the screen stating which number is larger
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating a program that will be used to manipulate a student database. This portion..., and the student's GPA.using arrays and objects, need to structure the information
I need your help - Java Beginners
I need your help  For this one I need to create delivery class for a delivery service .however, this class should contain (delivery number which... the file name is ApplicationDelivery.java Your program must follow proper Java
Java programming help with files - Java Beginners
Java programming help with files  I want a code or the following program .thanks Write a program that reads employee data into a vector. The data is composed of : - id# - name - nationality - job title the program
i need latest oracle certified java dumps.. Pleas help me?
i need latest oracle certified java dumps.. Pleas help me?  i need latest oracle certified java dumps.. Pleas help me
Need Help on JMS - JMS
Need Help on JMS   Hi, In my application i need to create my own ques and my own QueueConnectionFactory..... Plz tell me how to create the same... Any help is appriciated,.. Thanks in advance
Need help with nested queries
Need help with nested queries  Hello, Table1 has "id", "votes" columns. Table2 has "id", "Name" column. I need to retrieve Name and its corresponging Votes. I tried with nested queries but its confusing. Can anyone please help
hello there i need help
i am a beginner, and aside from that i am really eager to learn java please help...hello there i need help  : i need to do a program like this: Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you
need help with program
need help with program  To write a program to read a set of words from a file and return the following 1)Each word in the file against its frequency 2) the frequency should be in the descending order of the frequencies
need help please
need help please  Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please help me. By the way I'm using Access database
need help to create applet
need help to create applet  Can u help me..?? I get a task ...and i dont know how to make it... So I hope that u can help me... Here is the task... e) CardLayout If u can help me, then please
need help with program
need help with program  To write a program where we can take two integer array as input,Find the missing number from array"B" has all the numbers from array"A" except one,and find the fastest way in doing
Friends need a help on ruby..
Friends need a help on ruby..  Friends i need a ruby script and the requirement is When i am running a ruby script in cmd, after executing my script, a html report will be generated having my console output details. For ex
Need some help urgently
Need some help urgently  Can someone please help me with this below question. I need to write a class for this. If you roll Y standard six-sided dice... need to write a class for this where X and Y are passed as parameter. If someone
Need help with console program?
Need help with console program?  Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). thanks in advance.   Here is an example that repeatedly
Need Help With This Scenario
Need Help With This Scenario  The bonnet of a car is opened to determine if there is anything wrong with the engine. Firstly, the radiator water is checked. If the radiator water is below the minimum indicator level

Ads