Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Class Customer public class Customer{ private String ID; private String LName; private String FName; private String Address; private String City; public Customer(String ID, String

1. Class Customer

public class Customer{

private String ID;

private String LName;

private String FName;

private String Address;

private String City;

public Customer(String ID, String LName, String FName, String Address, String City)

{

this.ID =ID;

this.LName = LName;

this.FName = FName;

this.Address = Address;

this.City = City;

}

public String getID() {return ID;}

public void setID(String iD) {ID = iD;}

public String getLName() { return LName;}

public void setLName(String LName) {this.LName = LName;}

public String getFName() {return FName;}

public void setFName(String FName) {this.FName = FName;}

public String getAddress() {return Address;}

public void setAddress(String Address) {this.Address = Address;}

public String getCity() {return City;}

public void setCity(String City) {this.City = City;}}

2. Class Account

public class Account {

// data fields

private String ACCNumber;

private double ACCBalance;

private String CustomerID;

private int DebitNo;

private String BName;

private String BID;

private int CreditNo;

private double MaxCredit;

//Savings Account

public Account(String ACCNumber, String CustomerID, double ACCBalance) {

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;}

//Checking Account

public Account(String ACCNumber, String CustomerID, double ACCBalance, int DebitNo)

{

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;

this.DebitNo = DebitNo;

}

//Business Account

public Account (String ACCNumber, String CustomerID, double ACCBalance, String BName, String BID)

{

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;

this.BName = BName;

this.BID = BID;

}

//Credit Card Account

public Account(String CustomerID, int CreditNo, double ACCBalance, double MaxCredit)

{

this.CustomerID = CustomerID;

this.CreditNo = CreditNo;

this.ACCBalance = ACCBalance;

this.MaxCredit = MaxCredit;

}

public int getCreditNo() {return CreditNo;}

public void setCreditNo(int CreditNo) {this.CreditNo = CreditNo;}

public double getMaxCredit() {return MaxCredit;}

public void setMaxCredit(double MaxCredit) {this.MaxCredit = MaxCredit;}

public int getDebitNo() {return DebitNo;}

public void setDebitNo(int DebitNo) {this.DebitNo = DebitNo;}

public String getBID() {return BID;}

public void setBID(String BID) {this.BID = BID;}

public String getBName() {return BName;}

public void setBName(String BName) {this.BName = BName;}

public String getCustomerID() {return CustomerID;}

public void setCustomerID(String CustomerID) {this.CustomerID = CustomerID;}

public String getACCNumber() {return ACCNumber;}

public void setACCNumber(String ACCNumber) {this.ACCNumber = ACCNumber;}

public double getACCBalance() {return ACCBalance;}

public void setACCBalance(double ACCBalance) {this.ACCBalance = ACCBalance;}

if the Account type is Checking, the order is CustomerID, LName, FName, Address,City, Account Type, ACCNumber, ACCBalance, DebitNo.

if the Account type is Savings, the order is CustomerID, LName, FName, Address, City, Account Type, ACCNumber, ACCBalance.

if the Account type is Business, the order is CustomerID, LName, FName, Address, City, Account Type, ACCNumber, ACCBalance, BName, BID.

if the Account type is CreditCard, the order is CustomerID ,LName, FName, Address, City, Account Type, CreditNo, ACCBalance, MaxCredit.

This should be in the main class using getDataFromFile method to read data from the .txt file. Create appropriate objects for the customer and account classes, save the data into an array.

This is the .txt file i that i have to use it.

Assume that this file is in D:\\Chegg\\Java\\getAccountData.txt

C8392380567 Sage, Amy Ping Ting Road Edmonton Checking 873387 5000 0000-6666-6666-6666

C8954385123 Lee, Bob Texaco Road Calgary Savings 827366 9480

C2389490434 Neil, Carson Deerfoot Trail Otawa Business 763655 65000 Emporia LLC 87-927736

C9384899234 Ko, David Unversity Drive Stillwater CreditCard 7667-9899-8776-1234 430 4000

C0930238083 Warren, John Ogden Road Tyler Checking 726615 1230 0000-2222-2222-2222

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions