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

Part 1 Write a program that include a class, its implementation and a client sid

ID: 3928340 • Letter: P

Question

Part 1
Write a program that include a class, its implementation and a client side code to test Part 1 and Part 2 separately:
The class will encapsulate the concept of a banking customer with his information.
Customer id, full name, phone number, date of birth, social security.

Part 2
Write a class that encapsulate the concept of a bank account.
Account id, customer id (owner of the account), amount of funds in the account Part 1
Write a program that include a class, its implementation and a client side code to test Part 1 and Part 2 separately:
The class will encapsulate the concept of a banking customer with his information.
Customer id, full name, phone number, date of birth, social security.

Part 2
Write a class that encapsulate the concept of a bank account.
Account id, customer id (owner of the account), amount of funds in the account Part 1
Write a program that include a class, its implementation and a client side code to test Part 1 and Part 2 separately:
The class will encapsulate the concept of a banking customer with his information.
Customer id, full name, phone number, date of birth, social security.

Part 2
Write a class that encapsulate the concept of a bank account.
Account id, customer id (owner of the account), amount of funds in the account

Explanation / Answer

1)

BankingCustomer.java

public class BankingCustomer
{
   //Declaring instance variables
   private String fullname;
   private String phoneno;
   private String datofBirth;
   private String ssn;
  
   //parameterized constructors
   public BankingCustomer(String fullname, String phoneno, String datofBirth,
           String ssn) {
       super();
       this.fullname = fullname;
       this.phoneno = phoneno;
       this.datofBirth = datofBirth;
       this.ssn = ssn;
   }
  
   //Setters and getters
   public String getFullname() {
       return fullname;
   }
   public void setFullname(String fullname) {
       this.fullname = fullname;
   }
   public String getPhoneno() {
       return phoneno;
   }
   public void setPhoneno(String phoneno) {
       this.phoneno = phoneno;
   }
   public String getDatofBirth() {
       return datofBirth;
   }
   public void setDatofBirth(String datofBirth) {
       this.datofBirth = datofBirth;
   }
   public String getSsn() {
       return ssn;
   }
   public void setSsn(String ssn) {
       this.ssn = ssn;
   }
  
   //toString() method is used to display the contents of an object inside it
   @Override
   public String toString() {
       return "BankingCustomer Info # Fullname=" + fullname + " Phoneno=" + phoneno
               + " DatofBirth=" + datofBirth + " Ssn=" + ssn;
   }
  
}

_______________________________

TestClass.java(This class contains main() method.So we have to run this)

public class TestClass {

   public static void main(String[] args) {
      
       //Creating the BankCustomer class object by passing the arguments
       BankingCustomer bc=new BankingCustomer("kane Williams","9848425878","Oct-19-2010","1234-4567-5443");
      
       System.out.println(" _____Displaying Customer Info after modifying____");
       System.out.println(bc.toString());
      
       //Modifying the customer information
       bc.setPhoneno("9989345567");
       bc.setDatofBirth("Sept-21-2009");
       bc.setSsn("1234-5678-1356");
      
       System.out.println(" _____Displaying Customer Info after modifying____");
       System.out.println(bc.toString());

   }

}

________________________________________

output:


_____Displaying Customer Info after modifying____
BankingCustomer Info #
Fullname=kane Williams
Phoneno=9848425878
DatofBirth=Oct-19-2010
Ssn=1234-4567-5443

_____Displaying Customer Info after modifying____
BankingCustomer Info #
Fullname=kane Williams
Phoneno=9989345567
DatofBirth=Sept-21-2009
Ssn=1234-5678-1356

___________________________________

2)

BankAccount.java

public class BankAccount {
  
   //Declaring instance variables
   private int account_id;
   private int customer_id;
   private double amount_of_funds;
  
   //parameterized constructor
   public BankAccount(int account_id, int customer_id, double amount_of_funds) {
       super();
       this.account_id = account_id;
       this.customer_id = customer_id;
       this.amount_of_funds = amount_of_funds;
   }
  
   //Setters and getters
   public int getAccount_id() {
       return account_id;
   }
   public void setAccount_id(int account_id) {
       this.account_id = account_id;
   }
   public int getCustomer_id() {
       return customer_id;
   }
   public void setCustomer_id(int customer_id) {
       this.customer_id = customer_id;
   }
   public double getAmount_of_funds() {
       return amount_of_funds;
   }
   public void setAmount_of_funds(double amount_of_funds) {
       this.amount_of_funds = amount_of_funds;
   }
  
   //toString() method is used to display the contents of an object inside it
   @Override
   public String toString() {
       return "BankAccount# Account Id=" + account_id + " Customer Id="
               + customer_id + " Funds in account=" + amount_of_funds;
   }

}

___________________________________

Test.java(This class contains main() method.So we have to run this)

public class Test {

   public static void main(String[] args) {
   //Creating the object for BankAccount class object by passing the arguments
   BankAccount ba=new BankAccount(111,999,50000);
  
   System.out.println(" __Customer Info Before Modifying __");
   //Displaying the Customer information Before Modifying
   System.out.println(ba.toString());
  
   //modifying the customer_no and funds
   ba.setCustomer_id(123);
   ba.setAmount_of_funds(70000);
  
   System.out.println(" __Customer Info After Modifying __");
   System.out.println(ba.toString());

   }

}

____________________________________

output:


__Customer Info Before Modifying __
BankAccount#
Account Id=111
Customer Id=999
Funds in account=50000.0

__Customer Info After Modifying __
BankAccount#
Account Id=111
Customer Id=123
Funds in account=70000.0

____________Thank You