Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

E. Is the tone appropriate?

Answered: 1 week ago