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

  Freedom of expression in cyberspace-information society

Write down a 3 pages summary about "Freedom of expression in Cyberspace & Information Society " after reading at least one article in each point of view.

  How consultant choose optimal location of main pipeline

Given x & y coordinates of wells, how must professor consultant choose the optimal location of main pipeline (the one which minimizes total length of spurs).

  Creating an oracle

The clique problem itself is NP-hard. Thus you may not wish to have an oracle that runs in exponential time. Consider approach to approximate the solution.

  Merging transaction and analytical processing problem occurs

When merging transaction and analytical processing a problem occurs. Real-time analytical processing diminishes the performance of transaction processing. What is the solution to this problem that many companies use?

  Create the data model segment for business rules

The FlyRight Aircraft Maintenance (FRAM) division of FlyRight Company (FRC) does all maintenance for FRC's aircraft. Create the data model segment which reflects the following business rules.

  Explain vulnerability in the system

How would you respond if Goli came to you describing a vulnerability in your system and offering to help fix it--What would incline you to hire her? What would disincline you from doing so?

  Techniques in discovering requirements for a system

What are some of the techniques in discovering requirements for a system? Which ones work best? Which ones are the most economical?

  Briefly explain how a penetration tester could assess risk

Briefly explain how a penetration tester could assess the risk involved with identified vulnerabilities.

  Explain different kinds of feasibility studies

When deciding whether to buy and implement digital dashboard or management cockpit sometimes a feasibility study is conducted.  Explain the different kinds of feasibility studies.

  Explain response time for jobs in observed system

Explain the response time for jobs in observed system? As function of N, number of terminals, give high-load bounds for throughput and response time; also provide low-load bounds.

  What is primary security risk users acknowledge using macros

Write a 200- to 300-word response that answers the following question: Based on the article by Lenning (2005), what is a primary security risk that users should acknowledge when using macros?

  Designing a 4-to-16 decoder using not gates

Draw 4-to-16 decoder by using components. You must not use any extra components.

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