Advertisement
Guest User

Untitled

a guest
Jan 31st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.io.Serializable;
  2.  
  3. public class Account implements Serializable {
  4.  
  5. private int accountNum;
  6. private String username;
  7. private String password;
  8. private double balance;
  9.  
  10. public Account(int accountNum, String username, String password, double balance) {
  11. this.accountNum = accountNum;
  12. this.username = username;
  13. this.password = password;
  14. this.balance = balance;
  15. }
  16.  
  17. public int getAccountNum() {
  18. return accountNum;
  19. }
  20.  
  21. public void withdraw(int amount) {
  22. balance-=amount;
  23.  
  24. System.out.printf("Successfully withdrawn %d from account. New balance is %f\n", amount, this.balance);
  25. }
  26.  
  27. public void deposit(int amount) {
  28. balance+=amount;
  29.  
  30. System.out.printf("Successfully deposited %d to account. New balance is %f\n", amount, this.balance);
  31. }
  32.  
  33. public double getBalance() {
  34. return balance;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement