Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please dont use ArraysList I think we should have possibility of a single owner

ID: 3841502 • Letter: P

Question

please dont use ArraysList

I think we should have possibility of a single owner having multiple accounts.
The beginning of a 'project' that will be in a banking context with accounts and their owners with deposits , withdrawals, interest etc

A java project that will use console I/O to implement Cayman Dodge Banking System
A) Create (or more generally CRUD) 'accounts' each of which will have
        - owner (account number)
        - balance
        - type (checking / savings)

      - associated interest

B) Generate reports regarding our accounts via menu
        Overall report (sorted by ... ? )
        Individual report for account by name or #
        Application of interest rate to update account (time period ?)

Explanation / Answer

import java.util.LinkedList;

public class Account {
  
   String type, number;
   String personName;
   double balance;
LinkedList<Double> deposits = new LinkedList<Double>();
LinkedList<Double> withdrawals = new LinkedList<Double>();
  
  
   public Account(String type, String number, String name) {
       super();
       this.type = type;
       this.number = number;
       this.personName = name;
       this.balance = 0;
   }
  
   public void Withdraw(double amount){
       if(balance>amount){
           balance-=amount;
           withdrawals.add(amount);
          
       }
       else
           System.out.println("Low Balance");
   }
  
   public void Deposit(Double amount){
       balance+=amount;
   }
  
   public void Report(){
       System.out.println("Balance: "+balance);
       System.out.println("Account Type: "+type);
       System.out.println(" ");
      
       System.out.println("Withdrawals:");
       for(Double d:withdrawals)
           System.out.println("$"+d);
      
       System.out.println(" ");
       for(Double d:deposits)
           System.out.println("$"+d);
   }

   public void ApplyInterest(double rate){
       double i = balance*rate/100.00;
      
       balance+=i;
   }
  
}

import java.util.ArrayList;

public class Test {
  
   public static void main(String[] args) {
       ArrayList<Account> a = new ArrayList<Account>();
      
       a.add(new Account("Savings","123","ABC"));
       a.add(new Account("Savings","456","DEF"));
      
       //add accounts or do transactions
      
       for(Account ac:a)
           ac.Report();
   }

}