# CS 52: Assignment #3 Solved

25.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . ` zip` solution files instantly, after Payment

## Description

### part_a: pi_approximator

Â is a mathematical quantity that associates the area of a circle to its radius.Â  Write a program that approximates the value ofÂ Â by using theÂ LeibnizÂ formula:

Since this formula is an infinite series, you will need to prompt the user for how accurate they want the calculation to be.Â  Rather than using one big pile of main( ), you need to use functions for this calculation and pass parameters and work with return values.Â  In addition, you need to include atleast oneÂ const intÂ orÂ const doubleÂ declaration.Â  Finally, embed your program in a loop so that the calculation can be repeated as often as the user wishes. RoundÂ to two decimal places.

 Iterations:Â 1 Pi is approximated to beÂ 4.00.
 Iterations:Â 2 Pi is approximated to beÂ 2.67.
 Iterations:Â 10 Pi is approximated to beÂ 3.04.

• Write a program which produces thisÂ output as the examples above:
 Iterations:Â {USER INPUT} Pi is approximated to beÂ {approximation rounded to 2nd decimal place}.
• You are provided the flexibility to create your own files.
• While thereÂ will likely beÂ mutliple methods,Â the main method must be namedÂ getPi(…)Â asÂ a simple interface to a user.

### part_b:Â inventory_system

Write a C++ program thatÂ calculates the inventory on-hand for Widget Co, an internationally renowned Widget maker located in Santa Monica.Â  Each month, Widget Co. produces 123 new widgets from its production line during a good month, but only 52 widgets from its production line during a bad month.Â  In addition, each month, its sales team takes orders for some number of widgets.Â  If they are on-hand, Widget Co. reduces its inventory of widgets.Â  If not on-hand, it compiles a back-order for the requested widgets.Â  In order to receive full credit, you must use functions for this calculation and pass parameters and work with return values.Â  The program dialogue should look like this:

 Welcome to Widget Co.! Month:Â 0Â Â Â Â Number of widgets on-hand:Â 0Â  Number back-ordered:Â 0 Was it a good or bad month (g/b)?Â g How many did the sales force sell?Â 15 Continue(y/n)?Â y Month:Â 1Â Â Â  Number of widgets on-hand:Â 108Â  Number back-ordered:Â 0 Was it a good or bad month (g/b)?Â b How many did the sales force sell?Â 150 Continue(y/n)?Â y Month:Â 2Â Â Â  Number of widgets on-hand:Â 10Â  Number back-ordered:Â 0 Was it a good or bad month (g/b)?Â b How many did the sales force sell?Â 100 Continue(y/n)?Â y Month:Â 3Â Â Â  Number of widgets on-hand:Â 0Â Number back-ordered:Â 38 Was it a good or bad month (g/b)?Â g How many did the sales force sell?Â 200 Continue(y/n)?Â n At the end of monthÂ 3, you wound up withÂ 0Â widgets on-hand andÂ 115Â widgets back-ordered
• Again, you are expectedÂ to create allÂ files.
• The main high level method must be named runInvSys(…).