NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//BankAccount.java

public class BankAccount {
public int balance;
public final String accountNumber;
public String transactionLog;

public BankAccount(String accountNumber) {
this.accountNumber = accountNumber;
this.balance = 0;
this.transactionLog = "why the fuck did this print 4 times?";
}

public String report() {
// FILL ME IN
//this.report();
//I FEEL LIKE THIS IS NEEDED BUT IS IT? I MADE THIS BTW -- this.report() = transactionLog;
//String report = new String;
String report = transactionLog;
//this.report();

//System.out.println(report);
System.out.println(report);
System.out.println("Balance: $" + balance);
return report;
}

public int getBalance() {
// FILL ME IN!
System.out.println(balance);
return balance;
//return 0;
}

public void transfer(int transferAmount, BankAccount fromAccount) {
// FILL ME IN!
//Im just fucking around and experimenting with this new method

if(transferAmount < 0 || transferAmount >= fromAccount){
fromAccount = fromAccount;
}



//balance = transferAmount - balance;


}

//withdrawal is basically done
public void withdraw(int withdrawalAmount) {
if(withdrawalAmount > 0 && withdrawalAmount <= balance){
balance -= withdrawalAmount;
}
else{
balance = balance;
//System.out.println("No sufficient funds");
}
}

public void deposit(int depositAmount) {
// FILL ME IN!
if (depositAmount > 0){
balance += depositAmount;
System.out.println("Deposit: $" + depositAmount);
}
else {
System.out.println("Deposit: $0 ");
}


}

}

//Main.java

public class Main {

public static void main(String[] args) {
// Feel free to add more to this to test things out.
// You will be graded by the automatic tests you get from "Run Tests"

BankAccount b1 = new BankAccount("abc");
BankAccount b2 = new BankAccount("123");
b1.deposit(300);
b2.deposit(400);
b1.transfer(150, b2); // should remove 150 from b2 and put it in b1

//b1.withdraw(50000);


//b1.getBalance();

// Should show a deposit, a move from b1, and a final balance of 450
System.out.println(b1.report());
// Should show a deposit, a move to b1, and a final balance of 250
System.out.println(b2.report());
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.