Question
In basic C++ please. Spring is coming. Bob is planning a rectangular garden in his backyard. He needs to design the dimension (width1 x width2)
In basic C++ please.
Spring is coming. Bob is planning a rectangular garden in his backyard. He needs to design the dimension (width1 x width2) of his garden given the fences with a specific length in feet. Write a program to help him decide whether a dimension design is achievable or not. The program will take three integers as input in the following format
and returns whether the specified dimension is achievable with the given fence.
Ex: if the input is
28 5 8
the program will output
The suggested dimension is achievable.
If the input is
28 7 8
the program will output
The suggested dimension is not achievable. 2 more feet of fences are needed.
Here the value of 2 is computed from the difference 28 - 2*(7+8) (returned by the following function).
You Must define and call the following function that takes three parameters as input, including the given length of fences, width1 and width2 of the garden dimension (all are integers), and returns the remainder of the fences after setting the fences for the designed garden.
int validateDimension(int fenceLength, int width1, int width2);
Hint: the total length of fences needed for a rectangular garden with dimension (width1 x width2) is 2*(width1+width2).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started