Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Design a function called print_dog_years that takes a integer that represents a dogs age in human years and prints the dogs age in dog years.

1.Design a function called print_dog_years that takes a integer that represents a dogs age in human years and prints the dogs age in dog years. NOTE: a dogs age in dog years is seven times the number of human years it has lived. 2.Design a function called get_average that takes three integers numbers and returns the floating point average of the three numbers.

3. Design a function called get_rectangle_area that takes two floating point numbers that represent the length and width of the rectangle in cm. The function should return the area of that rectangle in cm squared.

4. Design a function called is_speeding that takes an integer representing the speed of a car in km/hr and an integer representing the speed limit in km/hr. Remember: the arguments MUST be in this order (speed before speed limit). If the speed of the car is not over the limit, the function should print: You are X km/hr below the legal limit where X is the difference between the speed of the car and the speed limit. If the speed of the car is over the limit, the function should print: Slow down! You are going Y km/hr where Y is the speed of the car 5. Design a function called get_max that takes as arguments three integers and returns the biggest of the three values. 6. Design a function called distance that takes four floating point numbers as arguments that represent 2 points and calculates and returns the distance between the two points. The formula for the distance between two points (x1,y1) and (x2,y2) is: d = ! (%)%+ (%)% The order of the arguments must be: the first 2 numbers are the x,y coordinate of one point and the second two numbers are the x,y coordinate of the second point. RECALL: including math.h gives you access to a square root function and a power function! The prototypes and descriptions of these functions are provided here for your reference: double pow(double x, double y) Returns x raised to the power of y. double sqrt(double x) Returns the square root of x. 7. Design a function called get_shipping_cost that takes the weight of the letter in kgs and the length and width of a letter in cm and calculates and returns the cost of shipping that letter. Each argument is a floating point number. This function must call the get_rectangle_area function. The rules for shipping cost calculations are as follows: If the letter is not bigger than the max area of 282cm2 and the weight is not more than 0.05kg it is a standard size letter and should be charged: $1.05 for the baserate + additional 2 cents per 1 gram of weight above 0.03kg Otherwise the letter is non-standard and should be charged: $1.90 for the baserate + additional 0.5 cents per 1 gram of weight above 0.1kg Example: If the package is 12 by 10 cm and weighs 0.24 kgs, it is a non-standard package and 140 grams over the 0.1kg non-standard weight limit, therefore the shipping cost should be approximately: 1.90 + 1.4 * 0.5 = 2.6

pls use C programming language

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

More Books

Students also viewed these Databases questions

Question

=+3. What are the organization's task goals on this issue?

Answered: 1 week ago