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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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