Questions
This has to be a C program - Here is a simplified set of rules that...

This has to be a C program -

Here is a simplified set of rules that show how a dive is judged at a competition like the Olympics:

  • Each different kind of dive is given a "degree of difficulty". The limits on degrees of difficulty keep changing as competitors perform increasingly difficult dives, but for this assignment the degree of difficulty of each dive must be between 1 and 5 inclusive.
  • The number of judges varies with the event, but for this assignment there will be 8 judges.
  • When a diver makes a dive, each judge gives a mark between 0 to 10 to describe how well the diver executed the dive.
  • To compute the score for a dive, you take the marks from the judges and discard the highest two scores and lowest two scores. Add up the remaining four marks and multiply the sum by the degree of difficulty.

As an example, suppose a diver performs a dive with degree of difficulty 3.2 and the judges' marks were 7, 8, 5, 4, 9.5, 6.5, 9.5 and 8. The two lowest marks are 4 and 5 and the two highest marks are 9.5 and 9.5. The judges will add up the remaining four marks: 7+8+6.5+8=29.5 and multiply by 3.2 to get the diver's score: 94.4. An equivalent approach would be to add up all 8 of the scores and subtract the two lowest and two highest from the total before multiplying by the difficulty. Either way, please note that the marks may not be reported to the program in sorted order.

You must hand in a file called diving.c. It must be a complete C program, including a main function, which will prompt the user for information about a dive and compute the score for the dive. Specifically, the program must prompt the user for the degree of difficulty followed by 8 judge's marks and then print the score for the dive.

Have a look at the sample run shown below and duplicate the look of it as closely as possible.

Your program must contain at least three functions (a main function and at least two others). At least two functions other than main must have at least one parameter and must use their parameters in a non-trivial way. (In other words, just writing a message saying "my parameter is 3" does not count!)

At least two functions other than main must return a result and the function that calls each of them must use the result in a non-trivial way. (In other words, having function f call function g and then having f write a message saying "function g returned 13" does not count!)

Consider using #define statements to create meaningful symbols for following numbers:

  • the minimum score that can be given for a dive (0)
  • the maximum score that can be given for a dive (10)
  • the minimum degree of difficulty (1)
  • the maximum degree of difficulty (5)
  • the number of dives per competitor (8)
  • the number of judges (8)

Using symbols will make your code easier to read, and therefore easier to debug. It will also make your code easier to change. For example, if you ever wanted to modify the program for use at a diving competition with 10 judges instead of 8, you would just have to change one #define. You wouldn't have to look through your whole program to find 8s and read the code carefully to distinguish between 8s used to mean number of judges and 8s used to mean the number of dives per competitor.

Error Hnadling:

Your program must check for the following kinds of errors:

  • A score that is less than 0 or greater than 10.
  • A degree of difficulty that is less than 1 or greater than 5.

If either of these errors occur, your program must print an informative error message and use a default value instead (0 for a score and 1 for a degree of difficulty). "Informative", means an error that tells the user what was wrong – for example "Error: scores must be between 0 and 10" instead of just "Error". You may assume that user will enter only numeric values in answer to your program's prompts.

In: Computer Science

Two resistors 30 Ω and 50 Ω are connected in parallel and this parallel arrangement is...

Two resistors 30 Ω and 50 Ω are connected in parallel and this parallel arrangement is then connected in series with two resistors 20 Ω each. The combination is placed across a 10V potential difference. Hence construct the diagram of the above circuit. According to your observation evaluate the total current in the circuit and also the total power delivered to the resistors and also show that the total power dissipated is equal to the sum of the power dissipated by individual resistor. Also, can you suggest the current through 30 Ω resistance?

In: Physics

An investor owns a portfolio consisting of two mutual funds, A and B, with 50% invested...

An investor owns a portfolio consisting of two mutual funds, A and B, with 50% invested in A. The following table lists the inputs for these funds.

Measures Fund A Fund B
Expected value 10 7
Variance 68 43
Covariance 25

a. Calculate the expected value for the portfolio return. (Round your answer to 2 decimal places.)

Expected Value:

b. Calculate the standard deviation for the portfolio return. (Round intermediate calculations to at least 4 decimal places. Round your final answers to 2 decimal places.)

Standard Deviation:

In: Math

A manufacturer sells two types of products. Product 1 is sold at a price of $50...

A manufacturer sells two types of products. Product 1 is sold at a price of $50 per unit and product 2 at a price of $60 per unit. Three units of raw material and 1.5 labor hours are needed to manufacture one unit of product 1. Six units of raw material and 2 labor hours are needed to manufacture one unit of product 2. The unit variable cost for product 1 is $30, and for product 2 is $20. A total of 15,000 units of raw material and 10,000 labor hours are available. If any product 1 is produced, a setup cost of $20,000 is incurred; if any product 2 is produced, a setup cost of $35,000 is incurred. Determine how to maximize the manufacturer’s profit.

a) What is the effective capacity for product 1 and product 2, respectively?

b) In the optimal solution, which product(s) will be manufactured? What is the optimal production quantity? What is the optimal profit?

In: Operations Management

Write a JavaFX application that presents two buttons and a number (initially 50) to the user....

Write a JavaFX application that presents two buttons and a number (initially 50) to the user. Label the buttons Increment and Decrement. When the increment button is pushed, increment the displayed value. Likewise, decrement the value when the decrement button is pushed.

This has to use Java.Fx and not Java.Awt

In: Computer Science

how multiplication of two numbers (50 & 25) stored in RAM is carried out on the...

how multiplication of two numbers (50 & 25) stored in RAM is carried out on the Cortex-M4 processor using the MUL instruction.

In: Computer Science

A manufacturer sells two types of products. Product 1 is sold at a price of $50...

A manufacturer sells two types of products. Product 1 is sold at a price of $50 per unit and product 2 at a price of $60 per unit. Three units of raw material and 1.5 labor hours are needed to manufacturer one unit of product 1. Six units of raw material and 2 labor hours are need to manufacture one unit of product 2. The unit variable cost for product 1 is $30, and for product 2 is $20. A total of 15,000 units of raw material and 10,000 labor hours are available. If any product 1 is produced, a setup cost of $20,000 is incurred; if any product 2 is produced, a setup cost of $35,000 is incurred. Determine how to maximize the manufacturer’s profit.

a) What is the effective capacity for product 1 and product 2, respectively?

b) In the optimal solution, which product(s) will be manufactured? What is the optimal production quantity? What is the optimal profit?

In: Accounting

Give and interpret the 95% confidence intervals for males and females on the HEIGHT variable. Which...

  1. Give and interpret the 95% confidence intervals for males and females on the HEIGHT variable. Which is wider and why?
  2. Give and interpret the 99% confidence intervals for males and females on the HEIGHT variable. Which is wider and why?
  3. Find the mean and standard deviation of the DRIVE variable and then determine the percentage of data points from that data set that we would expect to be less than 40.
    Height (inches) Sleep (hours) Gender
    61 7 M
    62 7 F
    63 5 F
    63 7 F
    64 6 F
    65 8 F
    65 7 F
    66 8 F
    66 5 M
    67 8 M
    67 8 F
    67 4 F
    67 8 F
    68 8 M
    68 6 M
    69 8 M
    69 8 M
    69 8 M
    69 7 F
    69 10 M
    69 6 F
    69 7 M
    70 8 F
    70 5 F
    70 8 F
    70 7 F
    70 7 M
    71 4 M
    71 9 M
    71 8 M
    73 7 F
    73 7 M
    74 8 M
    74 8 M
    75 10 M

In: Statistics and Probability

?The Templeton Manufacturing and Distribution Company of? Tacoma, Washington, is contemplating the purchase of a new...

?The Templeton Manufacturing and Distribution Company of? Tacoma, Washington, is contemplating the purchase of a new conveyor belt system for one of its regional distribution facilities. Both alternatives will accomplish the same task but the Eclipse Model is substantially more expensive than the Sabre Model and will not have to be replaced for 10? years, whereas the cheaper model will need to be replaced in just 5 years. The costs of purchasing the two systems and the costs of operating them annually over their expected lives is provided? below: Year Eclipse Sabre 0 $(1,500,000) $(700,000) 1 $(23,000) $(52,000) 2 $(31,000) $(52,000) 3 $(31,000) $(63,000) 4 $(31,000) $(63,000) 5 $(43,000) $(75,000) 6 $(43,000) 7 $(43,000) 8 $(43,000) 9 $(43,000) 10 $(43,000) a.??Templeton typically evaluates investments in plant improvements using a required rate of return of 9 percent. What are the NPVs for the two? systems? b.??Calculate the equivalent annual costs for the two systems. c.??Based on your analysis of the two systems using both their NPV and? EAC, which system do you recommend the company? pick? ? Why?

In: Finance

The Templeton Manufacturing and Distribution Company of? Tacoma, Washington, is contemplating the purchase of a new...

The Templeton Manufacturing and Distribution Company of? Tacoma, Washington, is contemplating the purchase of a new conveyor belt system for one of its regional distribution facilities. Both alternatives will accomplish the same task but the Eclipse Model is substantially more expensive than the Sabre Model and will not have to be replaced for 10? years, whereas the cheaper model will need to be replaced in just 5 years. The costs of purchasing the two systems and the costs of operating them annually over their expected lives is provided? below:??

Year   Eclipse   Sabre
0   $(1,300,000)   $(700,000)
1   $(23,000)   $(55,000)
2   $(29,000)   $(55,000)
3   $(29,000)   $(63,000)
4   $(29,000)   $(63,000)
5   $(39,000)   $(82,000)
6   $(39,000)  
7   $(39,000)  
8   $(39,000)  
9   $(39,000)  
10   $(39,000)   

a.??Templeton typically evaluates investments in plant improvements using a required rate of return of 10%. What are the NPVs for the two? systems?

b.??Calculate the equivalent annual costs for the two systems.

c.??Based on your analysis of the two systems using both their NPV and? EAC, which system do you recommend the company? pick? ? Why?

In: Finance