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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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