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.
-
Identify the internal control weaknesses in each of the following situations. 1. Richard Tuiamu, a football star at the local university, was hired by football supporter R.U. Shore to work in the...
-
(a) Is Trp or Gln more likely to be on a proteins surface? (b) Is Ser or Val less likely to be in a proteins interior? (c) Is Leu or Ile less likely to be found in a middle of an helix? (d) Is Cys...
-
P(z > 2.55) Find the indicated probability using the standard normal distribution. If convenient, use technology to find the probability.
-
The stockholders equity section of Jarvis Corporation at December 31 is as follows Instructions From a review of the stockholders equity section, as chief accountant, write a memo to the president of...
-
Pistol Pete's Mustache Mania recently reported net income of $5.2 million and depreciation of $800,000. What is was net cash flow? Assume it has no amortization expense.
-
A company is due to receive 2,500,000 two-months from today and wishes to save the funds for three months. Money market interest rate spreads for short-term euro transactions are presented in the...
-
What strategies can we implement to enhance operational efficiency and streamline processes?
-
Suppose a portfolio manager purchases \(\$ 1\) million of par value of a Treasury inflation protection security. The real rate (determined at the auction) is \(3.2 \%\). a. Assume that at the end of...
-
Which of these is the correct order for the processes of teamwork? Transition process, interpersonal process, action process Transition process, action process, interpersonal process Interpersonal...
-
What are the key employability skills gained from studying OB?
-
Should the company proceed with plans to transition half of its employees to full-time remote work? Why or why not?
-
Which of these helps motivate the team to work toward the common goal or achieve the organizational objective? Interpersonal processes Transition process Action processes None of the above
-
A production line that costs $2,000,000 is expected to operatefor 10 years. The estimated salvage value at the end of 10 years is$50,000. The new production line is expected to increase thecompany 2...
-
A researcher reports a significant two-way between-subjects ANOVA, F(3, 40) = 2.96. State the decision to retain or reject the null hypothesis for this test.
-
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).
-
Who is currently in your own network that you could use for prospecting? How might you add to your network?
-
Pick any three of the sources of prospects discussed in the chapter and pick a product or service you like. Develop several ideas for how you would use each source to locate leads for the product or...
-
Why do you think a salesperson might experience call reluctance? How can it be overcome?
Study smarter with the SolutionInn App