Design a class: pounds (type long) and shillings (type int)

Assignment Help C/C++ Programming
Reference no: EM13937059

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: EM13937059

Questions Cloud

Explain the importance of sexual reproduction : As you can see in these three life cycles, those of higher organisms tend to emphasize the diploid stages more than the haploid stages. Explain why there has been a trend toward diploidy among higher organisms; what are the advantages of being dip..
What are the mix of product you wish to concentrate on : 1. What are the mix of product you wish to concentrate on? -how is your product similar/different to that of competitors
Evaluate its employees four times a year at the end of year : The data will be validated and saved to an output file,"datainput" . this program will use five arrays to grater manupliate and store the data.
Marketing luxury and masstige products : Students are required to undertake a review of ONE of the following topics; 1. Marketing Luxury and "Masstige" products 2. The value of Loyal customers
Design a class: pounds (type long) and shillings (type int) : Design a class: pounds (type long), shillings (type int), pence(type int) data items.
Generalizing the findings to the target population : What are some of the limitations of this study that decrease the potential for generalizing the findings to the target population - distribution of Mental Health scores for men is normal, where are 99% of the men's mental health scores around the m..
What are the basics of this hypothesis : The text indicates that the "hotshot" hypothesis best accounts for the evolution of lek polygyny in this species. What are the basics of this hypothesis.
Analyse information on market and business needs : What further information would you need to analyse information on market and business needs to identify marketing opportunities?
Topic of interest surrounding race and ethnicity : A research paper based on a topic of interest surrounding race and ethnicity, social change, or both. This Unit VIII research paper will be at least five pages in length and consist of information from at least four peerreviewed,scholarly articles to..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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