Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.04 KB | None | 0 0
  1. package d3luxe.demo;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5.  
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. // user class - will have all atributes for a user : id,name,nickname,password and a list with transactions
  10. class User
  11. {
  12.      public static int userID = 0;
  13.      public String name;
  14.      public String userName;
  15.      public String password; //TODO: secure password using hashcode
  16.      public List<Item> userItems = new ArrayList<Item>(); //items that user has
  17.      public User(String Name,String UserName,String Password)
  18.      {
  19.          name = Name;
  20.          userName = UserName;
  21.          password = Password;
  22.          userID++;                   //TODO: find another way to decide userId , after an user it;s deleted I still need to use that id because I don't want big numbers
  23.      }
  24.      //functions for items
  25.      public void AddItem()
  26.      {
  27.  
  28.      }
  29.      public void RemoveItem()
  30.      {
  31.  
  32.      }
  33.      public Item FindItem()
  34.      {
  35.  
  36.      }
  37. }
  38. //TODO : item class will reprezent every item the user has , finish this class
  39. class Item
  40. {
  41.     public static int itemID = 0; //every item should have an id
  42.     public String itemName; //hardcoded here there it's a better way for protection
  43.     public long itemCost;
  44.     public int ownerID;
  45.     public int keeperID;
  46.     public Item(String ItemName,long ItemCost,int OwnerID,int KeeperID)
  47.     {
  48.         itemName = ItemName;
  49.         itemCost = ItemCost;
  50.         ownerID = OwnerID;
  51.         keeperID = KeeperID;
  52.     }
  53.     //TODO: Think about what functions I need here
  54. }
  55. public class MainActivity extends AppCompatActivity {
  56.  
  57.     @Override
  58.     protected void onCreate(Bundle savedInstanceState) {
  59.         super.onCreate(savedInstanceState);
  60.         setContentView(R.layout.activity_main);
  61.         List<User> usersList = new ArrayList<User>();
  62.         User user1 = new User("Nume1","UserName","Parola1");
  63.         usersList.add(user1);
  64.         User index = usersList.get(0);
  65.         System.out.println("Name :"+index.name);
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement