Java Using Eclipse Beginner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • corky20
    New Member
    • Dec 2006
    • 11

    #16
    Cheers Guy's i seemed to be in a rush when i 1st asked bout this but i guess it is better this way rather than you giving me the code as i would learn nothing!

    New Code:

    public class AssignmentEg {

    public static void main(String[] args) {

    int accountNumber;
    double oldBalance = 0
    double newBalance = 0
    double lodgement, withdrawal;
    char transactionType = 'L' | 'W'
    final char TERMINATOR = ('X');


    System.out.prin tln("Enter seven digit account number: ");
    accountNumber=u uInOut.ReadInt( );


    if (accountNumber >9999999 && accountNumber <10000000){

    System.out.prin tln("Please enter current balance: ");
    accountNumber=u uInOut.ReadInt( );
    System.out.prin tln("*** Transaction Types***");
    System.out.prin tln("*** 'L' - Lodgement***");
    System.out.prin tln("*** 'W' - Withdrawal***") ;
    System.out.prin tln(("*** 'X' - Terminator***") + "\n");
    System.out.prin tln("Enter transactionType : ");
    transactionType =uuInOut.ReadCh ar();
    uuInOut.ReadLn( );
    }

    while (transactionTyp e != TERMINATOR)
    {
    if (transactionTyp e == 'L'){
    System.out.prin tln("Enter Amount to lodge: ");
    lodgement=uuInO ut.ReadDouble() ;
    newBalance = newBalance + lodgement;

    }
    else if (transactionTyp e == 'W'){
    System.out.prin tln("Enter Amount to withdraw: ");
    withdrawal=uuIn Out.ReadDouble( );

    newBalance = newBalance - withdrawal;
    }
    {
    System.out.flus h();
    System.out.prin tln("Enter transactionType : ");
    transactionType =uuInOut.ReadCh ar();
    uuInOut.ReadLn( );
    }

    System.out.prin tln("Account Number :" + accountNumber + "\n");
    System.out.prin tln("OldBalance :£"+uuInOut.For mat(oldBalance, 2)+ "\n");
    System.out.prin tln("New Balance:£" + uuInOut.Format( newBalance,2)+ "\n");
    }


    }
    }


    Is there anyways to improve on this to make it easier to use or any cool things you can add which will make it that bit better??? i want to learn new things so any thing would be appreciated?!?

    Comment

    Working...