Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package d3luxe.demo;
- import android.os.Bundle;
- import android.support.v7.app.AppCompatActivity;
- import java.util.ArrayList;
- import java.util.List;
- // user class - will have all atributes for a user : id,name,nickname,password and a list with transactions
- class User
- {
- public static int userID = 0;
- public String name;
- public String userName;
- public String password; //TODO: secure password using hashcode
- public List<Item> userItems = new ArrayList<Item>(); //items that user has
- public User(String Name,String UserName,String Password)
- {
- name = Name;
- userName = UserName;
- password = Password;
- 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
- }
- //functions for items
- public void AddItem()
- {
- }
- public void RemoveItem()
- {
- }
- public Item FindItem()
- {
- }
- }
- //TODO : item class will reprezent every item the user has , finish this class
- class Item
- {
- public static int itemID = 0; //every item should have an id
- public String itemName; //hardcoded here there it's a better way for protection
- public long itemCost;
- public int ownerID;
- public int keeperID;
- public Item(String ItemName,long ItemCost,int OwnerID,int KeeperID)
- {
- itemName = ItemName;
- itemCost = ItemCost;
- ownerID = OwnerID;
- keeperID = KeeperID;
- }
- //TODO: Think about what functions I need here
- }
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- List<User> usersList = new ArrayList<User>();
- User user1 = new User("Nume1","UserName","Parola1");
- usersList.add(user1);
- User index = usersList.get(0);
- System.out.println("Name :"+index.name);
- }
- }
Add Comment
Please, Sign In to add comment