Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read through all of the instructions before starting. Write a program that does the following: Part A 1. Prompts the program user for their first
Read through all of the instructions before starting. Write a program that does the following: Part A 1. Prompts the program user for their first name and inputs it into a variable 2. Outputs a welcome message that incorporates their name. Part B 1. Prompts the user for the length of a rectangle in inches and inputs it into an integer variable. 2. Prompts the user for the width of a rectangle in inches and inputs it into an integer variable. 3. Outputs the length and width entered by the user. Part C 1. Use the length and width to calculate and output the area of the rectangle. 2. Use the length and width to calculate and output the perimeter of the rectangle. 3. Calculate and outputs the diagonal dimension of the rectangle. You will need to calculate the square root to do this. In order to calculate a square root, add the following to your program. In your include section at the top, add an include for math.h: #include #include #include using namespace std; To calculate the square root, call the sqrt function as shown here. If you named your variables length and width, your code will look exactly like this: double diagonal = sqrt((length * length) + (width * width)); Part D 1. Calculate and store in a double variable the length in millimeters (there are 25.4 millimeters in an inch). 2. Calculate and store in a double variable the width in millimeters. 3. Output the length and width in millimeters. and so on
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started