Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Overview

creating an object-oriented, multiple-file project and class definition

involving the use of static data members, overloaded operations and class friend functions used

to manipulate lengths expressed in the English system of measurements: yards, feet and

inches. It will require you to create a class called Length and exercise the class functions from a

menu-driven main() function.

Requirements

Class Length should have the following data members:

? int yards; //Holds the equivalent number of yards, can be any positive value

? int feet; //Holds the equivalent number of feet between 0 and 2

? int inches; //Holds the equivalent number of inches between 0 and 11

? static int lengthCount; //Holds the current number of Length objects in existence

Class Length should also have the following function members:

? Constructor(s): You need a default constructor (one that takes no parameters) and one

that takes 3 (for inches, feet, yards). You can do this with two separate functions, or a

single function with defaults for everything. The default value for a Length is 0 in all data

members. The constructor should also increment the static variable lengthCount.

? A destructor. This should decrement the static variable lengthCount.

? A display function - to display all data members of a Length object

? Four accessor functions - to access the yards, feet and inches data members, and the

length counter.

? Overloaded operators as member functions for addition (+), and subtraction (-).

? Overloaded operators for comparisons for greater than, less than, and equality (<, >,

==).

? Two overloaded operators as friends: input ( >> ) and output (<<).

? A private member function that converts lengths to "lowest terms," in which the number

of inches is in the range from 0-12 and the number of feet in the range 0-2. (A Length of

5 feet 16 inches 'reduces' to 2 yards, 0 feet, 4 inches, for example.)

The main() driver function is to create an array of at least four objects of class Length and

initialize all data members to default values. The menu portion of main should allow the user to

select any of the following options:

? Display all Length objects' measurements

? Edit a selected Length object. You should use the overloaded operators to display the

current values and to enter the new values for the selected object.

? Add two selected Length objects measurement (the result is a new Length object)

? Subtract a selected Length objects measurement from another (again, the result is a

new Length object.) Your main program is required to ensure that the shorter length is

subtracted from the longer one so the result is always >= 0 and to prevent any negative

results.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9452554

Have any Question?


Related Questions in Computer Engineering

What are the typical types of risk faced by a firm explain

What are the typical types of risk faced by a firm? Explain each type of risk in details.

Assume that the pizza market consists of two firms conans

Assume that the pizza market consists of two firms, Conan's and Pizza Hut. The price of a Conan pizza is denoted by Pc and the price of a Pizza Hut Pizza is P h.  Both sellers have a marginal cost of $5 for another pizza ...

Total cholesterol in children 10 to 15 years of age is

Total cholesterol in children 10 to 15 years of age is assumed to follow a normal distribution of 191 and a standard deviation 22.4. What proportion of children 10 to 15 years of age has total cholesterol between 180 and ...

Question a student study 0 1 2 or 3 hours for a math 307

Question : A student study 0, 1, 2, or 3 hours for a MATH 307 test on any given day. Use the tree diagram to find the total number of ways in which the student can study at most 4 hours for the test on two consecutive da ...

As the school year begins what trends are taking place with

As the school year begins, what trends are taking place with Educational Technology in schools?

A bird is flying around the world at a rate of 256ftmin how

A bird is flying around the world at a rate of 25.6ft/min. How many weeks will it take to compete it's journey if the circumference of the earth is25,000 miles using factor label method.

Question suppose a problem can be solved with two different

Question : Suppose a problem can be solved with two different algorithms, A or B. Algorithm A has a time complexity of TA = 17n, and algorithm B has a time complexity of TB = 0.5n 2 . Give the range of n for which it is ...

The systems development lifecycle sdlc provides a

The systems development lifecycle (SDLC) provides a standardized process for all phases of any system development. What are the different phases involved in SDLC give a brief note on all its phases in your own words. (no ...

Explain a business process you are familiar with describe

Explain a business process you are familiar with. Describe how a computer-based information system is related (or used) in this business process. Explain how a computer-based information systems can improve the efficienc ...

There is a formula that calculates what a lifetime and

There is a formula that calculates what a lifetime and loyal customer contributes to long term profit and it is an astounding amount. Question - How would a company achieve such a feat?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As