Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following program segment: include statement(s) using namespace statement int main O /variable declaration /executable statements /return statement a) Write C++ statements that include

image text in transcribed
Consider the following program segment: include statement(s) using namespace statement int main O /variable declaration /executable statements /return statement a) Write C++ statements that include the header files iostream and string b) Write a C++ statement that allows you to use cin, cout, and endl. c) Write C++ statements that declare and initialize the following named constants: SECRET of type int initialized to 11 and RATE of type double initialized to 12.50. name of type string: and hours Worked and wages of type double. and the second number in num2 d) Write C++ statements that declare the following variables: numl , num2, and newNum of type int; c) Write C++ statements that prompt the user to input two integers and store the first number in num 0 Write a C++ statement(s) that outputs the values of numl and num2, indicating which is numl and g) Write a C++ statement that multiplies the value of numl by 2, adds the value of num2 to it, and then h) Write a C+t statement that updates the value of new Num by adding the value of the which is num2. For example, if numi is 8 and num2 is 5, then the output is: The value of num1-8 and the value of num25 stores the result in new Num. Then, write a C++ statement that outputs the value of new Num named constant SECRET to it. Then, write a C++ statement that outputs the value of newNum with an appropriate message. Write C++ statements that promp into the variable name. Write C+ statements that prompt the user to enter a decimal number between 0 and 70 and then store the number entered into hours Worked. Write a C++ statement that multiplies the value of the named constant RATE with the value of hours Worked and then stores the result into the variable wages Write C++ statements that produce the following output: t the user to enter a person's last name and then store the last name j) j) k) I) Name :/output the value of the variable name Pay Rate :S/loutput the value of RATE Hours Worked : //output the value of the variable hoursWorked Salary: S/loutput the value of the variable wages For example, if the value of name is "Rainbow and hoursWorked is 45.50, then the output is: Name : Rainbow Pay Rate:$12.50 Hours Worked: 45.50 Salary: $568.75 Write a C++ program that tests each of the C++ statements that you wrote in parts a through 1. Place the statements at the appropriate place in the C++ program segment given at the beginning of this problem. Run your program (twice) on the following input data: m) a num1 13,num2 - 28; name "Jacobson"; hoursWorked 48.3. b. num1-32,num2 15;name- Crawford"; hoursWorked -58.45

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions