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



Home Answers Viewqa Java-Beginners Need help in java programming
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Alexander Kvaichadze
Need help in java programming
1 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


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!


Advertisement
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 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
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 - 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
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   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
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
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
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 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 
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
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 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 <
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
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
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
Advertisements
 

 

 

DMCA.com