The astronauts have a special machine that measures solar radiation every hour. The machine, however, sometimes...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The astronauts have a special machine that measures solar radiation every hour. The machine, however, sometimes malfunctions. When it does, it gives a reading of 85000. Astronauts must ignore these values. Write a C++ program that helps the astronauts clean up the readings. • Declare a function void CleanReadings(int weights[], int size) which takes an integer array and its size, and replaces all array elements that have the value 85000 with the average of the previous and next elements. For example, if weights[2] is 85000, then it should be replaced with (weights[1]+weights[3])/2. • If the element is the first or last in the array, it should replace it with a copy of the element after or before, respectively. For example, if weights[0] is 85000, then it should be replaced with the value of weights[1]. Assume the machine never malfunctions twice in a row. In the main, declare an array of size 5 and initialize it via user input, then call the function. Print the cleaned array in the main. Sample output 1: Please input 5 radiation values 243 906 489 85000 321 The readings after data cleaning are: 243 906 489 405 321 Sample output 2: Please input 5 radiation values 85000 342 543 890 85000 The readings after data cleaning are: 342 342 543 890 890 The astronauts have a special machine that measures solar radiation every hour. The machine, however, sometimes malfunctions. When it does, it gives a reading of 85000. Astronauts must ignore these values. Write a C++ program that helps the astronauts clean up the readings. • Declare a function void CleanReadings(int weights[], int size) which takes an integer array and its size, and replaces all array elements that have the value 85000 with the average of the previous and next elements. For example, if weights[2] is 85000, then it should be replaced with (weights[1]+weights[3])/2. • If the element is the first or last in the array, it should replace it with a copy of the element after or before, respectively. For example, if weights[0] is 85000, then it should be replaced with the value of weights[1]. Assume the machine never malfunctions twice in a row. In the main, declare an array of size 5 and initialize it via user input, then call the function. Print the cleaned array in the main. Sample output 1: Please input 5 radiation values 243 906 489 85000 321 The readings after data cleaning are: 243 906 489 405 321 Sample output 2: Please input 5 radiation values 85000 342 543 890 85000 The readings after data cleaning are: 342 342 543 890 890
Expert Answer:
Answer rating: 100% (QA)
Code include using namespace std void CleanReadingsi... View the full answer
Related Book For
Mathematical Statistics with Applications in R
ISBN: 978-0124171138
2nd edition
Authors: Chris P. Tsokos, K.M. Ramachandran
Posted Date:
Students also viewed these accounting questions
-
Write a function called hms_to_secs() that takes three int values for hours, minutes, and secondsas arguments, and returns the equivalent time in seconds (type long). Function prototypes is given...
-
Write a function that takes two integer inputs and returns the sum of all even numbers between these inputs, and another function that takes two integer inputs and returns the sum of odd numbers...
-
Clean Spot, Inc., started year 3 with $42,000 in its cash and common stock accounts. During year 3, Clean Spot paid $34,000 cash for employee compensation. Required Based on this information alone,...
-
Explain why rewarding sales personnel on the basis of total sales might not be in the best interests of a business whose goal is to maximize profits.
-
Smart Safety, a three-year-old company, has been producing and selling a single type of bicycle helmet. Smart Safety uses standard costing. After reviewing the income statements for the first three...
-
What are the client prerequisites in order for an audit to be performed?
-
The Dewey Construction Company processes its payroll transactions to update both its payroll master file and its work-in-process master file in the same computer run. Both the payroll master file and...
-
Problem 21-5 presents the balance sheet of St. John Corporation as of year-end 2015. Assume that the company is not able to service its debts and is unable to secure any significant restructuring...
-
The poseidon swim company produces swim trunks. The average selling price for one of their swim trunks is $33.58. The variable cost per unit is $18.75, poseidon swim has average fixed costs per year...
-
John Sullivan started a business. During the first month (February 20--), the following transactions occurred. Show the effect of each transaction on the accounting equation: Assets = Liabilities +...
-
X Corp. has an equity interest in Partnership Y, which owns a natural gas pipeline. Y has suffered unexpected losses in the current year due to large fluctuations in natural gas prices. To prevent...
-
Particle A of charge 2 . 7 9 1 0 - 4 C is at the origin, particle B of charge - 5 . 6 4 1 0 - 4 C is at ( 4 . 0 0 m , 0 ) , and particle C of charge 1 . 0 3 1 0 - 4 C is at ( 0 , 3 . 0 0 m ) . We...
-
The following data is available to you as a portfolio manager: Security estimated return(per cent) Beta 1 32 2 30 standard deviation(per cent) 2.10 50 1.80 35
-
Charles and Joan Thompson file a joint return. In 2 0 2 2 , they had taxable income of $ 9 8 , 8 0 0 and paid tax of $ 1 3 , 6 1 5 . Charles is an advertising executive, and Joan is a college...
-
consider the following bonds, each with a face value of $100: Type of bond Zero coupon Zero coupon Zero coupon Annual-pay coupon Maturity Coupon 1 2 3 2 a. What arbitrage trade would you do? 0 0 0 5%...
-
1. Stock Level Accuracy: The system's effectiveness is dependent on the accuracy of the store's stock levels. If the stock levels are not accurately maintained, the system could either order too much...
-
Question 2 /25/ You recently graduated and got a job at J, J&J investment, on your first day at work you were given the task of estimating the expected returns for 3 portfolios, AAT, STT and TTF....
-
Using the theoretical sampling strategy, how many samples of size 4 (n = 4) can be drawn from a population of size: (a) N = 5? (b) N = 8? (c) N = 16? (d) N = 50?
-
The following information was obtained from two independent samples selected from two normally distributed populations with unknown but equal variances. Test at the 2% significance level whether 1 is...
-
Find the marginal density functions of the random variables X and Y if their joint probability density function is given by {(3r-y). 1
-
Let (for error) be a random variable with E () = 0, and Var () = 2. Define the random variable, X = + , where is a constant. Find E (X), Var (X), and E (2).
-
Consider the following financial statements for Nixon Company. During the year, management obtained additional bond financing to enlarge its production facilities. The plant addition produced a new...
-
The following are the financial statements for Truman Company, with almost all dollar amounts missing: The following information is available about Truman Company's financial statements: 1. Quick...
-
Hardy Instruments, Inc., is a manufacturer of various measuring and controlling instruments. Financial statement data for the firm are as follows: Required a. Using the given data, calculate ratios 1...
Study smarter with the SolutionInn App