Java 找不到符号-可变分数

Java 找不到符号-可变分数,java,Java,我得到了错误 找不到符号-可变分数 有人能指出我的程序中出现了什么问题导致了这种情况吗 import java.util.*; public class Grades { public static void main (String[] args) { intro(); Scanner console = new Scanner(System.in); int totalScoreMain = totalScore(score,

我得到了错误

找不到符号-可变分数

有人能指出我的程序中出现了什么问题导致了这种情况吗

import java.util.*;

public class Grades {
    public static void main (String[] args) {

        intro();

        Scanner console = new Scanner(System.in);

        int totalScoreMain = totalScore(score, curveNumber);
        double weightedScoreMain = weightedScore(weight, score, curveNumber);
        double weightedScore2Main = weightedScore2(weight2, sections, sumScore);

        for(int i = 1; i <= 2; exam++) {
            System.out.println("Exam i");
            exam();
        }
        homework();
    }

    public static void intro () {

        System.out.println("This program reads exam/homework scores");
        System.out.println("and reports your overall course grade.");
        System.out.println();
    }

    public static void exam () {
        System.out.print("What is its weight (0-100)?");
        double weight = console.nextInt();
        System.out.print("Score earned?");
        int score = console.nextInt();
        System.out.print("Was there a curve (1=yes, 2=no)?");
        int curve = console.nextInt();
        if (curve == 1) {
            System.out.print("How much was the curve?");
            int curveNumber = console.nextInt();
        } else if (curve == 2) {
            int curveNumber = 0;
        }

        totalScore(score, curveNumber);
        weightedscore(weight, score, curveNumber);

        System.out.println("Total points = " + totalScoreMain + "/" + "100");
        System.out.println("Weighted score = " + weightedScoreMain + "/" + weight);
    }

    public static int totalScore (int score, int curveNumber) {

        int totalScore = Math.min(score + curveNumber, 100);
        return totalScore;
    }

    public static double weightedScore (int weight, int score, int curveNumber) {

        double weightedScore = (score + curveNumber) * weight/100;
        return weightedScore;
    }

    public static void homework () {

        System.out.print("What is its weight (0-100)?");
        int weight2 = console.nextInt();
        System.out.print("Number of assignments?");
        int number = console.nextInt();
        int sumScore = 0;
        int sumMax = 0;

        for(int i = 1; i <= number; i++) {
            System.out.println("Assignment " + i + "score and max?");
            int aScore = console.nextInt();
            int aScoreMax = console.nextInt();

            sumScore = sumScore + aScore;
            sumMax = sumMax + aScoreMax; }

        System.out.print("How many sections attended?");
        int section = console.nextInt();
        int sections = Math.min(3 * section, 20);
        System.out.println("Section points = " + sections);

        weightedScore2(weight2, sections, sumScore);

        System.out.println("Total points = " + (sections + sumScore) + "/" + sumMax);
        System.out.println("Weighted score = " + weightedScore2 + "/" + weight2);
    }

    public static double weightedScore2(int weight2, int sections, int sumScore)
    {

        int weightedScore2 = weight2/100 * (sections + sumScore);
        return weightedScore2;
    }
}
import java.util.*;
公营班级职系{
公共静态void main(字符串[]args){
简介();
扫描仪控制台=新扫描仪(System.in);
int totalScoreMain=totalScore(分数,曲线数);
double weightedScoreMain=加权分数(权重、分数、曲线计数);
双权重得分2主=权重得分2(权重2,分段,总得分);

对于(int i=1;i以下代码不是一个好代码,但它运行时需要进行大量改进,您仍然可以在它运行时尝试,以便继续:

import java.util.Scanner;

public class Grades {
    static int score;
    static int curveNumber;
    static int weight;
    static int weight2;
    static int sections;
    static int sumScore;
    static int totalScoreMain;

    static double weightedScoreMain;
    static double weightedScore2Main;

    static Scanner console = new Scanner(System.in);

    public static void main(String[] args) {
        intro();

        totalScoreMain = totalScore(score, curveNumber);
        weightedScoreMain = weightedScore(weight, score, curveNumber);
        weightedScore2Main = weightedScore2(weight2, sections, sumScore);

        for (int i = 1; i <= 2; i++) {
            System.out.println("Exam " + i);
            exam();
        }
        homework();
    }

    public static void intro() {
        System.out.println("This program reads exam/homework scores");
        System.out.println("and reports your overall course grade.");
        System.out.println();
    }

    public static void exam() {
        System.out.print("What is its weight (0-100)?");
        double weight = console.nextInt();
        System.out.print("Score earned?");
        int score = console.nextInt();
        System.out.print("Was there a curve (1=yes, 2=no)?");
        int curve = console.nextInt();
        if (curve == 1) {
            System.out.print("How much was the curve?");
            curveNumber = console.nextInt();
        } else if (curve == 2) {
            curveNumber = 0;
        }

        totalScore(score, curveNumber);
        weightedScore(weight, score, curveNumber);

        System.out.println("Total points = " + totalScoreMain + "/" + "100");
        System.out.println("Weighted score = " + weightedScoreMain + "/"
                + weight);
    }

    public static int totalScore(int score, int curveNumber) {
        int totalScore = Math.min(score + curveNumber, 100);
        return totalScore;
    }

    public static double weightedScore(double weight, int score, int curveNumber) {
        double weightedScore = (score + curveNumber) * weight / 100;
        return weightedScore;
    }

    public static void homework() {
        System.out.print("What is its weight (0-100)?");
        int weight2 = console.nextInt();
        System.out.print("Number of assignments?");
        int number = console.nextInt();
        int sumScore = 0;
        int sumMax = 0;

        for (int i = 1; i <= number; i++) {
            System.out.println("Assignment " + i + "score and max?");
            int aScore = console.nextInt();
            int aScoreMax = console.nextInt();

            sumScore = sumScore + aScore;
            sumMax = sumMax + aScoreMax;
        }

        System.out.print("How many sections attended?");
        int section = console.nextInt();
        int sections = Math.min(3 * section, 20);
        System.out.println("Section points = " + sections);
        System.out.println("Total points = " + (sections + sumScore) + "/"
                + sumMax);
        System.out.println("Weighted score = "
                + weightedScore2(weight2, sections, sumScore) / weight2);
    }

    public static double weightedScore2(int weight2, int sections, int sumScore) {

        int weightedScore2 = weight2 / 100 * (sections + sumScore);
        return weightedScore2;
    }
}
import java.util.Scanner;
公营班级职系{
静态积分;
静态整数曲线计数;
静态整数权重;
静态int权重2;
静态int段;
静态积分;
静态int-totalmain;
静态双加权ScoreMain;
静态双权重记分2分;
静态扫描仪控制台=新扫描仪(System.in);
公共静态void main(字符串[]args){
简介();
totalScoreMain=totalScore(分数,曲线数);
weightedScoreMain=weightedScore(重量、分数、曲线计数);
weightedScore2Main=weightedScore2(Weighted2,章节,sumScore);

对于(int i=1;i Yes,
score
只是
exam
中的一个局部变量。我建议您阅读以下内容:不能在未定义的范围内使用变量。我建议您将其传递给需要的方法。