Question: protected String name; protected ArrayList stocks; protected double balance; + Account ( String name, double balance) //stocks = new ArrayList () ; + get and

protected String name; protected ArrayList stocks; protected double balance; + Account ( String name, double balance) //stocks = new ArrayList() ; + get and set property for name; get method for balance + void buyStock(String symbol, int shares, double unitPrice ) //update corresponding balance and stocks ( stocks.add(new Stock(..)); ) + deposit(double amount) : double //returns new balance + withdraw(double amount) : double //returns new balance + toString() : String

@Override public String toString(){ StringBuffer str = new StringBuffer("Stocks: "); for (Stock s : stocks){ str.append(s.toString() + " "); } return "Name: " + name + ", balance: " + balance +"\t" + str.toString(); }

can anyone convert this to java?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!