Create an object-oriented and menu-driven java program

Assignment Help JAVA Programming
Reference no: EM131675606

Project Details

Background information and description

By definition, a shareholder owns one or more shares of stock in a public or private corporation. A shareholder may own shares in multiple companies, this is known as a portfolio. Shares of stock for the corporation are traded (bought and sold) on the stock market where the price of the stock fluctuates due to supply and demand. A shareholder is not able to trade shares of stock directly themselves but must use the services of an agent, commonly known as a broker or stockbroker, to trade the shares on their behalf. The broker charges the shareholder a fee for each of the trades they transact on their behalf.

In this assignment, your task is to create an object-oriented, menu-driven Java program that implements a limited set of functionalities (i.e., the program will not be a completely real-world implementation) that a broker can use to buy and sell shares for its customers, generate reports, and retrieve and save data in secondary storage

In general, your program will need to read data from the keyboard and from certain text files in secondary storage, store the data in appropriate data structures using objects, sort and search the data, and write output data to both the screen and to secondary storage. The specific functional requirements are described in section B(ii) of this document. The text files that are to be used for this assignment are described in section B(iii). The classes that must be used as a minimum are described in section B(iv).

B(ii) - Program Requirements/Functionality

The Java program must
a) be object-oriented utilising the classes described in section B (iv) as a minimum. Other classes may also be needed to solve the program requirements;

b) be menu-driven. The main menu must have the following menu items:

1. Trade Shares
2. Portfolio Report
3. Save
4. Exit Program

c) be able to process the defined text files. The text files and their formats are described in section B (iii).

Program Start Up

When the java program starts it must perform the following file related operations:

d) Read the data from the shareholder.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the shareholder text file and section B (iv) for a description of the shareholder class). If the shareholder file does not exist then the user should be informed of this and given the opportunity to provide an alternative filename that contains the shareholder data;

e) Read the data from the portfolios.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the portfolios text file and section B (iv) for a description of the Portfolio class). If the portfolios file does not exist then the user should be informed of this and given the opportunity to provide an alternative filename that contains the portfolios data;

f) Read the data from the shares.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the shares text file and section B (iv) for a description of the Shares class). If the shares file does not exist then the user should be informed of this and given the opportunity to provide an alternative filename that contains the shares data.

After processing these three files the program should display the main menu identified in section B(ii)(b) above.

The required functionality for each menu item is described as follows:

1. Trade Shares - when this menu option is selected the following actions should be performed by the program:
- Find the customer for which shares are to be traded
- Identify which share stock they wish to trade. If the customer already owns shares in the chosen company then shares may be either bought or sold. However, if they wish to trade in shares which they don't yet own then shares may only be bought.
- determine if the shares are to be bought or sold for the customer, and how many shares
- transact the trade (ensure your program takes into account all logical validation conditions when doing so).
- generate an on-screen summary of the trade. The summary of the trade must show the customer name and address, portfolio ID, current date, share code, company name, number of shares bought or sold, share price, total of the trade. Make sure that this is displayed in a clear and logical format on the screen.

2. Portfolio Report - when this menu option is selected the following actions should be performed:
- Determine if the report is for all customers or for a specific customer
- generate the Portfolio Report for either all customers or the specified customer. The Portfolio Report should have a similar layout to the following example:

3. Save - the program must write the portfolios data back to the Portfolios text file (customer and share data will not have changed so it doesn't need to be written back to the files).

4. Exit Program - the program must terminate when this menu item is selected. The program should not terminate until this option is chosen. If the portfolio data has changed since the last save then do not exit the program. Instead, warn the user that they should choose the Save option, then return program control to the main menu.

B(iii) - Text files to be processed
The data that is to be manipulated by your Java program for this assignment is contained in the text files
shareholders.txt, portfolios.txt, and shares.txt. Examples of these text files are found in the zip file for the

assignment. The data within these text files will need to be read into memory by your program so that it may be manipulated to solve many aspects of the required functionality of the assignment. The text files have been created to conform to a particular format. The format for each file is described below:

File: shareholders.txt
This file contains a full record of all customers for the broker. Each line within the file represents an individual customer, and has the following format:

Customer ID, Customer Name, Customer Address, Portfolio ID where each data item is separated by a comma (,).

A brief explanation of each of these data items:
Customer ID: a unique numeric identifier for a customer Customer Name: the customer name in the format: firstname surname Customer Address: the customer address
Portfolio ID: a unique identifier for the customer share portfolio Two (2) shareholders.txt file has been provided in the assignment zip file.
File: portfolios.txt
This file contains a full record of all portfolios for customers. Each line within this file represents an individual portfolio of shares for a shareholder, and has the following format:

Portfolio ID, [Sharecode, Number of shares] {10}

where each data item is separated by a comma (,). Note: A portfolio can have up to 10 different share stocks hence the Share Code and Number of shares may be repeated up to 10 times.

A brief explanation of each of these data items:
Portfolio ID: a unique identifier for the customer share portfolio
Sharecode: code used to identify the share stock
Number of Shares: the number of shares for the share held Two (2) portfolios.txt file has been provided in the assignment zip file.
File: shares.txt
This file contains a full record of all shares that can be traded by the broker. Each line within the file represents a share stock, and has the following format:

Sharecode, Company Name, price
where each data item is separated by a comma (,). A brief explanation of each of these data items:
Sharecode: code used to identify the share stock
Company Name: the name of the company of the share code
price: the closing price of the share stock One (1) shares.txt file has been provided in the assignment zip file.

Notes:

1. When reading the text files into memory the data should be read into appropriate array(s) of objects. The classes for these objects are briefly outlined in section B(iv).

2. For the purpose of marking the assignment the number of lines of data and the data values in the text files will be replaced with different data by the marker. This is to ensure that your solution has not relied upon specific data values or the number of lines in the text files to work. You should therefore test your program with different data files of varying length and varying data before submission.

B(iv) - Required Classes

To write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:
a) Shareholder
b) Portfolio
c) Share

These classes are described in general terms as follows:

a) Shareholder class: The Shareholder class represents an individual shareholder (customer). The Shareholder class needs data fields for the Customer ID, first name, surname, address, portfolio id. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the shareholder class is required to perform any other actions and implement the identified methods in the class.

b) Portfolio class: The Portfolio class represents a collection of one or more Shares that an individual Shareholder owns. The Portfolio class needs data fields for the Portfolio ID, Share Code, the number of shares. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the portfolio class is required to perform any other actions and implement the identified methods in the class. Note: A portfolio can have up to 10 different share stocks, hence the Share Code and number of shares may need to be stored up to 10 times.

c) Share class: The Share class represents an individual Share stock that is traded on the stock market by the broker. The Share class needs data fields for the Share Code, the Company name, the Share price. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the share class is required to perform any other actions and implement the identified methods in the class.

Attachment:- DataSet.rar

Verified Expert

The assignment was to develop a program for sharing of trades. Initially it should read data from three output files mainly shareholders.txt,shares.txt and portfolios.txt. It will then perform operations like trade share ,print portfolios ,save and exit. If a share is already present in a customer portfolio ,it can either buy or sell shares. But if a particular share is not found it can only buy that share. Before exiting the program, changes made to portfolio has to be saved.

Reference no: EM131675606

Questions Cloud

Explain the serial position effect in free recall : How can the Modal Model of Memory be used to explain the serial position effect in free recall
Is the appointment and removal provision constitutional : If the BRB is not following the overall policy directions of the president can he/she disclaim responsibility for agency action and/or inaction?
Define compensation claim of the medical bills : Pierce filed a compensation claim in September 2002, and Fullilove paid his medical bills. In October 2002, Fullilove sued Pierce for reimbursement.
What elements are required to conduct an inventory search : What elements are required to conduct an inventory search properly, When is an investigatory stop and search of a vehicle allowed
Create an object-oriented and menu-driven java program : 300581: Programming Techniques - create an object-oriented, menu-driven Java program that implements a limited set of functionalities
Identify which theory you relate to most and explain why : Outline the main components of person-centered theory that contribute to personality development. Identify which theory you relate to most, and explain why.
Discuss society reduce the number of violent criminal acts : When it comes to crime causation what do you believe society should do to reduce the number of violent criminal acts. Can the local, state
Evaluate the way the company treats its employees : Evaluate the way the company treats its employees, suppliers, and customers Create an analysis of the ethical theories.
How the information provided in question supports your point : Explain how the information provided in question three supports your point. How does this information also support the overall argument in your essay?

Reviews

len1675606

10/11/2017 6:55:02 AM

F. Marking Criteria and Standards The marking criteria and standards for the assignment are published on pages 12-15 of section 2.5.2 in the Learning Guide and will be used to assess your assignment submission according to the specific weightings identified in the table below Code Functionality/Correctness: 55% Code Documentation: 5% Class Construction 20% Identifier Use: 5% Algorithm Selection: 10% Code Readability: 5%

len1675606

10/11/2017 6:54:52 AM

D. Referencing Referencing must follow the guidelines given on page 8 in Section 2.5.1 of the unit Learning Guide. E. Project Submission Procedure To submit your assignment you must do the following by the due date and time specified on page 1 of this document: 1. Create a zip file which contains a. your complete Java project including the Java source code file(s). Note: The zip file must be named according to the naming convention studentid_StudentName_300581_Project_TutorsName.zip where studentid is your student id, and StudentName is your full name, TutorsName is the name of your tutor. 2. Upload the above zip file in vUWS in the Project Submission link provided.

len1675606

10/11/2017 6:54:42 AM

C. Google Java Style Guide The submission in this assignment must adhere to the following listed coding standards as defined in the Google Java Style Guide that is found at https://google.github.io/styleguide/javaguide.html Style Guide Item Number Changes to Modification 2.1 to 2.3 2.1 modified 2.1 - File Name: The source file name consists of the case-sensitive name of the top-level class it contains as identified in the question, plus an underscore, plus the student ID, plus the .java extension Example: Share_12345678.java 3.1 to 3.4.1 3.1 modified 3.1 – License Info is replaced by Authorship information All java source files must contain the authorship information as follows: Student ID: Name: Campus: Tutor Name: Class Day:

len1675606

10/11/2017 6:54:22 AM

g) ensure that standard Input/Output are used in all code segments, do not use Swing; h) ensure that your java code is appropriately modularised for the given problem definition. That is, you need to write appropriate classes and methods to solve the problem; i) not use any dynamic data structures such as arraylists. If you are unsure if you can use a particular data structure check with the unit coordinator first; j) reference all sources that you used for inspiration of your solution as per Section D of this document; k) Ensure that your java code compiles and runs in Eclipse 4.6.3 (Neon.3)

len1675606

10/11/2017 6:54:15 AM

For the problem definition described in section B you must d) include your student id at the end of all filenames for all java code file. Three classes have been identified in section B as being required as part of your solution. Do not modify the names of these classes except for adding your student id to the end of the filename. Other Java files will be needed as part of your solution. All Java code files that are used in this assignment MUST have your student id appended to the filename. For example, Shareholder_########.java; e) include your authorship details at the top of each file in code comments (see item 3.1 in Section C of this document for details); f) adhere to the coding standard as identified in the Google Java Style Guide (see Section C of this document for details);

len1675606

10/11/2017 6:53:58 AM

a) ALL instructions given in this document MUST be followed in order to be eligible for full marks for the assignment. This document has eleven (11) pages. b) This assignment is NOT a group assignment; collusion, plagiarism, cheating of any kind is not acceptable. As part of your submission you MUST certify that all work submitted is your own. If you cannot honestly certify that the work is your own then do not submit the assignment. Breaches of the Misconduct Rule will be dealt with according to the university Rule (see the learning guide for more information). c) All assignment submissions will be checked for academic misconduct by the use of the MOSS program from Stanford University. Details on MOSS can be obtained from the MOSS web site http://theory.stanford.edu/~aiken/moss/

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd