Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ #include #include #include using namespace std; / The Feet Inches class holds distances measured in feet and inches. class Feet Inches { private: int

image text in transcribed
image text in transcribed
image text in transcribedC++
image text in transcribed
image text in transcribed
image text in transcribed
#include #include #include using namespace std; / The Feet Inches class holds distances measured in feet and inches. class Feet Inches { private: int feet; // The number of feet int inches; // The number of inches /** The simplify method adjusts the values in feet and inches to conform to a standard measurement. */ void simplify { if (inches > 11) { feet = feet + (inches/12); inches = inches * 12; 2 / This constructor assigns to the feet and inches fields. public: Feet Inches) { feet = 0; inches = 0; ) This constructor accepts two arguments which are assigned to the feet and inches fields. The simplify method is then called. @param The value to assign to feet. @param 1 The value to assign to inches. / Feet Inches(int f, int i) { feet = f; inches = 1; simplify(); 3 The following is a copy constructor. It accepts a reference to another Feet Inches object. The feet and inches fields are set to the same values as those in the argument object. @param object2 The object to copy. ./ Feet Inches (const Feet Inches& object2) feet = object2.feet; inches = object2. inches; { ) / The setFeet method assigns a value to the feet field. @param f The value to assign to feet. void setFeet(int f) { feet = f; } / The set Inches method assigns a value to the inches field. @param 1 The value to assign to inches. * void setInches(int 1) { inches = i; simplify(); ) /. get Feet method @return The value in the feet field. */ int getFeet() ( return feet; 3 /*. getInches method @return The value in the inches field. */ int get Inches) { return inches; print method prints the distance as feet/inches void print() { cout > ft; cout > in; g. setFeet(ft); g. set Inches(in); cout

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago

Question

Do you currently have a team agreement?

Answered: 1 week ago