Imagine we want to add to the sterling class

Assignment Help Computer Engineering
Reference no: EM1331701

British pounds-shillings-pence money notation:

Design a class: pounds (type long), shillings (type int), pence(type int) data items.
create following member functions:
- no-argument constructor
- one-argument constructor, taking type double(for converting from decimal pounds)
- three-argument constructor, taking pounds, shillings and pence
- getSterling() to get an amount in pounds, shillings and pence from the user,
format $9.19.11
- putSterling() to display an amount in pounds, shillings and pence, format $9.19.11
- addition (sterling + sterling) using overloaded + operator
- subtraction (sterling - sterling) usind overloaded - operator
- multiplication (sterling * double) using overloaded * operator
- division (sterling / sterling) using overloaded / operator
- division (sterling / double) using overloaded / operator
- operator double (to convert to double)

- a penny can be further divided into halfpennies and farthings -> farthing worth 1/4 of a penny. There was a halfpenny coin, farthing coin, halffarthing coin.
it can be expressed in eights of a penny:
1/8 penny is a halffarthing
1/4 penny is a farthing
3/8 penni is a farthing and a half
1/2 penny is a halfpenny
5/8 penny is a halfpenny plus a halffarthing
3/4 penny is a halfpenny plus a farthing
7/8 penny is a halfpenny plus a farthing and a half

Assume we want to add to the sterling class the ability to handle such fractional pennies. The I/O format can be something like $1.1.1-1/4 or $9.19.11-7/8, where the hyphen separates the fraction from the pennies.

Derive a new class called 'sterfrac' from 'sterling'. It should be able to perform the four arithmetic operations on sterling quantities that include eights of a penny. Its only member data is an int indicating the number of eights; you can call it 'eights'.You'll need to overload many of the functions in 'sterling' to handle the eights. The user should be able to type any fraction in lowest terms, and the display should also show fractions in lowest terms.

Reference no: EM1331701

Questions Cloud

Standard form contracts : Standard and bespoke contracts - Compare the relative advantages and disadvantages of standard form contracts and "bespoke" individually negotiated contracts
Describe the potential strategies : Describe the potential strategies that are revealed by aligning Henkel's internal strengths and weaknesses
Show the problems involved in defining a grievance : Show the problems involved in defining a grievance, indicating why a broad definition of employee grievances is both confusing and necessary.
Integrated relationship development : Would the same rules for integrated relationship development also apply to customers? Why or why not?
Imagine we want to add to the sterling class : a penny may be further divided into halfpennies and farthings -> farthing worth 1/4 of a penny. There was a halfpenny coin, farthing coin, halffarthing coin.
Important for organization to view components of staffing : Human resources - Why is it important for the organization to view all components of staffing (recruitment, selection, and employment) from the perspective of the job applicant?
Explaining cultural dimensions theory : After researching the cultural dimensions theory, complete the following tasks: Go to http://www.geert-hofstede.com and identify how values in the United States compare to the world average in the following 3 categories.
Law governing product liability and anti-competition : The laws governing both product liability and anti-competition in the USA, EU, China and Japan.
Incentives as an employee motivator : Incentives as an Employee Motivator - Incentives or "pay for performance" can be a powerful employee motivator. It can take a variety of forms of compensation and can be measured in multiple ways.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is the cookie

What is a cookie? What are advantages and disadvantages of using cookies in a web application.

  Changing the web-based email system

Explain an example of an email message which you could transmit to the user of this Web-based email system and that could enable you to read all of that users email.

  Multiple functions with input/output parameters

Write down a menu program which will print different formulas and perform the calculations. For every menu choice, show the formula and prompt for essential values. Then calculate and print area and perimeter.

  Using a while structure for designing pseudocode

By using a WHILE structure for designing the pseudocode in order to prepare a monthly report for the legal clinic.

  Economic life of technology product

Explain what do you understand by the economic life of a technology product. Discuss how does economic life of the technology product is compared with the technology life and product life?

  The hard drive will the original query take

suppose (somewhat artificially) that RAM can hold 200 rows and devotes half of that to reading one table and half to reading the other table and has "other places" to store the subquery/query results.

  What is total capacity of a track

What is total capacity of a track

  Benefit and drawback of each major operating system

Benefit and drawback of each major operating system

  Define the differences among the computer forensic tools

Discuss some of the several backup tools available in the market. What are differences among the computer forensic tools?

  Design and organize forensics report

When the investigation is complete and facts and findings are captured within your forensics report you should assure that the forensic report is organized in the correct manner and you are prepared for the courtroom testimony. Explain the details..

  The evolution of a health care information system

Discussion of an evolution of a health care information system, such as order entry results reporting, electronic health record, office-based medical records, or others. Include the following.

  Initialize the loop control variable before the program

In boy of the loop, I need to multiply the value of the loop control variable by 10 and by 100, then I want to change the value of the loop control variable in the body of loop.

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