Hi, I need to write a system that simulates buying and selling on the stock market with just text outputs. I need to create a menu so the user can register and delete thier account. Also be able to buy and sell shares.
So far I have my classes and attibuttes
public class User
{
private int Id;
private String name;
private double trade;
}
public class Share
{
private String code;
private int quantity;
private double price;
}
public class Trade
{
private LinkedList<Share> shares = new LinkedList<Share>();
private LinkedList<User> users = new LinkedList<User>();
}
My plan is to create the users and shares in the Trade class, and write the methods for register, delete, sell and buy in the trade class as well. I will then call these methods in a Menu class.
I'm not sure if this is the right appoarch in writing this program. Can you guys help me if my classes and attributes are right thanks.