Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step1: Read the requirement; write in English the pseudo-code in a word document by listing the step by step what you suppose to do in

Step1:

Read the requirement; write in English the pseudo-code in a word document by listing the step by step what you suppose to do in main() and then save it with the name as Lab2_pseudoCode_yourLastName

(store pseudo-code and output pictures of both part 1 and part 2)

Step2:

Start Virtual Studio C++, create the project write the project name

For Part 1: SP2021_LAB2PART1_yourLastName

For Part 2: SP2021_LAB2PART2_yourLastName

Add .cpp file

For Part 1: SP2021_StockInvestment_yourLastName.cpp

For Part 2: SP2021_AdultBMI_Calculator_yourLastName.cpp

After adding the cpp file, you have an empty window coming up, type the following template of a C++ program in:

//File name should be written here as comment line

#include

using namespace std;

int main()

{

//add the code here below this line

..

system(pause); //This will pause the output to read

return 0;

}

Step3:

Then follow the step by step in the pseudo-code, type the C++ code in after the line //add the code here below this line

Step4:

Compile and run the program

Step5:

Debug if there are any errors until compile successfully

LAB2 - PART1 REQUIREMENT

Using C++, provide the application that helps users to calculate the profit returned from the investment on buying and trading stocks

The application should display the message to ask then read five information of the users from the keyboard about: customer name (string), number of stocks he buys (int), the buying stock price (float), the selling stock price (float) and the commission rate applied when buying and selling (float, example 5 for 5%).

After that, the application will display the output. The output should be formatted in columns with decimal numbers with 2 decimal digits. The output lines should be separated from the input therefore, all the lines written to read input are not counted in the output.

SP2021_StockInvestment_Martinez.cpp

Spring 2021 Semester LUIS MARTINEZ

----------------------------------------------------------------------

Name of investor: Mary Lane

Number of stocks: 2500

Buying Stock Price: 12.50

Selling Stock Price: 18.75

Commission Percentage: 5.00%

-----------------------------------------------------------------------

Money invested: 31250.00

Profit Amount from Investment: 14843.75

The output window is as below:

The formula to calculate is:

Invested amount = buying stock price * number of stocks

Selling amount = selling stock price * number of stocks

profit = [ selling amount (selling amount * commission rate) ] [ invested amount (invested amount * commission rate) ]

LAB2 - PART2 REQUIREMENT

Body Mass Index (BMI) is a decimal number that shows the body fat based on height and weight that applies to adult men and women. To adult men and women, it is normal if their BMI in the range 18.5 24.9. If BMI < 18.5, the person is underweight. If the BMI is in the range 25 to 29.9, the person is overweight. If BMI>= 30, the person is obesity.

Using C++ to provide the application to help users to determine the BMI (float)

The program first displays the message to ask for input and reads three information of the users about name (string), the height (int, in inches) and the weight (int, in pounds)

Using the following formula to determine BMI, where BMI is a decimal number

BMI = (weight * 703) / (height * height)

Display the output as below if the input is Mary Lane for name, 58 for height and 103 for weight.

The output should be formatted in columns with decimal numbers with 2 decimal digits.

The output should be separated from the input.

------------------------------------------------------------

SP2021_AdultBMI_Calculator_Smith.cpp

Spring 2021 Semester JAMES SMITH

Standard BMI: 18.5 24.9

-----------------------------------------------------------

Name: Mary Lane

Height (inches): 58

Weight (pounds): 103

----------------------------------------------------------

BMI: 21.52

The output window should be:

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

Is this investment worthwhile? Why or why not?

Answered: 1 week ago