import java.util.Scanner;
public class Gradesmain
{
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println ("This program computes your percentage out of a 100 for weighted grades");
System.out.println ("How many sections of 100%?");
int rows = scan.nextInt();
double [][] list = new double[rows][3];
int i = 0;
int sec= 1;
while (i < rows)
{
System.out.println("Values for Section " + sec);
System.out.println("What is this section's weight out of 100%?");
list[rows][0] = scan.nextDouble();
System.out.println("What is your actual points?");
list[rows][1] = scan .nextDouble();
System.out.println("What are the total points possible?");
list[rows][2] = scan.nextDouble();
sec++;
i++;
}
double [] toSum = new double[rows];
for(int r = 0;r<rows; r++)
{
double weight;
double actual;
double outOf;
weight = list[rows][0];
actual = list[rows][1];
outOf = list[rows][2];
//Grade gr = new Grade(list[r][0],list[r][1],list[r][2]);
toSum[r] = ((actual/outOf))*weight;
}
double total=0.0;
for (int s=0; s < sec; s++)
{
total += toSum;
}
System.out.println (total);
}
}
</pre></div><!–ENDSCRIPT–>
thanks
Exception in Thread.... help!!!
hello,
I am trying to make a simple java program to calculate weighted grades. The program compiles fine but when I run it it gives the error message "Exception in thread "main" java.lang.NoClassDefFoundError: Gradesmain"
Here is my code:
Gradesmain.java
My guess would be that wherever your compile .class file is located isn't on the class path.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement