Conver the class To UML diagram   class Clint {            private String accNumber;     private String holderName;     private long currBalance;     public Clint() {         currBalance = 0;     }     public Clint(String acc, String name, long bal) {         accNumber = acc;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Conver the class To UML diagram

 


class Clint {

 
    
    private String accNumber;
    private String holderName;
    private long currBalance;

    public Clint() {
        currBalance = 0;
    }

    public Clint(String acc, String name, long bal) {
        accNumber = acc;
        holderName = name;
        currBalance = bal;
    }

    Scanner sc = new Scanner(System.in);

    // deposit money into the bank account by given amount amt
    public void deposit(long amt) {
        currBalance += amt;
    }

    // if amount is not given ask the user for the amount
    public void deposit() {
        System.out.print("Enter Amount(to deposit): $");
        long amt = sc.nextLong();
        currBalance += amt;
    }

    // withdraw money from the bank account
    public void withdraw(long amt) {
        if (currBalance >= amt) {
            currBalance -= amt;
        } else {
            System.out.println("Insufficient funds!");
        }
    }

    // if amt is not given ask the user for the amount
    public void withdraw() {
        System.out.print("Enter Amount(to withdraw): $");
        long amt = sc.nextLong();
        if (currBalance >= amt) {
            currBalance -= amt;
        } else {
            System.out.println("Insufficient funds!");
        }
    }

    // getters and setters for all the private members
    public String getAccNumber() {
        return accNumber;
    }
     


    public String getHolderName() {
        return holderName;
    }

    public long getBalance() {
        return currBalance;
    }

    public void setBalance(long amt) {
        currBalance = amt;
    }

    public void setHolderName(String n) {
        holderName = n;
    }

    public void setAccNumber(String acc) {
        accNumber = acc;
    }

    // method to display account details
    public void printDetails() {
        System.out.println("[" + accNumber + "-" + holderName + ": $" + currBalance + "]");
    }
    
    
    }


import java.util.ArrayList;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author SAYTECH
 */

    class Account {
    private String bankName;
    private ArrayList<Clint> customers;

    // default constructor
    public Account() {
        bankName = "NA";
        customers = new ArrayList<Clint>();
    }

    // parameterized constructor
    public Account(String name) {
        bankName = name;
        customers = new ArrayList<Clint>();
    }

    // method inserts new BankAccount in the Bank
    public void insert(Clint acc) {
        customers.add(acc);
    }

    // this method searches for the accNo and if present deletes it
    public void delete(String accNo) {
        // delete the bank account associated with the given accNo
        boolean found = false;
        for (int i = 0; i < customers.size(); i++) {
            if (customers.get(i).getAccNumber().equals(accNo)) {
                // found the account
                found = true;
                customers.remove(i);
                break;
            }
        }
        if (found) {
            System.out.println("Found and Deleted!");
        } else {
            System.out.println("No such account exists in the bank!");
        }
    }

    // prints all the details of the bank
    public void printDetails() {
        System.out.println(bankName + " has " + customers.size() + " customers.\nBelow are the deatils:");
        for (Clint acc : customers) {
            System.out.println("[" + acc.getAccNumber() + "-" + acc.getHolderName() + ": $" + acc.getBalance() + "]");
        }
    }
    
}

 

Expert Solution
steps

Step by step

Solved in 6 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY