Problem 2: orientation Write a program that prompts the user to enter the width
ID: 3648622 • Letter: P
Question
Problem 2: orientationWrite a program that prompts the user to enter the width and height of a picture. The program should respond with "portrait", "landscape", or "square", depending on which dimension is greater.
Example:
Input the width and height of a picture: 12 8
landscape
Problem 3: package
The US Postal Service says that a package is oversize if its length + girth is greater than 84 inches.
Prompt the user to enter the length, width, and height of a package, in inches as floats. You may assume the length is the first number given and is always the biggest number.
The programs calculates whether the package is oversize and displays "oversize" or "regular".
Example:
Enter the length, width, and height of a package: 45.3 10.5 16
oversize
Explanation / Answer
using namespace std; class rectangle { private: double length; double width; public: void theLen(double length); void theWid(double width); double calculateArea (); double calculatePerimeter(); }; void rectangle::theLen(double L) { length=L; } void rectangle::theWid(double W) { width=W; } double rectangle::calculateArea() { double A; A=length*width; return A; } double rectangle::calculatePerimeter() { double P; P=(length+width)*2; return P; } int main() { double length, Width; rectangle objectX; cout > length; objectX.theLen(length); cout > Width; objectX.theWid(Width); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.