Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++, If you need more information I can provide more. Please. BuyStuckCinspel BuyStockCmd.pdf 1/2 | - 100% + + PROGRAMMING PROJECT #2: BUY STOCKS

In C++, If you need more information I can provide more. Please.

image text in transcribedimage text in transcribedimage text in transcribed

BuyStuckCinspel BuyStockCmd.pdf 1/2 | - 100% + + PROGRAMMING PROJECT #2: BUY STOCKS USING COMMAND Objectives: Use basic CH constructs it, switch, and repetition (looping) Perform simple data type manipulations Solve problem, design solution and implement using C++ Deline C++ class and create and manage a list of objects Description: Improve and enhance your "BuyStocks.cpp' and name it as "BuyStockCmd' that uses commands instead of menu with the following changes: 1. Accept a command line argument which is the purchase data file in the following format: number of shares stock syrntol price per shares Here is an example of the data file: 100 INTC 30.13 200 CSCO 24.00 50 IBM 130.00 100 AAPL 94.28 2. Define a new C++ 'Stock" class that manages a stock price number of share and stock symbol 3 The program will read and process the following user-entered commands "buy" buy a stock by asking for the stock symbol, quantity and share price "display display all purchases summary display only the summary of purchase total and number of purchases find = Spurchase-amount> display all purchases >= the given amount help display this help me " exit exit the program after the confirmation + . Nules The amount is compared with the total cost of the purchase (not the share price) The symbol search is a substring search. In another words, the symbol can contain that search string . The user can buy the same stock symbol multiple times. The "ind' and 'amount>="requires the 2nd search argument. Requirements that are still applicable: 1. For each purchase, it is required to create a new 'Stock" object to keep track of the '1201 PM Type here to search O BuyStuckCinspel BuyStockCmd.pdf 1/2 100% + + + The user can buy the same stock Symoci mului Urios. The 'Find' and amounts='requires the 2 search argument. Requirements that are still applicable: 1. For each purchase, it is required to create a new 'Stock" object to keep track of the purchasing info. Note: this "Stock" class must not have cin or cout or vector being used within the class. 2. To manage the list of purchases, you will need to have a "Vector" object to manage the list of Stocks objects. In another words, you are no longer using "string" to keep track of purchasing history. 3. The user can enter the share price with any number of decimals, but all output amounts must be displayed with dollar sign and only two-digit decimals. 4. It must ask for confirmation of "Are you sure that you want to exit the programi (yin)?' ( before exiting the program. If the user enters m', the program will continue 5. All data members in a class must be declared as "private Required error handling: 1. When the user enters an unsupported invalid command, the program should display "Invalid command. Pluse try again.'. 2. It must check for negative number of shares and negative stock price and continuously ask for a new value until positive numbers are given. 3. When asking for confirmation to exit the program, it must chock and acccpt only valid responses of y, 'Y', 'm' or 'N'. Everything else should be given an error message 4. An error message should be displayed when the user does not enter any command line argument or the given data file is not found 5. The 'Tind' and 'amount="must have the argument on the same input (e.g. do not prompt for the value separately 6. The program must have at least 5 functions. '1201 PM Type here to search O buystock_vulpjeld - Nolesed File Edit Format View Helo D:\>BuyStockCind purchasedata3.txt Plcasc enter a command; display SYMBOL (INTC) PRICE ($38.13) QUANTITY(100) TOTAL($3013.00) SYMBOL (CSCO) PRICE($24.08) QUANTITY(29) TOTAL ($4808.08) SYMBOL(IBM) PRICE($130.00) QUANTITY(50) TOTAL (36500.00) SYMBOL (AAPL) PRICE ($94.28) QUANTITY(109) TOTAL (59478.00) Please enter a command: summary Number-of-purchases (4) Total-cost($23741.00) Please enter a command: buy Please enter the stock symbol: GOOG Please enter the number of shares: 18 Please enter the share price: 559.1234 The stock has been purchased successfully. Please enter a command: display SYMBOL(INTC) PRICE($38.13) QUANTITY(100) TOTAL (53013.08) SYMBOL(CSCO) PRICE ($24.00) QUANTITY(200) TOTAL ($4800.00) SYMBOL(IBM) PRICE ($138.08) QUANTITY(50) TOTAL ($65e9.00) SYMBOL (AAPL) PRICE (994.28) QUANTITY(109) TOTAL ($9428.00) SYMBOL(GOOG) PRICE($550.12) QUANTITY(10) TOTAL ($5501.23) Please enter a command: summary Number-of-purchases(5) Total-cost ($29242.23) Please enter a command: exit Are you sure that you want to exit the program? Ir 1 coli 118 Windows CRIFJ Type here to search O 1202 PM 7/12/11 P BuyStuckCinspel BuyStockCmd.pdf 1/2 | - 100% + + PROGRAMMING PROJECT #2: BUY STOCKS USING COMMAND Objectives: Use basic CH constructs it, switch, and repetition (looping) Perform simple data type manipulations Solve problem, design solution and implement using C++ Deline C++ class and create and manage a list of objects Description: Improve and enhance your "BuyStocks.cpp' and name it as "BuyStockCmd' that uses commands instead of menu with the following changes: 1. Accept a command line argument which is the purchase data file in the following format: number of shares stock syrntol price per shares Here is an example of the data file: 100 INTC 30.13 200 CSCO 24.00 50 IBM 130.00 100 AAPL 94.28 2. Define a new C++ 'Stock" class that manages a stock price number of share and stock symbol 3 The program will read and process the following user-entered commands "buy" buy a stock by asking for the stock symbol, quantity and share price "display display all purchases summary display only the summary of purchase total and number of purchases find = Spurchase-amount> display all purchases >= the given amount help display this help me " exit exit the program after the confirmation + . Nules The amount is compared with the total cost of the purchase (not the share price) The symbol search is a substring search. In another words, the symbol can contain that search string . The user can buy the same stock symbol multiple times. The "ind' and 'amount>="requires the 2nd search argument. Requirements that are still applicable: 1. For each purchase, it is required to create a new 'Stock" object to keep track of the '1201 PM Type here to search O BuyStuckCinspel BuyStockCmd.pdf 1/2 100% + + + The user can buy the same stock Symoci mului Urios. The 'Find' and amounts='requires the 2 search argument. Requirements that are still applicable: 1. For each purchase, it is required to create a new 'Stock" object to keep track of the purchasing info. Note: this "Stock" class must not have cin or cout or vector being used within the class. 2. To manage the list of purchases, you will need to have a "Vector" object to manage the list of Stocks objects. In another words, you are no longer using "string" to keep track of purchasing history. 3. The user can enter the share price with any number of decimals, but all output amounts must be displayed with dollar sign and only two-digit decimals. 4. It must ask for confirmation of "Are you sure that you want to exit the programi (yin)?' ( before exiting the program. If the user enters m', the program will continue 5. All data members in a class must be declared as "private Required error handling: 1. When the user enters an unsupported invalid command, the program should display "Invalid command. Pluse try again.'. 2. It must check for negative number of shares and negative stock price and continuously ask for a new value until positive numbers are given. 3. When asking for confirmation to exit the program, it must chock and acccpt only valid responses of y, 'Y', 'm' or 'N'. Everything else should be given an error message 4. An error message should be displayed when the user does not enter any command line argument or the given data file is not found 5. The 'Tind' and 'amount="must have the argument on the same input (e.g. do not prompt for the value separately 6. The program must have at least 5 functions. '1201 PM Type here to search O buystock_vulpjeld - Nolesed File Edit Format View Helo D:\>BuyStockCind purchasedata3.txt Plcasc enter a command; display SYMBOL (INTC) PRICE ($38.13) QUANTITY(100) TOTAL($3013.00) SYMBOL (CSCO) PRICE($24.08) QUANTITY(29) TOTAL ($4808.08) SYMBOL(IBM) PRICE($130.00) QUANTITY(50) TOTAL (36500.00) SYMBOL (AAPL) PRICE ($94.28) QUANTITY(109) TOTAL (59478.00) Please enter a command: summary Number-of-purchases (4) Total-cost($23741.00) Please enter a command: buy Please enter the stock symbol: GOOG Please enter the number of shares: 18 Please enter the share price: 559.1234 The stock has been purchased successfully. Please enter a command: display SYMBOL(INTC) PRICE($38.13) QUANTITY(100) TOTAL (53013.08) SYMBOL(CSCO) PRICE ($24.00) QUANTITY(200) TOTAL ($4800.00) SYMBOL(IBM) PRICE ($138.08) QUANTITY(50) TOTAL ($65e9.00) SYMBOL (AAPL) PRICE (994.28) QUANTITY(109) TOTAL ($9428.00) SYMBOL(GOOG) PRICE($550.12) QUANTITY(10) TOTAL ($5501.23) Please enter a command: summary Number-of-purchases(5) Total-cost ($29242.23) Please enter a command: exit Are you sure that you want to exit the program? Ir 1 coli 118 Windows CRIFJ Type here to search O 1202 PM 7/12/11 P

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Understanding Groups

Answered: 1 week ago