Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How would you write this code?

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How would you write this code?

    Hi there so I have been working on a programming assignment dealing with stocks. Here is what we have to do for the program:

    You will need to use files, arrays, and classes stock, customer, and broker.

    Modify the broker class read input files called stock.dat and customer.dat

    The first line in stock.dat has an integer that indicates how many stocks are described in the file.

    Subsequently, each stock is described as follows, one stock description per line.

    Stock label (String) initial volume (int) price (double)

    Modify the stock class and create stock objects (in Broker) from the descriptions read from the stock.dat file.

    The first line in customer.dat has an integer that indicates how many customers are described in the file.

    Subsequently, each customer is described as follows, one customer at a time

    Customer Name Account Balance on the top line:

    Modify the customer class and create customer objects (in Broker) from the descriptions read from the customer.dat file. Note that all customers
    start with empty portfolio and can have a portfolio that contains many different stocks – as many as described in the stock.dat class.

    Then,

    First – displays the Current state of all the stocks. Then displays the all the customers and their portfolio.

    Then, provide a menu for the user to:

    Select a customer, view their portfolio and or trade stocks as in 3(b).

    Until the session is terminated when exit option.

    Finally – display the current state of all the stocks. Then display all the customers and their current portfolio.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: How would you write this code?

    Improving the world one idiot at a time!

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How would you write this code?

    Please do not duplicate posts. I am locking this thread

Similar Threads

  1. how to write code using servlets, jsp and mysql database
    By bvn456 in forum Java Theory & Questions
    Replies: 4
    Last Post: June 28th, 2011, 01:51 PM
  2. Beginner trying to write Java code, has issue w/ printing result and 2 decimals
    By flpanthers1 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 5th, 2011, 11:11 AM
  3. Trying to write Factoring Numbers Code--Please Help.
    By uks2h in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 11th, 2010, 08:20 PM
  4. Replies: 0
    Last Post: March 5th, 2010, 01:32 AM
  5. How can i write this in code?
    By Mr. steve in forum Java Theory & Questions
    Replies: 2
    Last Post: November 30th, 2009, 10:07 PM