Question: Please Help! This is an intro class to C programming and we just started, we have only leaned a few tools so we cant use:
Please Help! This is an intro class to C programming and we just started, we have only leaned a few tools so we cant use: Loops, if statements, or arrays for this program.
I need to write a C program that will perform the following tasks:
Task 1: Allow the user to enter in the data for each stock. Stock name, Number of shares, Buy Price, Current Price and Yearly Fees.(The user will not enter the $'s.)
Task 2: Calculate the Initial Cost, Current Cost, and Profit for each stock. The formulas to use are:
Initial Cost = Number of Shares * Buying Price Per Share Current Cost = Number of Shares * Current Price Per Share Profit = Current Cost - Initial Cost - Yearly Fees
Task 3: Print out the Stock Name, Initial Cost, Current Cost, and Profit for each stock.
Task 4: Calculate and print the total profit for all of the stocks. That is, find the sum of the 5 profits for each stock.
Notes:
The user will enter the correct datatype, for example stock will be strings, shares as integer and the rest as floats.
Use print formatting to align all numbers, using column width and precision.
Use the data in the table above, do not use the data from the sample test
Here is the sample run- you only need to have one test run with all the five stocks entered (blue user input): The output must run and look exactly like the sample test run shown below.

Lastly, I have to follow this format
//Declaration
//Data/input
//Processing/calculation
//output
I am looking for help on how to go about something like this. Thank you in advance!
Stock Name Yearly Fees Number of Shares 155 375 350 85 50 IBM CORP ORACLE SYS SUN MICRO LINKSYS INC CISCO INC Buying Price Per Share $15.33 $11.77 $27.55 $25 35 $45.36 Stock Enter stock name IBM CORP Enter number of shares 150 Enter the buy price, current price, fees 11.33 13.33 5.00 The Stock name is I IEM CORP The number of shares: The buy prices 11.33 The current price 13.33 The fees are 5.00 The initial cost is $ 1699.50 The current cost 13: 1999.50 The profit 18 295.00 Current Price Per Share $13.33 $12.25 $35.75 $23.34 $50.86 $5.00 $3.50 $12.25 $6.00 $1.50 Stock 2 Enter stock name ORACLE SYS Enter number of shares 215 Enter the buy price, current price fees 10.77 12.25 3.50 The Stock ORACLE SY The number of shares : 215 The buy price 18 The current price is: The fees are The initial cost is $ 2315.55 The current cost is 2633.75 The profit 314.70 10.77 Stock 3 Enter stock nane SUN MICRO Enter number of shares 355 Enter the buy price, current price, fees 25.55 35.75 12.25 The Stock name is SU MICRO The number of shares ! 355 The buy price is The current price 19: The fees are 12.25 The initial cost 1:9070.25 The current cost 1812691.25 The profit us $3608.75 25.55 35.75 Enter stock name LINKSYS INC Enter number of shares 75 Enter the buy price, current price, fees 22.34 23.34 6.00 The Stock name is 1 LINKSYS INC The number of shares! 75 The buy price is The current price is : 5 The fees are 6.00 The initial cost is 1675.50 The current cost is 11 1750.50 The profit 69.00 Stocks Enter stock name CISCO INC Enter number of shares 50 Enter the buy price, current price, fees 45.36 50.86 1.50 The Stock name 15 - CISCO INC The number of shares: 50 The buy price 15 45.36 The current price is : 50.16 The fees are 1.50 The initial cost 15 The current cost 15 The profit is 2268.00 2543.00 273.50 Total profit The total profit for the 5 stocks 15 16 4560.95
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
