Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 131,690 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,492 people online right now. Registration is fast and FREE... Join Now!




grading

2 Pages V  1 2 >  
Reply to this topicStart new topic

grading

tagz12
post 14 Oct, 2008 - 10:30 PM
Post #1


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

goodday to all

im a new member here an im just a beginner in programming
and im not good but im reall want to learn.

anyone pls help me with my work im trying to make a grading system
but i cannot get what i want

here is my work:

http://rapidshare.com/files/154151041/Grade.java.html

the problem is i cannot get the sum of the final grade and get the general average of each student pls help me to solve it

pls i really need help
thank you

This post has been edited by tagz12: 14 Oct, 2008 - 10:35 PM
User is offlineProfile CardPM

Go to the top of the page


bbq
post 14 Oct, 2008 - 10:43 PM
Post #2


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


Post your code here...

use the tags
CODE
[code=java]put code in here


then add another at the end of your code
CODE
[/code]


to close your tags

User is online!Profile CardPM

Go to the top of the page

tagz12
post 15 Oct, 2008 - 12:29 AM
Post #3


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

[quote name='bbq' date='14 Oct, 2008 - 11:43 PM' post='437315']
Post your code here...

use the tags
CODE
[code=java]import java.io.*;

class GradingSystem
{
    public static void main(String[]args) throws Exception {
        
        double Quiz,Attendance,Recitation,Exam,
               GradeQuiz,GradeAttendance,GradeRecitation,
               GradeExam,FinalGrade;
        
        int[] student={1,2,3,4,5,6,7,8,9,10};
        
        String[] FirstSemester={"Prelim","Midterm","Prefinal","Finals"};
        
        for(int i=0; i<4; ++i)
        {    
        System.out.println("");
        System.out.println("" +FirstSemester[i]);    
        for(int stud=0; stud<10; ++stud)
        {    
        System.out.println("");
        System.out.println("Student" +student[stud]);
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        System.out.println("Score of Quiz Between 0 and 10:");
        System.out.print("");
        Quiz= Integer.parseInt(br.readLine());
        
        System.out.println("Grade of Attendance Between 0 and 100:");
        System.out.print("");
        Attendance= Integer.parseInt(br.readLine());
        
        System.out.println("Grade of Recitation Between 0 and 100:");
        System.out.print("");
        Recitation= Integer.parseInt(br.readLine());
        
        System.out.println("Grade of Exam Between 0 and 100:");
        System.out.print("");
        Exam=Integer.parseInt(br.readLine());
        
        GradeQuiz=Quiz*0.2*10;
        GradeAttendance=Attendance*0.2;
        GradeRecitation=Recitation*0.2;
        GradeExam=Exam*0.4;
        FinalGrade=GradeQuiz+GradeAttendance+GradeRecitation+GradeExam;
        
        System.out.println("FinalGrade=" +FinalGrade);
    
        
            }
        }
        }
    }




this what i want to happen

i want to add the finalgrade of prelim of student1, in finalgrade of midterm,prefinals and finals then divided by 4 to get the general average then display the result

and i want to do it in other sutdent

pls help me becuase i dont know how to do it pls
again thank you

User is offlineProfile CardPM

Go to the top of the page

bbq
post 15 Oct, 2008 - 04:50 AM
Post #4


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


Ok i did some work to it, however your code still has a lot of problems

java
import java.util.*;

class GradingSystem
{
public static void main(String[]args) throws Exception
{

double Quiz,Attendance,Recitation,Exam,
GradeQuiz,GradeAttendance,GradeRecitation,
GradeExam,FinalGrade;

int[] student={1,2,3,4,5,6,7,8,9,10};

String[] FirstSemester={"Prelim","Midterm","Prefinal","Finals"};

Scanner br = new Scanner(System.in);

for(int i=0; i<4; ++i)
{
System.out.println("");
System.out.println("" + FirstSemester[i]);

for(int stud=0; stud<10; ++stud)
{
System.out.println("");
System.out.println("Student" +student[stud]);


System.out.println("Score of Quiz Between 0 and 10:");
System.out.print("");
Quiz= br.nextDouble();

System.out.println("Grade of Attendance Between 0 and 100:");
System.out.print("");
Attendance= br.nextDouble();

System.out.println("Grade of Recitation Between 0 and 100:");
System.out.print("");
Recitation= br.nextDouble();

System.out.println("Grade of Exam Between 0 and 100:");
System.out.print("");
Exam = br.nextDouble();

GradeQuiz=Quiz*0.2*10;
GradeAttendance=Attendance*0.2;
GradeRecitation=Recitation*0.2;
GradeExam=Exam*0.4;

FinalGrade=GradeQuiz + GradeAttendance+ GradeRecitation+ GradeExam;

System.out.println("FinalGrade=" +FinalGrade);

}
}

} //end main
}


Are you trying to store the grades for 10 students as the line in your code
int[] student={1,2,3,4,5,6,7,8,9,10};
Suggests this to me in some way... if you are then you will need to change all of your grades to arrays and index each students grade... I will do that for you in a general sense and give you an idea how to do it...

The way i would do it is create a class student and set all the scores that way... then a class Semester and store the student scores in that for each student...

This is horrible but it sort of does what i think you are asking

java

import java.util.*;

class GradingSystem
{
public static void main(String[]args) throws Exception
{

/*double Quiz,Attendance,Recitation,Exam,
GradeQuiz,GradeAttendance,GradeRecitation,
GradeExam,FinalGrade;
*/
double[] Quiz_array = new double[10];
double[] Attendance_array = new double[10];
double[] Recitation_array = new double[10];
double[] Exam_array = new double[10];
double[] GradeQuiz_array = new double[10];
double[] GradeAttendance_array = new double[10];
double[] GradeRecitation_array = new double[10];
double[] GradeExam_array = new double[10];

double[] FinalGrade_array = new double[10];



int[] student={1,2,3,4,5,6,7,8,9,10};

String[] FirstSemester={"Prelim","Midterm","Prefinal","Finals"};

Scanner br = new Scanner(System.in);

// To Input scores for 10 students and print the score as you previously had
//
for (int i = 0; i < FirstSemester.length; i++)
{
System.out.println("");
System.out.println("" + FirstSemester[i]);

// quiz, attendance, Recitation, Exam, GradeExam
for (int j = 0; j < Quiz_array.length; j++)
{
System.out.println("");
System.out.println("Student" +student[j]);


System.out.println("Score of Quiz Between 0 and 10:");
System.out.print("");
Quiz_array[j]= br.nextDouble();

System.out.println("Grade of Attendance Between 0 and 100:");
System.out.print("");
Attendance_array[j] = br.nextDouble();

System.out.println("Grade of Recitation Between 0 and 100:");
System.out.print("");
Recitation_array[j] = br.nextDouble();

System.out.println("Grade of Exam Between 0 and 100:");
System.out.print("");
Exam_array[j] = br.nextDouble();

GradeQuiz_array[j] = Quiz_array[j] * 0.2 * 10;
GradeAttendance_array[j]= Attendance_array[j] * 0.2;
GradeRecitation_array[j] = Recitation_array[j] * 0.2;
GradeExam_array[j] = Exam_array[j] * 0.4;

FinalGrade_array[j] = ( GradeQuiz_array[j] + GradeAttendance_array[j] + GradeRecitation_array[j] + GradeExam_array[j]) / 4;


}

//now print the student out with their final grade
for (int stud = 0; stud < FinalGrade_array.length; stud++)
System.out.println("\nStudent : " + stud + "\nFinalGrade =" +FinalGrade_array[i]);

//not that once it reloops... all your stored values will be overwritten... so each semester will overide
// the previous semesters scores or grades



}


} //end main
}


This post has been edited by bbq: 15 Oct, 2008 - 05:15 AM
User is online!Profile CardPM

Go to the top of the page

tagz12
post 15 Oct, 2008 - 07:37 AM
Post #5


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

QUOTE(bbq @ 15 Oct, 2008 - 05:50 AM) *

Ok i did some work to it, however your code still has a lot of problems

java
import java.util.*;

class GradingSystem
{
public static void main(String[]args) throws Exception
{

double Quiz,Attendance,Recitation,Exam,
GradeQuiz,GradeAttendance,GradeRecitation,
GradeExam,FinalGrade;

int[] student={1,2,3,4,5,6,7,8,9,10};

String[] FirstSemester={"Prelim","Midterm","Prefinal","Finals"};

Scanner br = new Scanner(System.in);

for(int i=0; i<4; ++i)
{
System.out.println("");
System.out.println("" + FirstSemester[i]);

for(int stud=0; stud<10; ++stud)
{
System.out.println("");
System.out.println("Student" +student[stud]);


System.out.println("Score of Quiz Between 0 and 10:");
System.out.print("");
Quiz= br.nextDouble();

System.out.println("Grade of Attendance Between 0 and 100:");
System.out.print("");
Attendance= br.nextDouble();

System.out.println("Grade of Recitation Between 0 and 100:");
System.out.print("");
Recitation= br.nextDouble();

System.out.println("Grade of Exam Between 0 and 100:");
System.out.print("");
Exam = br.nextDouble();

GradeQuiz=Quiz*0.2*10;
GradeAttendance=Attendance*0.2;
GradeRecitation=Recitation*0.2;
GradeExam=Exam*0.4;

FinalGrade=GradeQuiz + GradeAttendance+ GradeRecitation+ GradeExam;

System.out.println("FinalGrade=" +FinalGrade);

}
}

} //end main
}


Are you trying to store the grades for 10 students as the line in your code
int[] student={1,2,3,4,5,6,7,8,9,10};
Suggests this to me in some way... if you are then you will need to change all of your grades to arrays and index each students grade... I will do that for you in a general sense and give you an idea how to do it...

The way i would do it is create a class student and set all the scores that way... then a class Semester and store the student scores in that for each student...

This is horrible but it sort of does what i think you are asking

java

import java.util.*;

class GradingSystem
{
public static void main(String[]args) throws Exception
{

/*double Quiz,Attendance,Recitation,Exam,
GradeQuiz,GradeAttendance,GradeRecitation,
GradeExam,FinalGrade;
*/
double[] Quiz_array = new double[10];
double[] Attendance_array = new double[10];
double[] Recitation_array = new double[10];
double[] Exam_array = new double[10];
double[] GradeQuiz_array = new double[10];
double[] GradeAttendance_array = new double[10];
double[] GradeRecitation_array = new double[10];
double[] GradeExam_array = new double[10];

double[] FinalGrade_array = new double[10];



int[] student={1,2,3,4,5,6,7,8,9,10};

String[] FirstSemester={"Prelim","Midterm","Prefinal","Finals"};

Scanner br = new Scanner(System.in);

// To Input scores for 10 students and print the score as you previously had
//
for (int i = 0; i < FirstSemester.length; i++)
{
System.out.println("");
System.out.println("" + FirstSemester[i]);

// quiz, attendance, Recitation, Exam, GradeExam
for (int j = 0; j < Quiz_array.length; j++)
{
System.out.println("");
System.out.println("Student" +student[j]);


System.out.println("Score of Quiz Between 0 and 10:");
System.out.print("");
Quiz_array[j]= br.nextDouble();

System.out.println("Grade of Attendance Between 0 and 100:");
System.out.print("");
Attendance_array[j] = br.nextDouble();

System.out.println("Grade of Recitation Between 0 and 100:");
System.out.print("");
Recitation_array[j] = br.nextDouble();

System.out.println("Grade of Exam Between 0 and 100:");
System.out.print("");
Exam_array[j] = br.nextDouble();

GradeQuiz_array[j] = Quiz_array[j] * 0.2 * 10;
GradeAttendance_array[j]= Attendance_array[j] * 0.2;
GradeRecitation_array[j] = Recitation_array[j] * 0.2;
GradeExam_array[j] = Exam_array[j] * 0.4;

FinalGrade_array[j] = ( GradeQuiz_array[j] + GradeAttendance_array[j] + GradeRecitation_array[j] + GradeExam_array[j]) / 4;


}

//now print the student out with their final grade
for (int stud = 0; stud < FinalGrade_array.length; stud++)
System.out.println("\nStudent : " + stud + "\nFinalGrade =" +FinalGrade_array[i]);

//not that once it reloops... all your stored values will be overwritten... so each semester will overide
// the previous semesters scores or grades



}


} //end main
}



sir thank you very much

in my first plan yes but after having alot of problems and get many errors
i change my plan and make it simple a program that i think i can make
but i was wrong
my knowledge in programming is poor but i will not stop

sir im not familiar with scanner and im having problem in line 30 with the scanner i try to import java.util.Scanner; in line 1 but still it wont work and until now im still trying to find how to make it work


again thank you

This post has been edited by tagz12: 15 Oct, 2008 - 08:01 AM
User is offlineProfile CardPM

Go to the top of the page

bbq
post 15 Oct, 2008 - 09:02 AM
Post #6


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


Well its really good you are having a good go at it. Have you covered array's ? Perhaps recode your program from the start.

Make it simple - just ask for 4 inputs (marks) and compute the average grade and print it out. Start off small and build upwards from there.

The Scanner is a part of java.util.*; and it allows you to take in user inputs. You initialise a new scanner

Scanner tagz12 = new Scanner(System.in);

then use various methods to take certain inputs

for example assuming you are using the Scanner called tagz12

int myInt = tagz12.nextInt();

double someDouble = tagz12.nextDouble();

String aName = tagz12.next();

What JDK are you running and what version of it.... Perhaps update to the latest from www.java.sun.com install it and compile with that... are you using command prompt to compile or are you utilising an IDE like Netbeans or Eclipse ?

I will help you get this working smile.gif
User is online!Profile CardPM

Go to the top of the page

tagz12
post 15 Oct, 2008 - 02:56 PM
Post #7


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

sir thank you

Have you covered array's ?
yes and im still reading it all over again

What JDK are you running and what version of it
im using jcreator LE 3.0 version 3.10.009 and i use command prompt to compile

i will update my jcreator and try what you said
User is offlineProfile CardPM

Go to the top of the page

bbq
post 16 Oct, 2008 - 12:16 AM
Post #8


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


You don't need to update JCreator,

in command prompt type the following and post back what it says

Firstly
type java -version

Then post the output here

Secondly
type javac -version

Then post the output here

That will tell you the version of java you are running. JCreator is simply an IDE (Integrated Development Environment) and it relies on the versions of Java that you have installed. So please post the results of that just so we can see whats going on smile.gif
User is online!Profile CardPM

Go to the top of the page

tagz12
post 16 Oct, 2008 - 12:45 AM
Post #9


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

java -version
java version "1.6.0_10"
Java™ SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot™ Client VM (build 11.0-b15, mixed mode, sharing)




javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

javac-version
'javac-version' is not recognized as an internal or external command,
operable program or batch file.

javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

javac - version
'javac' is not recognized as an internal or external command,
operable program or batch file.

why it always like this?
User is offlineProfile CardPM

Go to the top of the page

bbq
post 16 Oct, 2008 - 03:09 AM
Post #10


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


Just as i though, javac is the command used to compile java code. Whilst java is the command used to execute compiled code. So I have to ask do you have the JDK installed ? Usually from memory in windows it is located in c:\ProgramFiles\Java\jdk_"someversion"

If you do not have the java JDK installed then you will not be able to compile java at all. I wrote a tutorial a while back on setting up java on windows... Perhaps it might help you. Seem as though it is not on this site and is hosted on my own site i will pm you the details. So check your private messages smile.gif

edit
you cant recieve messages yet

QUOTE
Ok mate, i wrote this page a long time ago, however it still applies and should help you get rid of that javac -version command not an external recognized blah blah

My short install guide

Have a look there and read it, it explains how to install the JDK (which is needed) and get java working with cmd prompt smile.gif

The first thing you should do though is download the Java JDK which you can get from here. Just select your Operating system and download it
Download Java JDK

If you have any further questions just contact me


is what i said...

This post has been edited by bbq: 16 Oct, 2008 - 03:14 AM
User is online!Profile CardPM

Go to the top of the page

tagz12
post 16 Oct, 2008 - 08:59 PM
Post #11


New D.I.C Head

*
Joined: 14 Oct, 2008
Posts: 7

sir thank you so much

i did what you say i follow the instruction that you give but sad to say it did not remove the problem in javac -version

C:\>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

i dwonload jcreator le v 4.50 and install it in my pc
and i try your code and it work
but still i cant get the general average of each student

and the problem in javac -version remain here
C:\>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

thank you

This post has been edited by tagz12: 17 Oct, 2008 - 02:02 AM
User is offlineProfile CardPM

Go to the top of the page

bbq
post 17 Oct, 2008 - 04:20 AM
Post #12


D.I.C Head

Group Icon
Joined: 15 May, 2008
Posts: 173



Thanked 11 times

Dream Kudos: 50
My Contributions


JCreator has nothing to do with it. You need to download the sun jdk and install it. That contains all the tools to actually compile code. Read download and install this.

https://cds.sun.com/is-bin/INTERSHOP.enfini...S-CDS_Developer

Install it and follow the tutorial i posted above
User is online!Profile CardPM

Go to the top of the page

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 08:11AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month