CS 1054 Introduction to Programming in Java (Spring 2008)

Lab 8: Console Input (and Aggregate classes)

Lab Objective

Instructions

  1. Begin by downloading Lab8.zip, save the file, and then extract it in a folder you can locate. Open this project in BlueJ. You will complete the BankConsole class, but leave the Bank and BankAccount classes intact (no revisions are necessary, nor ar they allowed).
  2. Complete the BankConsole class such that it interactively carries out transactions on a Bank object through user input. You will need to use the Scanner class. Notice that BankConsole only calls methods on the Bank class, not from the BankAccount class. Here's a sample execution of the BankConsole class (letters in bold are a result of user input).
    deposit, withdraw, balance, or quit? balance
    account name: john
    Balance is 1000.0
    deposit, withdraw, balance, or quit? balance
    account name: marsha
    Balance is 2000.0
    deposit, withdraw, balance, or quit? deposit
    account name: john
    amount to deposit: 234.56
    deposit, withdraw, balance, or quit? withdraw
    account name: marsha
    amount to withdraw: 150.00
    deposit, withdraw, balance, or quit? balance
    account name: john
    Balance is 1234.56
    deposit, withdraw, balance, or quit? balance
    account name: marsha
    Balance is 1850.0
    deposit, withdraw, balance, or quit? deposit
    account name: bob
    amount to deposit: 100
    No account with that name
    deposit, withdraw, balance, or quit? quit
    Thank you.
    
    You do not have to follow the above demonstration exactly (i.e., you could use different messages or prompts), but you should retain all functionality.
  3. Demonstrate your code to your TA when you are done.