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

(I need complete java program, not uml thanks) Draw UML class diagram to show th

ID: 3701649 • Letter: #

Question

(I need complete java program, not uml thanks)

Draw UML class diagram to show the relationships between bank, customers, and accounts. Customers may have more than one account and these accounts are saving account and checking account. Each customer’s account has current balance it is based on deposit and withdrawal activities. The balance of the bank account must never go below zero. A savings account gain interest. The bank permits customers to store money in a savings account and, on a monthly basis, the savings account will accumulate based on the following formula:

balance = balance + (interest rate x balance)

A checking account enables the customer to make any number of deposits and withdrawals. To protect their customers, the bank will permit a fixed amount of overdraft protection. This protection enables the customer’s balance to drop below zero, but not below the amount of overdraft protection. The account’s overdraft amount is decremented as it is used Based on the UML diagram, develop a complete program to solve the problem.

(I need complete java program. thanks)

Explanation / Answer

Here is the code for the problem that you stated.

Any additional information is required or any changes needed feel free to ask in comment box,    i will help you.

import java.util.*;
import java.lang.*;
import java.io.*;
import java.text.DecimalFormat;
class BankAccount{
   int custID;
   String custName,accountType;
   private double savingsBalance,currentBalance;
   private double interest=0.1;
            double overdraft;
            public void setValues(){
            Random rand = new Random();
            savingsBalance=rand.nextDouble()*100+1;
            currentBalance=rand.nextDouble()*100+1;
            overdraft=rand.nextDouble()*10000;
            
            }
   public BankAccount()
   {
       accountType="";
       custName="";
       custID=0;
       savingsBalance = 0;
       interest = 0;
   }
   public BankAccount(String cusName,int cusId,String aType)
   {
       custName=cusName;
       custID=cusId;
               accountType=aType;
   }
   public void deposit(double amount)
   {
       if(accountType=="savings"){
           savingsBalance =savingsBalance + amount;
       }
       else{
           currentBalance =currentBalance + amount;
    
       }
    
   }

   public void withdraw(double amount)
   {
       if(accountType=="savings"){
    
           if(savingsBalance<amount){
               System.out.println("Insufficient Balance");
               System.exit(0);
           }
           else{
                savingsBalance = savingsBalance - amount;
           }
        
       }
       else{
               if((currentBalance+overdraft)<amount){
               System.out.println("Insufficient Balance");
               System.exit(0);
           }
           else{
                currentBalance = currentBalance - amount;
           }
       }
    
   }
   public void addInterest()
   {
       savingsBalance = savingsBalance + savingsBalance * interest;
   }
   public void addOverdraft(){
       currentBalance=currentBalance+overdraft;
   }
   public double getSBalance()
   {
       return savingsBalance;
    
   }
   public double getCBalance()
   {
       return currentBalance;
   }
public void display(){
   if(accountType=="savings"){
       addInterest();
    
       System.out.println("Customer Name= "+custName+" CustomerId="+custID+" BankAccount Type ="+accountType+" Available Balance="+savingsBalance);
            }
   else{
       addOverdraft();
          
       System.out.println("Customer Name= "+custName+" CustomerId="+custID+" BankAccount Type ="+accountType+" Available Balance="+currentBalance);
   }

}

}
class Ideone
{
   public static void main (String[] args) throws java.lang.Exception
   {
       BankAccount account = new BankAccount("Jimmy",1234,"checking");
       account.setValues();
       account.withdraw(250);
       account.deposit(400);
       account.display();
    
   }
}