Results 1 to 1 of 1
  1. #1
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Deleted post: Java Grading Program

    Posted by "pasito15" in another forum and then deleted by the poster likely so as not to be caught by his instructor:
    Here is the instructions i have to write a program with the following policies

    1.there are 2 quizzes, each graded on the basis of 10 points.

    2.there is 1 midterm exam and one final exam, each graded on the basis of 100 points.

    3.the final exam counts for 50% of the grade, the midterm counts for 25%, and the 2 quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores.)

    A letter grade will be given based on the following criterion: 90 – 100 A
    80 – 89 B 70 – 79 C 60 – 69 D 0 – 59 E

    The program will read in the student’s scores from a text file, and output the student’s record, which consists of the name, 2 quiz and 2 exam scores as well as the student’s average numeric score for the entire course and final letter grade. I am suppose to define and use a class for the student record. All the scores are integers and a student name consists of no more than 10 characters. I must justify your output file.

    this is what I have so far i tried my best n looked everywhere
    Java Code:
        class Assign7{
        private double finalScore;
        private double private_quiz1;
        private double private_quiz2;
        private double private_midTerm;
        private double private_final;
        public Assign7(double finalScore){
          private_quiz1 = 1.25;
          private_quiz2 = 1.25;
          private_midTerm = 0.25;
          private_final = 0.50;
            if (finalScore >= 90) {
                grade = 'A';
            } else if (finalScore >= 80) {
                grade = 'B';
            } else if (finalScore >= 70) {
                grade = 'C';
            } else if (finalScore>= 60) {
                grade = 'D';
            } else {
                grade = 'F';
        public String toString(){
        return finalScore+":"+private_quiz1+":"+private_quiz2+":"+private_midTerm+":"+private_final;
    I get 3 error messages
    line 26 Illegal Start of expression public String toString(){
    error ';' expected
    public String toString
    line 30 reached end of file while parsing

    N here is the second part of the program which was given by the instructor but it wont compile ether, n i was thinking it was because that two codes did not match up help please and will appreciate if people is not rude
    Java Code:
        import java.util.*;
        public class Assign7{
          public static void main(String[] args)throws Exception{
            Scanner myIn = new Scanner( new File("scores.txt") );
            System.out.println( myIn.nextLine() +"  avg  "+"letter");
            while( myIn.hasNext() ){
               name = myIn.Next();
               q1 = myIn.nextInt();
               q2 = myIn.nextInt();
               m = myIn.nextInt();
               f = myIn.nextInt();
               Record myR = new Record( name, q1,q2,m,f);


    public String to String(){ should be public String toString(){. You can't have spaces in method names. Good luck with your homework. – Geoist 7 hours ago

    One thing: import java.until.*; should probably be import java.util.*; – Blorgbeard 7 hours ago
    1) Please post the actual error messages, word for word and not paraphrased. Usually they'll say exactly what's wrong. 2) Please avoid unnecessary and non-standard abbreviations. If you want help, please put in the effort to communicate as clearly and precisely as possible, and we'll try to do the same. 3) If you're not using an IDE, compile frequently, and never add new code until all compilation errors have been fixed, else you'll end up with a mess (known from personal experience). – Hovercraft Full Of Eels 7 hours ago

    Are you using an IDE? It would catch simple errors like those mentioned. And if you are, and it didn't, get another one. Eclipse is very good, and free. – nbrooks 7 hours ago

    @HovercraftFullOfEels 3 error messages line 26 illegal start of expression public String toString(){ ";" expected in public String toString(){ – pasito15 7 hours ago
    @pasito: You need to post the entire error message in your question above and indicate via comment in the code which lines of code are causing the errors. For the error message you've mentioned, look at the line(s) above that error. Often it's a missing semicolon or something basic like that. Your code is full of many errors suggesting that you've been adding code to already bad code, something you will want to avoid. Again, compile often and fix all errors before adding new code. – Hovercraft Full Of Eels 7 hours ago

    myIn.Next() should probably be Alternatively, you can use any basic IDE - BlueJ, Geany, jGRASP - they'll catch routine syntax errors like this. Some of the more advanced - NetBeans and Eclipse - will offer suggestions and autocomplete too. – Makoto 7 hours ago

    @HovercraftFullOfEels i fixed all i could and added the error messages above – pasito15 6 hours ago

    Another one, the q1, q2, m, f variables aren't declared anywhere, yet you're assigning to them. – Geoist 6 hours ago

    @Geoist how can I do that – pasito15 6 hours ago

    What I'd like to know is how the OP managed to complete the first 6 assignments, and STILL have such a poor understanding of basic Java syntax ... and how to read a compiler error message. – Stephen C 6 hours ago

    @StephenC probably the same way he's doing right now. Someone "gave him the codez" – hkf 6 hours ago

    I strongly advise that you run your code through an IDE with syntax highlighting, fix everything that comes up as an error, then come back with a specific question. This really isn't much more than fixing syntax errors. – Makoto 6 hours ago

    people if u really have nothing nice to say just please dont post – pasito15 6 hours ago
    1 upvote
    @pasito15 - You may think I am being "not nice". However, I'm an educator, and I'm trying to point out to you that there is something seriously wrong with the way that you are learning Java. Whatever the cause, you need to get help from your tutors, etc. (And if you have been copying code to do your earlier assignments, the person you are hurting most is yourself. Because patently you have not learned anything by doing it.) – Stephen C 6 hours ago
    Last edited by Fubarable; 07-02-2012 at 01:41 PM.

Similar Threads

  1. [Please Help] Grading Program
    By orange4 in forum New To Java
    Replies: 1
    Last Post: 08-18-2011, 11:15 PM
  2. Java Program: Grading using Arrays [Help]
    By Sly Cooper in forum New To Java
    Replies: 1
    Last Post: 01-30-2011, 08:22 AM
  3. Replies: 3
    Last Post: 05-04-2009, 04:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts