” 辅导16:332:503程序、 写作Management System程序16:332:503 Project: Account Management SystemPlease read the project description very carefully:For this project, you will be writing an account management system which willmanage a stock portfolio account and a bank account.Please use an inheritance structure for the classes used in the program. Create anabstract base class Account that has two derived classes StockAccount andBankAccount.The StockAccount and BankAccount information should be connected to eachother through CASH BALANCE.Stock portfolio account and Bank Account will share a common initial balance of10000$ available in your bank account. This balance keeps changing as thetransactions goes on.Stock Portfolio AccountFor the stock portfolio account portion, you will need to use stock informationstored in Results.txt files to create a portfolio managing system. (There are twofiles of result.txt attached with the project description. This is to mimic thechanges in stock prices. The two files have same stock symbols with differentprices. Hence your program should randomly choose one stock value from one ofthe two given files for all the transactions. That is, you need to choose a randomvalue from one of the two files whenever(!) you need to read a stock value,including when you do sorting operation. Feel free to generate as many of yourown txt files or you may pull real time data from any financial websites.)This portfolio system needs to store the account information in text files so thatwhen the program is closed the account information does not get lost. Each timethe program is run, it needs to read the current account information from the textfiles. Whenever a transaction is made, please store the information in a text file(See below for more details). Whenever the program exits, store the totalportfolio value and current cash balance along with the current date and time in aseparate text file to keep a record of the history of the portfolio values (to be usedwhen graphing the history of portfolio values). This file will be accessed by bothBankAccount and StockAccount class. The common purpose of both theaccounts is to access the current cash balance information in this file. Wheneverthe program exits and starts again, it shall use this updated balance and not theinitial balance of $10000.You must use a doubly linked list in the StockAccount class to store theportfolio stock information. Each node should contain the stock symbol and thenumber of shares of that stock in the portfolio. Please implement the doublylinked list yourself (dont use STL). You can use your implementation from thehomework assignment. You can use whatever data structures (including STLstructures) you want for the other data used in the program, but please usedoubly linked lists for the portfolio stock information.You must keep your stock portfolio in the doubly linked list sorted at all times inthe decreasing order of the total value of any particular stock (i.e. number ofshares * price per share). That is, after any update on your stock portfolio, youneed to check and maintain the doubly linked list so as to keep it sorted.To implement the sorting, do not copy the values into a different data structureand then sort it. The doubly linked list must be sorted in place, that is, bychanging the links of nodes in the list.You are required to use at least two Design Patterns learned in class in yourprogram. You need to write clear comments in your program to highlight the useof the design patterns, and Explain them in your written project description. Youshould be creative in using design patterns for your project for example, youcan allow the user to choose/change to different sorting methods to keep yourlinked list in order, and use a design pattern to implement this.Your program should be able to perform the following:1. Display the price of a stock Display the price for a stock symbol based onthe information obtained randomly from one of the two Results.txt files. The userwould enter a stock symbol (that is contained in the Results.txt) and the programwill return a price per share. If the symbol is not found, return that the symbolcannot be found.Example:Company-Symbol Price per shareGOOG $577.492. Display the current portfolio The cash balance and information about thestocks in the portfolio should be displayed in the order of the sorted list. Foreach stock please display the symbol, the number of shares owned, the price pershare (based on the value from Results.txt), and the total value of that stock.Please also display the total value of the portfolio.Example:Cash balance = $5000CompanySymbol Number PricePerShare TotalValueGOOG 10 $577.49 $5774.90MSFT 100 $30.00 $3000.00Total portfolio value: $13774.903. Buy shares The user will send a request to buy shares of a stock. The usershould enter the ticker symbol of the stock he/she wants to buy, enter the amountof shares he/she wants to buy and the maximum amount he/she is willing to payfor each share of the stock (the limit). If the user has entered a stock purchaseamount that is more than his or her current cash balance in bank account, thetransaction should fail and the program should print out the reason.Each time the user requests to buy shares, the stock pricing information fromResults.txt should be consulted (or you can just store the information into a datastructure upon the start of the program and use that data structure whenever youneed the information). If the stock ticker is not found in the text files, the programshould print that the stock is not available. If the cost per stock is higher than theamount the user is willing to pay, the transaction should fail and the programshould print out the reason the transaction failed.If the transaction goes through, the cost of the transaction should be deductedfrom the bank cash balance and the stock that has been purchased should beadded to the portfolio. Make sure to use the price of the stock that is in theResult.txt file when updating the portfolio. If the user already has that stock in hisor her portfolio, add the number of shares purchased to that entry instead ofcreating a new entry (remember, you want to use a linked list to store theinformation).The program should display on the screen the information from the transactionthat has taken place. Please add this transaction to thestock_transaction_history.txt file. You also need to add a withdrawal transactionto your bank account transaction history for this buying operation.4. Sell shares The user will Send a request to sell shares of a stock. The usershould enter the ticker symbol of the stock he/she wants to sell, the amount ofshares he/she wants to sell and the minimum amount he/she wants to sell eachshare of the stock for. If the user has entered a stock that is not in the portfolio,or if there are insufficient shares in the portfolio, the program should display thisand the transaction should fail.Each time the user requests to sell shares (and the shares are available), thestock pricing information from Results.txt should be used. If the price per stock islower than the amount the user is willing to sell for, the transaction should fail andthe program should print out the reason the transaction failed.If the transaction goes through, the amount obtained from the sell transaction should be added to the bank cash balance and the shares that have been soldshould be subtracted from the portfolio. If the number of shares of the stock is 0,the stock should be removed from the portfolio. Make sure to use the price of thestock that is in Results.txt when updating the portfolio. The program shoulddisplay the information from the transaction that has taken place. Please add thistransaction to the stock_transaction_history.txt file. You also need to add adeposit transaction to your bank account transaction history for this sellingoperation.5. View a graph for the portfolio value As mentioned earlier, when theprogram exits, the total portfolio value should be stored in a text file along withthe date and time. The total portfolio value is the sum of your current cashbalance and money worth of the stocks you own. Make sure that you use boththe Results.txt files for buy/sell transactions, so that the total portfolio valuekeeps changing and not always constant. Plot the variation in the value of theportfolio over a period of time. Use MATLAB to plot the graph.You can use any period of time and the only information you need to display is thechange in total value of the portfolio. The following code below shows two ways toprint out the time:#include time.htime_t seconds;seconds = time(NULL);coutThe number of seconds since January 1, 1970 is: seconds\n;tm * timeinfo;timeinfo = localtime(seconds);coutThe current local time and date is:asctime(timeinfo);Please look at this code to See how to obtain time information.6. View transaction history The buy and sell transaction should be saved instock_transaction_history.txt. If the user chooses this option, the transactionhistory should be printed in order of transaction time.Example:Event CompSymbol Number PricePerShare TotalValue TimeBuy GOOG 10 $577.49 $5774.90 09:40:07Buy MSFT 100 $30.00 $3000.00 13:37:00Sell MSFT 50 $20.00 $1000.00 14:39:21Bank AccountThe bank account portion is simpler than the stock portfolio part.The bank account should initially have a balance of $10,000. The amount in thebank account should be stored in a text file upon exit so that it can be retrievedthe next time the program starts. Save all transaction history inbank_transaction_history.txt.As indicated before, when you buy or sell stock shares, money will come out of orgo into your bank account. These activities should all be recorded in your bankaccount transaction history (as withdrawal or deposit, respectively).Please have the following options:1. View account balance Prints out the account balance.2. Deposit Money The user selects the amount of money to deposit. Thisamount should be added to the balance.3. Withdraw Money The user selects the amount of money to withdraw. If thebalance of the account is not sufficient to withdraw the amount, please print outan error.4. Print out history – The program should print out the history of transactions onthe account in order of transaction time.Example:Event Amount Date BalanceDeposit $500.00 11/05/2009 $10,500Withdrawal $1000.00 11/06/2009 $9,500Deposit $1500.00 11/07/2009 $11,000(Here we assume there is no stock transaction in this example; otherwise, stocktransactions should also be printed for the bank account.)Extra creditCreate a graphical user interface (GUI) for the program. You can use whateverC++ libraries (such as MFC, QT or fltk) you choose to do this. If you decide to dothis please create it in a separate project (in FinalProject_gui_yourname.zip) andalso submit the non-graphical version of the program. (up to 20 extra points)Submission Guidelines1. Give a brief description of your project, the functions you have implemented,data structures used, text files used or created and for what purpose and anyother descriptions of your project. If you made any extra features for the programplease clearly state it. Include the Description in a Word file.2. For the submission, please submit the entire project folder in a zip/rar file,FinalProject_yourname.zip. Make sure you comment your code. Your visual studioproject should be named FinalProject_yourname. Please make sure all the cppfilenames have your name in it.3. Do not copy code from ANY other people. The project should be yourown work. Otherwise, you will FAIL the course.Sample Program OutputWelcome to the Account Management System.Please select an account to access:1. Stock Portfolio Account2. Bank Account3. ExitOption: 1Stock Portfolio AccountPlease select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the portfolio value6. View transaction history7. Return to previous menuOption: 1Please enter the stock symbol: GOOG Company Symbol Price per shareGOOG $577.49Please select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the portfolio value6. View transaction history7. Return to previous menuOption: 3Please enter the stock symbol you wish to purchase: GOOG Please enter thenumber of shares: 10Please enter the Maximum amount you are willing to pay per share: 580You have purchased 10 shares of GOOG at $577.49 each for a total of$5774.90.Please select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the portfolio value6. View transaction history7. Return to previous menuOption: 3Please enter the stock symbol you wish to purchase: MSFT Please enter thenumber of shares: 100Please enter the maximum amount you are willing to pay per share: 30You have purchased 100 shares of MSFT at $30 each for a total of$3000.00Please select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the portfolio value6. View transaction history7. Return to previous menuOption: 2Cash balance = $1225.10Company-Symbol Number Price-per-share Total valueGOOG 10 $577.49 $5774.90MSFT 100 $30.00 $3000.00Total portfolio value: $10000.00Please select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the Portfolio value6. View transaction history7. Return to previous menuOption: 6Event Company Symbol Number Price per share Total value TimeBuy GOOG 10 $577.49 $5774.90 13:14:15Buy MSFT 100 $30.00 $3000.00 13:37:42Please select an option:1. Display the price for a stock symbol2. Display the current portfolio3. Buy shares4. Sell shares5. View a graph for the portfolio value6. View transaction history7. Return to previous menuOption: 7Please select an account to access:1. Stock Portfolio Account2. Bank Account3. ExitOption: 2Bank AccountPlease select an Option:1. View account balance2. Deposit money3. Withdraw money4. Print out history5. Return to previous menuOption: 2Please select the amount you wish to deposit: $1000Please select an option:1. View account balance2. Deposit money3. Withdraw money4. Print out history5. Return to previous menuOption: 11. You have $2225.10 in your bank account.请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。