Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello I was trying to do my C++ Assignment but for part A I was not able to do he addition even though I was

Hello I was trying to do my C++ Assignment but for part A I was not able to do he addition even though I was using double as my data type.

Exercise A: (Personal Information)

Refer to Week-1 Assignment, Exercise A, Personal Information.

This time, ask the user to enter their first name, last name, age, salary, and bonus.

Note:

  • In this exercise, pay attention to the data type.
  • Age can't be in decimal. Must pick the data type as int data type for age.
  • Salary and bonus can be in decimal. Make sure, your code should be able to handle numbers entered by the user in decimal.
  • When you add salary and bonus, the final output may be in decimal. Your code should be able to handle them.
  • You must add the line gap in the output if there is a line gap in the output.
  • Don't do any calculation manually. Your program should be able to handle the sum of 2 numbers.

I am attaching the expected output with this exercise. You must match your output with mine.

image text in transcribed

Hint: Please pay attention to Section 3.8 (Working with characters and String Objects) about how to use getline() function.

Exercise B: (Area of a Circle)

This program calculates the area of a circle. The formula for the area of a circle is PI times the radius squared. PI = 3.14159

  • Ask the user to enter the radius of a circle.
  • Calculate the area of the circle and display the number up to 2 decimal points.

(To set the decimal point include, #include )

  • You must declare PI as named constant.
  • You must use math function pow() to square the radius. Do not write radius * radius.

(You need to include, #include for pow function.)

Test Case:

Run your program two times. First time enter the value of the radius = 12. Second-time radius = 5.23.

Here is the expected output. Your code should be able to handle any number entered by the user. I am just giving you these 2 numbers to check the accuracy of your code.

image text in transcribed

Exercise C: (Simple Math)

Write a program that produces the following output (make sure you pay attention to spaces, lines, and upper- and lower-case). Use only variables of int type.

Your output must match with my output. If there is space between 2 lines, your output must show that space.

image text in transcribed

Exercise D: (Short Answer #5)

Write a C++ Expressions for the following algebraic expression.

(You don't need to code this. In the word document just type the C++ expression)

image text in transcribed

Exercise E: (PC#3: Test Average)

Write a program that asks for five(5) test scores. The program should calculate the average test score and display it. The number displayed should be formatted in fixed-point notation, with one decimal point of precision.

Design your output anyway you like.

Exercise F: (PC#17: Math )

Write a program that can be used as a Math helper for a young student. The program should display two random numbers to be added, such as

5

+ 7

----------

The program should then pause while the student works on the problem. When the student enters the answer, the program should display its correct answer or not.

5

+ 7

----------

12

Note: Keep the number within the range 0-12 to maintain the simplicity of the program.

Design your output anyway you like.

---In this program, I am asking your personal information! ----- Enter your First and last name: Nidhi Tilak Enter your Middle name: Sinha Enter your Age: 42 Enter your Salary: 100.34 Enter your Bonus: 35.5 *****Here is your complete information. ***** Full name: Nidhi Tilak Middle name: Sinha Age: 42 Your salary with bonus: 135.84 Enter the radius of the circle: 5.23 Area of the circle = 85.9316 Area of the circle upto 2 decimal point = 85.93 Enter the radius of the circle: 12 Area of the circle = 452.389 Area of the circle upto 2 decimal point = 452.39 *****Simple Math Application***** I will perform few calculations for you. Let's start.... Please enter 2 numbers: First number: 2 Second number: 3 These are the results: Addition -> (2+3) = 5 Subtraction => (2-3) = -1 Multiplication => (2*3) = 6 Thank you for using the Simple Math Application! Algebraic Expression C++ Expression a = 12x Z = x4 b+12 4K z = 3bc + 4 b = 3x+2 b = 3x +2 4y-1

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_2

Step: 3

blur-text-image_3

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 And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions