Untitled

mail@pastecode.io avatar
unknown
java
9 days ago
614 B
0
Indexable
Never
public class MoneyTracker{
  public String name;
  public double cb;
  
  public String info(){
    return ("Name: "+name+"\n"+"Current Balance: "+cb);
  }
  
  public void createTracker(String a){
    name=a;
    cb++;
  }
  public void income(int n){
    System.out.println("Balance Updated!");
    cb +=n;
  }
  public void expense(int m){
    if(cb-m ==0){
      System.out.println("You're broke!");
    }
    else if(cb<m){
      System.out.println("Not enough balance.");
    }
    else{
      cb -=m;
    System.out.print("Balance Updated");
    
  }
  public void showHistory(){
Leave a Comment