Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java public class Account extends Main { // data fields enum AccountType{Savings, CreditCard, Checking, Business;} public Account (double d, String CustomerID, double MaxCredit, String tokens,

Java

public class Account extends Main {

// data fields

enum AccountType{Savings, CreditCard, Checking, Business;}

public Account (double d, String CustomerID, double MaxCredit, String tokens, String BName, String BID, String CreditNo, String DebitNo, double ACCBalance, int ACCNumber)

{

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;

this.DebitNo = DebitNo;

this.BName = BName;

this.BID = BID;

this.CreditNo = CreditNo;

this.MaxCredit = MaxCredit;

}

private int ACCNumber;

private double ACCBalance;

private String CustomerID;

private String DebitNo;

private String BName;

private String BID;

private String CreditNo;

private double MaxCredit;

//Savings Account

public void Savings(int ACCNumber, String CustomerID, double ACCBalance)

{

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;

}

//Checking Account

public void Checkings(int ACCNumber, String CustomerID, double ACCBalance, String DebitNo)

{

this.ACCNumber = ACCNumber;

this.CustomerID = CustomerID;

this.ACCBalance = ACCBalance;

this.DebitNo = DebitNo;

}

//Business Account

public void Business (int 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 void CreditCard(String CustomerID, String CreditNo, double ACCBalance, double MaxCredit)

{

this.CustomerID = CustomerID;

this.CreditNo = CreditNo;

this.ACCBalance = ACCBalance;

this.MaxCredit = MaxCredit;

}

public String getCreditNo() {return CreditNo;}

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

public double getMaxCredit() {return MaxCredit;}

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

public String getDebitNo() {return DebitNo;}

public void setDebitNo(String 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 int getACCNumber() {return ACCNumber;}

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

public double getACCBalance() {return ACCBalance;}

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

public String toString() {

return "Account [ACCNumber=" + ACCNumber + ", ACCBalance=" + ACCBalance + ", CustomerID=" + CustomerID

+ ", DebitNo=" + DebitNo + ", BName=" + BName + ", BID=" + BID + ", CreditNo=" + CreditNo

+ ", MaxCredit=" + MaxCredit + "]";

}

}

public class Customer extends Main{

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 Customer(String string, String string2, String string3, String string4) {

// TODO Auto-generated constructor stub

}

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;}

public String toString() {

return "Customer [ID=" + ID + ", LName=" + LName + ", FName=" + FName + ", Address=" + Address + ", City=" + City

+ "]";

}}

import java.io.File; import java.io.IOException; import java.util.ArrayList;

import java.util.Scanner;

public class Main {

ArrayList customers;

ArrayList accounts;

public Main() {

customers = new ArrayList<>();

accounts = new ArrayList<>();

}

public void getDataFromFile(String dataset){

Q:In the main class, write a method getDataFromFile to read data frmo a given file. This method should read data frmo the file, create appropriate objects for teh customer and account, save the data into an array.

Write a method displayAccounts that displays all customers and their accounts information Make sure to properly format the output.

main : this method should be used to call all other methods and formatting output if necessary.

Use Scanner not the BufferReader.

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

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

1. PricewaterhouseCoopers

Answered: 1 week ago

Question

3. SCC Soft Computer

Answered: 1 week ago