The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
package diw20Midterm_Bank;
import java.util.Random;
public class Account {
private int accountId;
private double balance;
private String accountType;
private String accountStatus;
private TransactionLog tranLog;
private int depositCount = 0;
private final int DEPOSIT_BONUS = 10;
private final int WITHDRAWAL_FEE = 30;
final int LOWER_BOUND = 1;
final int UPPER_BOUND = 100000000;
Random r = new Random();
public Account(int accountId, double initialBalance, String accountType){
/* Initialize class properties */
this.balance = 0;
this.accountType = "checking";
this.accountStatus = "active";
tranLog = new TransactionLog();
this.accountId = 1;
}
public Account(int accountID, double initialBalance, String accountType, String accountStatus ){
accountType = "checking";
accountStatus = "active";
accountId = 1;
balance = initialBalance;
}
/* The code below generates a random number between 1 and 100000000 - that number becomes accountID */
public void accountId(int accountId, String tranLog){
final int LOWER_BOUND = 1;
final int UPPER_BOUND = 100000000;
Random r = new Random();
this.accountId = r.nextInt(UPPER_BOUND-LOWER_BOUND) + LOWER_BOUND;
tranLog = "" + this.accountId;
}
public void setAccountId(int accountId) {
this.accountId = accountId;
}
public void setBalance(double balance) {
this.balance = balance;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public void setAccountStatus(String accountStatus) {
this.accountStatus = accountStatus;
}
public void setTranLog(TransactionLog tranLog) {
this.tranLog = tranLog;
}
public void setDepositCount(int depositCount) {
this.depositCount = depositCount;
}
public void setR(Random r) {
this.r = r;
}
public void deposit(double amount, String tranLog){
if (amount > 10000){
this.balance += amount;
tranLog = "deposit, Amount reported to IRS " + amount + "Balance is " + this.balance;
}else{
this.balance += amount;
tranLog = "deposit, " + amount + " " + this.balance;
}
}
public void withdraw(double amount, String tranLog){
if (this.balance > amount){
this.balance -= amount;
tranLog = "withdraw " + amount + " " +this.balance;
}else{
this.balance = this.balance - WITHDRAWAL_FEE;
tranLog = "Negative balance fee included in " + this.balance;
}
}
public void depositCount(int counter){
//Counter
counter = 0;
counter++;
while( counter%5 == 0);
balance += DEPOSIT_BONUS;
}
public int getAccountID() {
return accountId;
}
public double getBalance() {
return balance;
}
public String getAccountType() {
return accountType;
}
public String getAccountStatus() {
return accountStatus;
}
public TransactionLog getTranLog() {
return tranLog;
}
public int getDepositCount() {
return depositCount;
}
public Random getR() {
return r;
}}
Two other classes:package diw20Midterm_Bank;
public class TransactionLog {
public String logText;//Told by Julio 10/24 to keep public per instruction not to change Transaction Log
public TransactionLog(){
logText = "";
TransactionLog = logText + tranLog.accountId + tranLog.withdraw + " " + tranLog.deposit + " " + tranLog.depositCount;
/**7 requirements?
* logText.accountID + logText.balance + if > 10,000$ then "IRS"
* + fifth transactionBons + log String(tranaction) + transactionType
*/
}
public void log(String transaction){
logText += "n" + transaction;
}
public String getLog(){
//get logText from withdrawal, deposit, accountId, Account(account type, account status,)
/**
* private int accountID;
private double balance;
private String accountType;
private String accountStatus;
private TransactionLog tranLog;
final int DEPOSIT_BONUS = 10;
private int depositCount = 0;
get balance(withdrawal,deposit, amount, ),account(type, status, id,)
*/
return logText;
}
}
INFSCI 0017 – Fundamentals of Object-Oriented Programming (Fall 2016)Midterm Take-Home Assignment●This assignment is the take-home portion of your midterm (50%).●This is an individual assignment - you are not allowed to discuss this assignment with your classmates,TAs, or the instructors.In other words, you are not allowed to receive any outside help on the take-home portion of your midterm.●Due onWednesday, October 26th, by midnight.●All classes and methods must be documented using JavaDoc style comments●You must format your code so that it is properly indented.●All classesmustfollow the same basic code structure:○Properties’ declarations○Constructors○Methods○Getters and SettersThe Terrible Story of an IncompetentDeveloperJim’s bank finally decided to move with the times and implement an online bankingsystem.The bank’s IT director hired Mr. John Doe to design, develop, and deployan electronic banking system.Unfortunately Mr. Doe had a drinking problem - heoften came to work heavily inebriated and did not follow provided requirements.Mr. Doe made a number of omissions and mistakes in his program.He waseventually fired and the software remained unfinished.It is your job to follow therequirements listed below to fix and finish this project.Requirements / Instructions●Download Midterm_Bank project from CourseWeb (Course Documents → Midterm)●Rename the project to YourPittID_Bank.You must use Eclipse’s “Refactor” feature to rename yourproject.●Review the provided classes and compare them with the UML class diagrams listed below.Fix theprovided project so that all classes, properties, and methods match the class diagrams (this includesnaming conventions, visibilities, return data types, etc…)BankTest+main():voidTransactionLog-logText:String+log(String transaction)+getLog(): String1
-----------