# bracket confusion...?

• 10-28-2008, 12:08 PM
gallimaufry
bracket confusion...?
import java.util.Scanner;
import java.text.DecimalFormat;

public class CsCard
{
public static void main ( String [ ] args )
{
DecimalFormat decimalPattern = new DecimalFormat(" ####0.00" );

double prevBalance; //previous balance
double charges; //new charges this month

Scanner scan = new Scanner(System.in);

System.out.println( " Welcome to CS Card International's Account Statement Calculator. \n");

prevBalance = scan.nextDouble( );
charges = scan.nextDouble( );

double total = ( prevBalance + charges);
double interest = 0.20 * (total);//interest rate is 20%
double interest2 = 0.02 * (total);//interest rate is 2% for certain amounts
double balance = (total + interest);
double balance2 = (total + interest2);
double minimum = (0.20 * balance);
double nothing = 0.00;//need this to fill in gap left by interest
double owed = ( balance - 50.00);//remaining balance owed
double owed2 = ( balance2 - 50.00);//remaining balance owed with 2% interest
double minPay = (0.20 * balance2);

if ( prevBalance == 0 && charges <= 50 )
{
System.out.println( " CS CARD International Statement ");
System.out.println( " ============goofy============== ");
System.out.println( " Previous Balance: \$ " + decimalPattern.format(nothing));
System.out.println( " Additional Charges: \$ " + decimalPattern.format(charges));
System.out.println( " Interest: \$ " + decimalPattern.format(nothing));
System.out.println( " New Balance: \$ " + decimalPattern.format(charges));
System.out.println( " Minimum Payment Due: \$ " + decimalPattern.format(charges));
}

else

if ( prevBalance > 0 && total <= 300)
{
System.out.println( " CS CARD International Statement ");
System.out.println( " =========blablabla============= ");
System.out.println( " Previous Balance: \$ " + decimalPattern.format(prevBalance));
System.out.println( " Additional Charges: \$ " + decimalPattern.format(charges));
System.out.println( " Interest: \$ " + decimalPattern.format(interest2));
System.out.println( " New Balance: \$ " + decimalPattern.format(balance2));
System.out.println( " Minimum Payment Due: \$ 50.00 " );
System.out.println( " Remaining Balance Owed: \$ " + decimalPattern.format(owed2));
}

else

if ( prevBalance >= 0 && total >= 350)
{
System.out.println( " CS CARD International Statement ");
System.out.println( " ========hahahahaha============= ");
System.out.println( " Previous Balance: \$ " + decimalPattern.format(prevBalance));
System.out.println( " Additional Charges: \$ " + decimalPattern.format(charges));
System.out.println( " Interest: \$ " + decimalPattern.format(interest2));
System.out.println( " New Balance: \$ " + decimalPattern.format(balance2));
System.out.println( " Minimum Payment Due: \$ "+ decimalPattern.format(minPay));
System.out.println( " Remaining Balance Owed:\$ " + decimalPattern.format(owed));
}
}
}
}

4 errors found:
File: E:\CsCard.java [line: 75]
Error: E:\CsCard.java:75: class, interface, or enum expected
File: E:\Factorials.java [line: 16]
Error: E:\Factorials.java:16: 'else' without 'if'
File: E:\Factorials.java [line: 20]
Error: E:\Factorials.java:20: ';' expected
File: E:\Factorials.java [line: 26]
Error: E:\Factorials.java:26: reached end of file while parsing
• 10-28-2008, 12:14 PM
gallimaufry
I don't understand how to correct this..
• 10-28-2008, 12:16 PM
Eranga