Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. /* Richard Lydon
  2.  * Exercise 7-11
  3.  * This program will make a bank account
  4.  * */
  5.  
  6. import java.io.*;
  7. import java.util.Scanner;
  8.  
  9. public class ex711
  10. {
  11.   public static void main(String[] args)throws IOException
  12.   {
  13.     bankacct711 b = new bankacct711();
  14.     String anumber;
  15.     double balance, amount;
  16.     BufferedReader br = new
  17.       BufferedReader(new InputStreamReader(System.in));
  18.     Scanner sc = new Scanner(System.in);
  19.    
  20.     System.out.print("Enter account number: ");
  21.     anumber=br.readLine();
  22.     b.setacctnum(anumber);
  23.     System.out.print("Enter beinning balance: ");
  24.     balance = sc.nextDouble();
  25.     b.setbal(balance); //set value of b's private data field
  26.    
  27.     System.out.print("Enter amount of transaction: ");
  28.     amount = sc.nextDouble();
  29.     b.trans(amount); // update b's private data field
  30.    
  31.     System.out.println("\nAccount Number is "+ b.getacctnum());
  32.     System.out.printf("Current Balance is %.2f\n",b.getbal()); // look up and pring b's private data field
  33.   }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement