Question

A piece of wire is to be bent in the form of a rectangle to put...

A piece of wire is to be bent in the form of a rectangle to put around a picture frame. The length of the picture frame is 1.5 times the width. Write a program that prompts the user to input the length of the wire and outputs the length and width of the picture frame.

USING C++ language please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
   double lenOfWire;
   double lenPictureFrame = 0, widPictureFrame = 0;
   //prompt to get the length of the wire
   cout << "Enter the length of the wire: ";
   //getting and storing the length of the wire
   cin >> lenOfWire;

   //using the formula of the perimeter of the rectangle
   // 2(l+b) = perimeter of the rectangle
   // since the length is    1.5 times the breadth
   // hence equating it against the length of the wire
   widPictureFrame = (lenOfWire/2.5);
   // determine the length of the picture frame
   //once we get the width of the picture frame
   lenPictureFrame = 1.5 * widPictureFrame;

   //output to the console
   cout << "The length of the picture frame is " << lenPictureFrame << " and the width is " << widPictureFrame;
   return 0;
}

OUTPUT:

Enter the length of the wire: 25 The length of the picture frame is 15 and the width is 10

Add a comment
Know the answer?
Add Answer to:
A piece of wire is to be bent in the form of a rectangle to put...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT