Question: Write this code in C The road stripe painters have formed a union. Each painter will only paint a section of 2 miles or shorter

Write this code in C

Write this code in C The road stripe painters have formed a

The road stripe painters have formed a union. Each painter will only paint a section of 2 miles or shorter of stripes on the road and charge $100/mile for the service. If the road is longer than 2 miles, the painter does his/her job on the first 2 miles, and subcontract another painter for the rest of the road, charging $50 for hiring. Each of the hired painters will do the same thing as the original painter did. That is, he/she will basically paint at most 2 miles and charge $100/mile. If the road is longer than 2 miles, he/she will hire another painter for the rest of the road and charge $50, and so on. Write a recursive function which is used to calculate the total cost. The prototype for the function must be: int costofpainting (double length) Write a driver to test the function with the appropriate test cases. The driver obtains the input (can be hard-coded) and prints the output. The output must be self-explanatory; it must tell what value you used for input and what the result was acquired Materials to submit Submit the following: Your source code. Output with reasonable test cases. No proof of compilation required, but make sure your code can compile with the required options

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!