Java Debugging Help Needed

Cannabis

Onyx user!
Reputation
0
So for the final of my Java class, I'm making a calculator that will tell you want you need to get on a final exam to get a certain grade in the class depending on the weight of the final. The code that I have so far is very simple as it's a Java I class, but I've tried everything I can think of and have had the same error for the past week.

Here's what I have so far,
Code:
import java.util.Scanner;
public class eocGradeCalc {

    public static void main(String[] args) {

        int desired; //Desired grade.
    	int current; // Current grade.
    	int percent; // Percentage of the total grade for which the final test counts. 
		double result;
        int gradeNeeded; //Grade you need on test.
        double percentWeight; // Percent remaining subtracting final's weight. Use decimals.
        Scanner stdio = new Scanner( System.in );



		 System.out.print("Enter your desired grade in the class:  ");
     	 	TextIO.getInt();
     	 	desired = stdio.nextInt();
      		 stdio.nextLine();

      	  System.out.print("Enter your current grade in the class:  ");
          	TextIO.getInt();
          	current = stdio.nextInt();
          	stdio.nextLine();

           System.out.print("Enter the weight of the test(10% = .1):  ");
     		 TextIO.getDouble();
     		 percent = stdio.nextInt();
             percentWeight = 0;
     		 if (percent == .1)
     		 	percentWeight = .9;
     		 if (percent == .15)
     		 	percentWeight = .85;
     		 if (percent == .20)
     		 	percentWeight = .80;
     		 stdio.nextLine();


		gradeNeeded = (current) + (desired * percent);
			result = desired * percentWeight;


			//Examples
			//.9(68.94) + .1(x) = 70
 			//x = 79.54
			//.85(68.94) + .15(x) = 70
 			//x = 76.01



System.out.printf("%1.2f", result);
      System.out.println();
      System.out.println("You will need to get");
      System.out.printf("%1.2f", gradeNeeded);
      System.out.println("to get a");
      System.out.printf("%1.2f", desired);
      System.out.println("percent in the class.");
      System.out.println();

    }
}
Source can be found here http://www.mediafire.com/?ok3g47043lvs2cg
Any and all help is greatly appreciated.
 
What error does it shows?

Code:
int percent; // Percentage of the total grade for which the final test counts. Use decimals.

What do you mean by "Use decimals." ? You can't have decimals in an integer.
 
SD8Z said:
What error does it shows?

Code:
int percent; // Percentage of the total grade for which the final test counts. Use decimals.

What do you mean by "Use decimals." ? You can't have decimals in an integer.

Yeah I know I haven't changed the notes since this morning when I was working on it.
 
Kevin said:
SD8Z said:
What error does it shows?

Code:
int percent; // Percentage of the total grade for which the final test counts. Use decimals.

What do you mean by "Use decimals." ? You can't have decimals in an integer.

Yeah I know I haven't changed the notes since this morning when I was working on it.

Yeah, ok.
But can you tell us in which line the error is? What does the debugger throw?
What error and in what line.
 
SD8Z said:
Kevin said:
SD8Z said:
What error does it shows?

Code:
int percent; // Percentage of the total grade for which the final test counts. Use decimals.

What do you mean by "Use decimals." ? You can't have decimals in an integer.

Yeah I know I haven't changed the notes since this morning when I was working on it.

Yeah, ok.
But can you tell us in which line the error is? What does the debugger throw?
What error and in what line.

It just waits after the first input.
 
Fixed everything for you, TextIO, was not needed at all, what the hell was it...

http://pastebin.com/dVxn9USw

Not sure if your logic is completely correct but never-the-less, it does work now.

Now I have to finish my project which is probably 4-5x more annoying.
 
Gilaga Defender of Cloudsdale said:
Fixed everything for you, TextIO, was not needed at all, what the hell was it...

http://pastebin.com/dVxn9USw

Not sure if your logic is completely correct but never-the-less, it does work now.

Now I have to finish my project which is probably 4-5x more annoying.
TextIO is just something my teacher wanted us to use.
 
Kevin said:
Gilaga Defender of Cloudsdale said:
Fixed everything for you, TextIO, was not needed at all, what the hell was it...

http://pastebin.com/dVxn9USw

Not sure if your logic is completely correct but never-the-less, it does work now.

Now I have to finish my project which is probably 4-5x more annoying.
TextIO is just something my teacher wanted us to use.

What is it suppose to do,, ask your teacher for a little help with it then, cba to look into it further, have to get my code to graph cubic and exponential graphs now, already have linear and parabola working.
 
Back
Top