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

  Printing of fibonacci series

Write down a program which utilized a loop to determine the first seven values of Fibonacci number sequence explained by the following formula.

  Communicate to database engine via visual basic

The most internationally standardized language in order to communicate to the database engine is Visual Basic. Describe why would it be useful in order to have Data Sources window open?

  Identify the security provisions

Identify the security provisions

  Securing the web passwords

Describe how the Web passwords can be more secure. Give examples and/or details in order to support your ideas.

  Implementing the program for carrying out the calculation

Write down a program that has a function named presentValue which carry out this calculation. The function must accept the future value, annual interest rate, and number of years as arguments.

  Discuss the different types of project feasibility factors

List and discuss the different types of project feasibility factors.

  Program for calling the function

Suppose the availability of class named DataTransmitter which offers a static method, sendSignal which takes no arguments. Write down the code for calling this method.

  Pros and cons of application software in business

Operating system software for your personal PC: define What are the differences among Windows OSs

  How to write a c function named change()

The function should find the number of quarters, dimes, nickels, and pennies in the number passed to it and write these values directly into respective variables declared in its calling function.

  Detail advantages of looping

Detail advantages of looping

  Drawing the uml state diagram

In the chess game white and black make alternate moves. White takes first move. Both Black and White may finish the game: by winning, by giving up, by draw.

  Categorizing the threat

Download a password cracker developed for your operating system. Run the cracker on your system. Describe the results from cracker.

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