Question: Project 1: Pi Write a C++ program that approximates the value of using the Gregory-Leibniz formula: Since this formula is an infinite series, you will

Project 1: Pi

Write a C++ program that approximates the value of Project 1: Pi Write a C++ program that approximates the value of using the Gregory-Leibniz formula:

Since this formula is an infinite series, you will need to prompt the user for the number of iterations (summation terms) they want to use in the calculation. For example, if the user indicates "4" iterations, the result would be using the Gregory-Leibniz formula: Since this formula is an infinite series, you = 4 - 4/3 + 4/5 - 4/7 or approximately 2.89524. If the user indicates "10" iterations, the result would be will need to prompt the user for the number of iterations (summation = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + 4/13 - 4/15 + 4/17 - 4/19 or approximately 3.04184. If the user indicated "10000" iterations, the result would be approximately 3.14149. Thus, as the number of summation terms increases, the result converges on true value of PI.

Rather than putting all your code in main(), use functions to perform the calculation. Embed your program in a loop so that the calculation can be repeated multiple times.

Project 2: Tailor

The purpose of this C++ program is to determine how much cloth in square inches is needed to make a certain type of garment. You should base your calculations on the following table:

Pants Shirts Shorts
2 1/2 square inch per waist size inch of the person being fitted 2 3/8 square inch per waist size inch of the person being fitted 1 3/10 square inch per waist size inch of the person being fitted
1/2 square inch per height inch of the person being fitted 4/9 square inch per height inch of the person being fitted 1/4 square inch per height inch of the person being fitted
1/10 square inch per waist size inch of the person being fitted, if pleaded front is desired 2 4/5 square inch per arms length inch of the person being fitted, if long sleeves are desired If pockets are desired, add an extra 15% to the fabric amount calculated so far
If baggy look is desired, add an extra 10% to the fabric amount calculated so far

Rather than putting all your code in main(), use functions to perform the calculation. Embed your program in a loop so that the calculation can be repeated multiple times. Use constants to hold the literal values in the above table, for example:

const double PANTS_WAIST_FACTOR = 2 + 1.0/2;

Tailor Fabric Calculator: Whaddya want? [P]ants or [S]hirts or shor[T]s: P Gimme your waist size in inches: 30 Gimme your height size in inches: 72 Pleaded front? [Y/N]: Y Baggy Look? [Y/N]: N For your pants, you'll need 114 square inches of fabric! Try again? [Y/N]: Y

Tailor Fabric Calculator: Whaddya want? [P]ants or [S]hirts or shor[T]s: S Gimme your waist size in inches: 32 Gimme your height size in inches: 50 Long sleeves? [Y/N]: Y Gimme your arms length in inches: 25 For your shirts, you'll need 168.2222 square inches of fabric! Try again? [Y/N]: Y

Tailor Fabric Calculator: Whaddya want? [P]ants or [S]hirts or shor[T]s: T Gimme your waist size in inches: 35 Gimme your height size in inches: 72 Pockets? [Y/N]: Y For your shorts, you'll need 73.025 square inches of fabric! Try again? [Y/N]: N

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!