Using Java Look at the following requirement statement: The bank online offers t
ID: 3851689 • Letter: U
Question
Using Java
Explanation / Answer
The answer is as follows:
Th code is as follows:
#import java.io.*;
public class BankAccount {
private String name;
private int acct_no;
private double balance;
private float rate_of_intrest;
private String typeOfAccount; // can be savings account, checking account, or money market account
public void setName(String a){
name = a;
}
public void setAcctNo(int a){
acct_no = a;
}
public void setTypeOfAccount(String type){
typeOfAccount = type;
}
public void setRateOfIntrest(float rate){
rate_of_intrest = rate;
}
public String getName(){
return name;
}
public int getAcctNo(int a){
return acct_no = a;
}
public String getTypeOfAccount(){
String typeOfAccount = type;
}
public float getRateOfIntrest(){
return rate_of_intrest;
}
public void deposit(double amt){
balance = balance + amt;
cout << "Current Balance" << balance;
}
public void withdrawl(double amt){
if (amt > balance)
cout << "Transaction Failed: Insiufficient funds" << endl;
else
balance = balance - amt;
cout << "Current Balance" << balance;
}
public void getMonthlyStatement(){
// This function is not clearly stated as to what it has to implement.
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.