Advertisement
semsem_elazazy

Untitled

May 20th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. package taylor;
  2. import java.util.Scanner;
  3. import java.util.ArrayList;
  4.  
  5. public class Customer{
  6.  
  7.   String accountType, currencyType, info;
  8.   int customerID, balance, amount;
  9.   Scanner input = new Scanner(System.in);
  10.  
  11.  
  12.   public Customer(int customerID, String accountType, String currencyType,  int balance){
  13.     this.accountType = accountType;
  14.     this.currencyType = currencyType;
  15.     this.customerID = customerID;
  16.     this.balance = balance;
  17.     this.amount = amount;
  18.   }
  19.  
  20.   public int deposit(int amount){
  21.  
  22.     amount = input.nextInt();
  23.     if (amount >= 500) {
  24.       System.out.println("Invalid");
  25.  
  26.     }
  27.     else{
  28.       balance = balance + amount;
  29.  
  30.     }
  31.     return balance;
  32.   }
  33.  
  34.   public int withdraw(int amount){
  35.  
  36.     if (balance < amount) {
  37.       System.out.println("Invalid amount.");
  38.     }
  39.     else if (amount >= 500) {
  40.       System.out.println("Invalid");
  41.     }
  42.     else {
  43.       balance = balance - amount;
  44.  
  45.     }
  46.     return balance;
  47.   }
  48.  
  49.  
  50.   public void display(ArrayList<Customer> accounts) {
  51.     System.out.println("CustomerID:" + accounts.customerID);
  52.     System.out.println("Account Type:" + accounts.accountType);
  53.     System.out.println("Currency Type: " + accounts.currencyType);
  54.     System.out.println("Balance:" + accounts.balance);
  55.  
  56.   }
  57.  
  58.   public  void balance(ArrayList<Customer> accounts) {
  59.     System.out.println("Balance:" + accounts.balance);
  60.   }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement