Here is the assignment
Write a program to prepare the monthly charge account statement for a customer of CS CARD International, a credit card company. The program should take as input the previous balance on the account and the total amount of additional charges during the month. The program should then compute the interest for the month, the total new balance (the previous balance plus additional charges plus interest), and the minimum payment due. Assume the interest is 0 if the previous balance was 0 but if the previous balance was greater than 0 the interest is 2% of the total owed (previous balance plus additional charges). Assume the minimum payment is as follows:
new balance for a new balance less than $50
$50.00 for a new balance between $50 and $300 (incl)
20% of new bal for a new balance over $300
So if the new balance is $38.00, then the person must pay the whole $38.00; if the balance is $128 then the person must pay $50; if the balance is $350 the minimum payment is $70 (20% of 350). The program should print the charge account statement in the format below. Print the actual dollar amounts in each place using currency format from the NumberFormat class.
This is what I have so far
import java.util.Scanner;
import java.text.NumberFormat;
public class Main
{
public static void main(String[] args) {
NumberFormat money = NumberFormat.getCurrencyInstance();
double Interest = .02;
System.out.println("CS CARD International Statement");
System.out.println("============================== =");
Scanner myObj = new Scanner(System.in);
System.out.println("Enter Previous Balance");
Scanner myObj1 = new Scanner(System.in);
System.out.println("Enter Additional Charges"); //Get the previous balance and additional charges
double PreviousBalance = myObj.nextDouble();
System.out.println("Previous Balance:" + money.format(PreviousBalance));
double AdditionalCharges = myObj1.nextDouble();
System.out.println("Additional Charges:" + money.format(AdditionalCharges)); //Read and display the previous balacne and additional charges
if (PreviousBalance > 0){
double TotalInterest = (PreviousBalance + AdditionalCharges)*Interest; //Calculate Interest
System.out.println("Interest:" + money.format(TotalInterest)); //Display Interest
} else {
System.out.println("Interest:" + "$" + "0");
}
double NewBalance = PreviousBalance + AdditionalCharges + TotalInterest; //Calculate New Balance
System.out.println("New Balance:" + money.format(NewBalance)); //Display New Balance
double lazy = NewBalance*.2; // This is only used if New balance is over $300
double MinimumPayment; //Calculate min payment
if (NewBalance < 50) {
System.out.println("Minimum Payment:" + money.format(NewBalance));
} else if (NewBalance > 50 && NewBalance <= 300) {
System.out.println("Minimum Payment:" + "$" + "50");
} else {
System.out.println("Minimum Payment:" + money.format(lazy) + money.format(NewBalance));
}
}
}
The error I get says that it can't find symbol TotalInterest even though it's already been declared can someone help me figure out why this is happening please and thank you!?