package teammemes.tritonbudget;

/**
 * Created by andrewli on 2/12/17.
 */

public class User {
    private String Name;
    private double Balance;
    private String Id;

    public User() {}

    public User(String name,double balance,String id) {
        Name = name;
        Balance = balance;
        Id = id;
    }

    public void setName(String name) {
        Name = name;
    }
    public String getName() {
        return Name;
    }
    public void setBalance(double Balance) {
        this.Balance = Balance;
    }
    public double getBalance() {
        return Balance;
    }
    public void setId(String id) {
        Id = id;
    }
    public String getId() {
        return Id;
    }
}

@@ -24,16 +24,140 @@
 nbudget;
+%0A//package com.example.andrewli.inputinformation;%0A%0Aimport android.content.Context;%0Aimport android.content.SharedPreferences;
 %0A%0A/**%0A *
@@ -283,236 +283,480 @@
 ate 
-String Id;%0A%0A    public User() %7B%7D%0A%0A    public User(String name,double balance,String id) %7B%0A        Name = name;%0A        Balance = balance;%0A        Id = id;%0A    %7D%0A%0A    public void setName(String name) %7B%0A        Name = name;%0A
+static User user=null;%0A    SharedPreferences prefs ;%0A    private User(Context context) %7B%0A        prefs= context.getSharedPreferences(%22user%22, Context.MODE_PRIVATE);%0A        Name = prefs.getString(%22name%22, %22user name not found%22);%0A        Balance = Double.parseDouble(prefs.getString(%22balance%22,%220.0%22));%0A    %7D%0A%0A%0A    public static User getInstance(Context context)%0A    %7B%0A        if(user==null)%0A        %7B%0A            user=new User(context);%0A   
     
+ 
 %7D%0A
+        return user;%0A    %7D%0A%0A
     
@@ -800,32 +800,33 @@
 urn Name;%0A    %7D%0A
+%0A
     public void 
@@ -832,72 +832,216 @@
  set
-Balance(double Balance) %7B%0A        this.Balance = Balance
+Name(String name) %7B%0A%0A        SharedPreferences.Editor editor = prefs.edit();%0A        editor.putString(%22name%22, name);%0A        editor.commit();%0A        Name = prefs.getString(%22name%22, %22fail to set name%22)
 ;%0A    %7D%0A
     
@@ -1028,32 +1028,33 @@
 t name%22);%0A    %7D%0A
+%0A
     public doubl
@@ -1092,32 +1092,33 @@
  Balance;%0A    %7D%0A
+%0A
     public void 
@@ -1124,32 +1124,43 @@
  set
-Id(String id
+Balance(double Balance
 ) %7B%0A
+%0A
         
 Id =
@@ -1159,74 +1159,242 @@
     
-Id = id
+SharedPreferences.Editor editor = prefs.edit()
 ;%0A    
-%7D%0A
     
-public String getId() %7B%0A        return Id
+editor.putString(%22balance%22, Double.toString(Balance));%0A        editor.commit();%0A        this.Balance = Double.parseDouble(prefs.getString(%22balance%22, %22fail to set balance%22))
 ;%0A    %7D%0A
 %7D%0A
@@ -1391,10 +1391,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

Update User.java