Results 1 to 5 of 5
  1. #1
    gallimaufry is offline Member
    Join Date
    Oct 2008
    Posts
    13
    Rep Power
    0

    Unhappy 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");

    System.out.print( " Please enter your previous balance ");
    prevBalance = scan.nextDouble( );
    System.out.print( " Please enter any additional charges this month ");
    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

  2. #2
    gallimaufry is offline Member
    Join Date
    Oct 2008
    Posts
    13
    Rep Power
    0

    Default

    I don't understand how to correct this..

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I already give a solution to you, work on with that. Sorry I have to close this thread. Ask all your question on the other one.

  5. #5
    gallimaufry is offline Member
    Join Date
    Oct 2008
    Posts
    13
    Rep Power
    0

Similar Threads

  1. Extra bracket
    By CrazyShells Slam in forum New To Java
    Replies: 5
    Last Post: 05-16-2008, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •