Creating an object-oriented, multiple-file project and class

Assignment Help Basic Computer Science
Reference no: EM13162431

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.

Reference no: EM13162431

Questions Cloud

How many mol of co2 are produced : how many mol of CO2 are produced for every mol of pentene reacted. The chemical reaction is pentene + oxygen = carbon dioxide + water.
What is the percentage yield : When 36.8g of benzene reacts with an excess of chlorine gass, the acual yield of 38.8g what is the percentage yield?
Discuss the role of capital in banking : Examine the role of Bank of England's monetary policy instruments in dealing with the recent financial and economic crisis and discuss the role of capital in banking
Explain why do primary alkyl halides typically undergo : Why do primary alkyl halides typically undergo SN2 substitution reactions more rapidly than do secondary or tertiary alkyl halides?
Creating an object-oriented, multiple-file project and class : Overview creating an object-oriented, multiple-file project and class definition involving the use of static data members,
What mass in grams of carbon dioxide is produced : What mass in grams of carbon dioxide is produced if 85.0 mol of magnesium carbonate, MgCO3, are heated and allowed to decompose according to this equation? MgCO3(s)--> MgO(s) + CO2(g)
Calculate the masses of the reactants : Calculate the masses of the reactants and products of the following equation. Please show work.
State what type of system is formed : If equal volumes of 0.15 NaOH and 0.10 NaH2PO4 are mixed what type of system is formed? A) Buffer Ka2 B) amphiprotic C) Buffer Ka3 D) strong base
What are the freezing point and boiling point of an aqueous : what are the freezing point and boiling point of an aqueous solution of 15.5g glucose (c6h12o6) dissolved in 150 g of water?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  How much of program-s time slice can be spent waiting

Desired data to rotate around to the read/write head, how much of a program's time slice can be spent waiting for a read operation from a disk to take place?

  Maslow hierarchy of needs

Discuss and explain how the theory designates the team member roles and responsibilities also discuss how Maslow's Hierarchy of Needs applies to professional work dynamics.

  Store configuration information on motherboard in cmos

Why do you believe the trend is to store configuration information on the motherboard in CMOS setup rather than by using jumpers or switches?

  How cultural differences in colors and images are perceived

What are some examples of cultural differences in how colors and images are perceived? How would you change the colors and images on your website to appeal to a wider global audience.

  Use map to define convert-euro converts list of us dollars

Use map to define the following functions: convert-euro, which converts a list of U.S. dollar amounts into a list of euro amounts based on an exchange rate of 1.22 euro for each dollar.

  Perceptions of product create its personality

Perceptions of product create its personality. Bottom, round the back. And even there they are ugly. Is that essential? Could they not, in some small degree, give pleasure?

  Design circuit buffer last-in first-out lifo

I want design circuit this Buffer(LIFO). This blocking is for FIFO memory but i want design circuit Buffer Last-in First-out LIFO 4*4

  Corporate or government agency policy on instant messaging

What specific questions must a corporate or government agency policy on "Employee use of Instant Messaging (IM) using corporate computers" address?

  Adding two unsigned and signed binary numbers

Add the two binary numbers and interpret the sum assuming that the numbers are (1) unsigned, and (2) signed.

  Evaluate for risk management purposes

Choose three information assets that a typical organization has and evaluate for risk management purposes which vulnerability should be evaluated for additional controls first?

  Relative risk comes form inside the organisation

Write a report on relative risk that comes form inside organisation as opposed to risk which comes from external sources.

  Find datagrams needed to send mp3 of several bytes

Suppose 20-byte TCP header and 20-byte IP header, how many datagrams would be needed to send MP3 consisting of 4 million bytes? Illustrate your work.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd