讲解:Java:CS300581 ShareholderJava

代写Java作业,实现一个菜单管理的商店管理系统的应用程序。Project DetailsBackground information and descriptionBy 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).Program Requirements/FunctionalityThe Java program musta) 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:Trade SharesPortfolio ReportSaveExit Programc) be able to process the defined text files. The text files and their formats are described in section B (iii).Program Start UpWhen 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.Main Menu Item FunctionalityThe required functionality for each menu item is described as follows: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 tradedIdentify 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 sharestransact 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.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 customergenerate the Portfolio Report for either all customers or the specified customer.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).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, thJava代写:CS300581 Shareholder代做Java实验en return program control to the main menu.Text files to be processedThe 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.txtThis 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.txtThis 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.txtThis 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: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).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.Required ClassesTo write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:a) Shareholderb) Portfolioc) ShareThese 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.Apart from the above three classes it is possible that you will also need to write other classes depending upon your solution method.转自:http://ass.3daixie.com/2019012924649889.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 218,525评论 6 507
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,203评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,862评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,728评论 1 294
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,743评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,590评论 1 305
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,330评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,244评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,693评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,885评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,001评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,723评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,343评论 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,919评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,042评论 1 270
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,191评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,955评论 2 355

推荐阅读更多精彩内容