Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Richard Lydon
- * Exercise 7-11
- * This program will make a bank account
- * */
- import java.io.*;
- import java.util.Scanner;
- public class ex711
- {
- public static void main(String[] args)throws IOException
- {
- bankacct711 b = new bankacct711();
- String anumber;
- double balance, amount;
- BufferedReader br = new
- BufferedReader(new InputStreamReader(System.in));
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter account number: ");
- anumber=br.readLine();
- b.setacctnum(anumber);
- System.out.print("Enter beinning balance: ");
- balance = sc.nextDouble();
- b.setbal(balance); //set value of b's private data field
- System.out.print("Enter amount of transaction: ");
- amount = sc.nextDouble();
- b.trans(amount); // update b's private data field
- System.out.println("\nAccount Number is "+ b.getacctnum());
- System.out.printf("Current Balance is %.2f\n",b.getbal()); // look up and pring b's private data field
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement