Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable and return its value Function #2: 1) Name: GetY 2) Parameters: double x 3) Job: calculate y using the formula below and return y. Function #3: 1) Name: OutputXY() 2) Parameters: double x, double y 3) Job: Output x and y as shown in the sample output. Limit the output of y to 5 decimal places. int main() ( Use the following main() to test your function. You only need to implement the three functions. If the function are Implemented correctly then you will get the correct output. double X, Y: y= X = InputX(): Y = GetY (X): -2x+cos (x) 5sin (2x) Output XX (X, Y); return 0; Sample input/output: Enter the value of x: 3.1 For 3.1 the value of y is 17.32865 Enter the value of x: 0.921 For 0.921 the value of y is -0.25678 Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable and return its value Function #2: 1) Name: GetY 2) Parameters: double x 3) Job: calculate y using the formula below and return y. Function #3: 1) Name: OutputXY() 2) Parameters: double x, double y 3) Job: Output x and y as shown in the sample output. Limit the output of y to 5 decimal places. int main() ( Use the following main() to test your function. You only need to implement the three functions. If the function are Implemented correctly then you will get the correct output. double X, Y: y= X = InputX(): Y = GetY (X): -2x+cos (x) 5sin (2x) Output XX (X, Y); return 0; Sample input/output: Enter the value of x: 3.1 For 3.1 the value of y is 17.32865 Enter the value of x: 0.921 For 0.921 the value of y is -0.25678
Expert Answer:
Answer rating: 100% (QA)
code include include include using namespace std double InputX double x cout Enter the value o... View the full answer
Related Book For
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw
Posted Date:
Students also viewed these computer network questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Read the case study and answer the question below with a one page response. What does a SWOT analysis reveal about the overall attractiveness of Under Armours situation? Founded in 1996 by former...
-
Use normal job-order costing to calculate the balance in the ending Work-in-Process account and the Cost of Goods Sold account on 31 December 20X3 after any necessary adjustment(s). Sweet Memories...
-
Use the data given in S8-1. On May 21, 2015, Tiffany Company sold its investment in Byson Co. stock for $23 per share. In S8-1, Tiffany Company completed these long-term available-for-sale investment...
-
The manufacturer of synthetic motor oil lists the viscosity of their 0W20 oil as 47.0 cSt and 8.8 cSt at 40C and 100C, respectively. The 0W20 product data sheet also indicates that the specific...
-
A system, consisting of \(2 \mathrm{~mol}\) of \(\mathrm{N}_{2}, 5 \mathrm{~mol}\) of \(\mathrm{H}_{2}\) and \(2 \mathrm{~mol}\) of \(\mathrm{NH}_{3}\) initially, is undergoing the following...
-
As an investor, you are considering an investment in the bonds of the Front Range Electric Company. The bonds pay interest quarterly, will mature in 12 years, and have a coupon rate of 3.25% on a...
-
As a case manager your role is to evaluate a client's needs considering a holistic rangeof relevant information. Explain in one paragraph why it is essential to evaluate a client's needs,considering...
-
The Ploughman family owns and operates a 640-acre farm that has been in the family for several generations. The Ploughmans always have had to work hard to make a decent living from the farm and have...
-
A company's sold garden hoses at a reduced price of $5.63and took an end -of season markdown of $11.32 what was the original selling price of each hose
-
Standish Company manufactures consumer products and provided the following information for the month of February: Units produced 131,300 Standard direct labor hours per unit 0.2 Standard fixed...
-
Sports-Reps, Inc., represents professional athletes and movie and television stars. The agency had revenue of $12,400,000 last year, with total variable costs of $6,200,000 and fixed costs of...
-
Your bank will lend you $6,800 for 30 days at a cost of $85 interest. a. What is your annual rate of interest? (Use 365 days in a year. Do not round intermediate calculations. Round the final answer...
-
During the year, Vandy Company produced 235,000 components for industrial metal working machinery. Vandy's direct materials and direct labor standards per unit are as follows: Direct materials (8.55...
-
Grant Industries, a manufacturer of electronic parts, has recently received an invitation to bid on a special order for 25,000 units of one of its most popular products. Grant currently manufactures...
-
Introduction: this is data from a pet rescue charity with managing their donations related data. The charity organizes an annual donation drive. The city is divided to donations areas (every donation...
-
Modify the counter from Exercise 5.44 such that the counter will either increment by 4 or load a new 32-bit value, D, on each clock edge, depending on a control signal Load. When Load = 1, the...
-
A firm had the following values for the four debt ratios discussed in the chapter: Liabilities to Assets Ratio: less than 1.0 Liabilities to Shareholders Equity Ratio: equal to 1.0 Long-Term Debt to...
-
Identify the types of firm-specific factors that increase a firms nondiversifiable risk (systematic risk). Identify the types of firm-specific factors that increase a firms diversifiable risk...
-
Rock of Ages, Inc., a large North American integrated granite quarrier, manufacturer, and retailer of finished granite memorials, reported a net loss for 2004 of $3.2 million. In 2004, the firm...
-
Show that \[ \gamma_{i}=\frac{\bar{\phi}_{i}}{\phi_{i}} \]
-
Carbon dioxide occupies a tank at \(100^{\circ} \mathrm{C}\). If the volume of the tank is \(0.5 \mathrm{~m}^{3}\) and the pressure is \(500 \mathrm{kPa}\), determine the mass of the gas in the tank.
-
Give an informatory note on saturation temperature and saturation pressure.
Study smarter with the SolutionInn App