Не удалось найти или загрузить основной класс

У меня есть 2 файла Java. Один создает классы для сохранения учетных записей. Другой должен проверить это. К сожалению, я получаю сообщение об ошибке "Не удалось найти или загрузить основной класс".

пакет зад6;

общедоступный класс SavingsAccount { private double yearInInrestrestRate, Balance, Накопительный Interest, Накопительный Deposits = 0, Накопительный Withdrawals = 0;

// Constructor
public SavingsAccount(double b)
{
    balance = b;
}

// Mutators
public void withdraw(double w)
{
    balance -= w;
    accumulativeWithdrawals += w;
}

public void deposit(double d)
{
    balance += d;
    accumulativeDeposits += d;
}

public void addMonthlyInterest()
{
    accumulativeInterest += balance * (annualInterestRate/12);
    balance += balance * (annualInterestRate/12);
}

// Setters
public void setBalance(double b)
{
    balance = b;
}

public void setAnnualInterestRate(double air)
{
    annualInterestRate = air;
}

// Getters
public double getBalance()
{
    return balance;
}

public double getAnnualInterestRate()
{
    return annualInterestRate;
}

public double getMonthlyInterest()
{
    return balance * (annualInterestRate/12);
}

public double getAccumulativeInterest()
{
    return accumulativeInterest;
}

public double getAccumulativeDeposits()
{
    return accumulativeDeposits;
}

public double getAccumulativeWithdrawals()
{
    return accumulativeWithdrawals;
}

}

И Классовый Тест:

 import java.util.Scanner;

 public class SavingsAccountTest {
public static void main(String[] args)
{
    int monthsPassed;

    Scanner userInput = new Scanner(System.in);

    System.out.print("Please enter the starting balance: $");
    SavingsAccount demoAccount = new SavingsAccount(userInput.nextDouble());

    System.out.print("Enter the annual interest rate (decimal): ");
    demoAccount.setAnnualInterestRate(userInput.nextDouble());

    System.out.print("Enter the number of months that have passed since the account\'s establishment: ");
    monthsPassed = userInput.nextInt();

    for (int count = 1; count <= monthsPassed; count++)
    {
        System.out.println("\n-----MONTH " + count + "-----");

        System.out.printf("Enter the amount deposited into the account: $");
        demoAccount.deposit(userInput.nextDouble());


        System.out.printf("Enter the amount withdrawn from the account: $");
        demoAccount.withdraw(userInput.nextDouble());

        System.out.printf("This month\'s interest is: $%.2f\n", demoAccount.getMonthlyInterest());
        demoAccount.addMonthlyInterest();
    }

    System.out.printf("\nEnding balance: $%.2f", demoAccount.getBalance());
    System.out.printf("\nTotal deposits: $%.2f", demoAccount.getAccumulativeDeposits());
    System.out.printf("\nTotal withdrawals: $%.2f", demoAccount.getAccumulativeWithdrawals());
    System.out.printf("\nTotal interest: $%.2f", demoAccount.getAccumulativeInterest());


    userInput.close();
}

}

Где ошибка?

0 ответов

Другие вопросы по тегам