Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will create a Measurement class. A Measurement object will store an integer value for the size in feet and an integer

In this assignment you will create a Measurement class. A Measurement object will store an integer value for the size in feet and an integer value for the size in inches. A Measurement object should store the value of 30" (inches) as 2 feet, 6 inches (2' 6"). When a Measurement object is created or modified the values for feet and inches may need to be adjusted. For instance, given A Measurement object storing feet = 5, inches = 11 if you add 7 feet 9 inches to it you would get 12 feet, 20 inches. This would need to be simplified to get the inches to be less than 12. 20 / 12 --> 1, 20 % 12 = 8 so the new values would be 13 feet, 8 inches.

Overload operators for:

addition

subtraction

multiplication by an integer [ provide for an expession like m1 * 3 where m1 is a Measurement object ]

assignment

relational operators ( <, <=, >, >=, ==, != )

stream operators ( stream extraction >> and stream insertion << )

Provide appropriate get and set functions. Provide a function to display the "state" of a Measurement object. For example: [5 feet, 7 inches]

Your class declaration (aka specification) should be stored in a header file. Your class definition (aka implementation) should be stored in a C++ source file.

Create a driver program that will create Measurement objects and execute the different operations provided by the Measurement class (object creation, input, output, assigment, comparison, addition, subtraction, multiplication, and display the state of the object). Only integer values should be used for the feet and inches.

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

Students also viewed these Databases questions