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

  Implement a program for special atm machine

Association supplies the needy person with a pin number to be able to use the ATM machine - Implement a program for this machine. Your program must start by displaying a main menu.

  Write two short c programs and solve four exam-style

write two short c programs and solve four exam-style problems. details on the programs are as follows.program

  Write a program that simulates inventory bins in a warehouse

In C++, write a program that simulates inventory bins in a warehouse. Each bin holds a number of the same type of parts. The program should use a structure that keeps the following data:

  Questionnbspnbspi have a product called neverwet that

questionnbspnbspi have a product called neverwet that creates a hydrophobic surface on stuff. theres a base and top

  Write a programme on credit card number check

Credit Card Number Check. The last digit of a credit card number is the check digit, which protects againsttranscription errors such as an error in a single digit or switching two digits

  Store the numbers in an array

You need to write a program that will read the file 'unumbers.dat', store the numbers in an array, and then prompt the user to search the list for a number.

  Program two decimal places

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both  the mass and the weight rounded to two decimal places. (Note that for  standard Earth gravity, 1 kilogram =..

  Rational class performs operations on fractions

Write a C++ program that, using the rational class performs operations on fractions. Test your class thoroughly.

  What are four examples of how direction can be used

What are four examples of how "direction" can be used in an effective publication?

  Program to produce ten random permutations of numbers

In C++(must be able to compile in Visual Studio ): Write a program to produce ten random permutations of numbers 1 to 10.

  Preparing a high level language program

Describe the purpose of each step in preparing a high level language program for execution (editing, compiling, linking, and loading).  Include in your description the types of files created with each of the first three steps.?

  Design your own test program to test the modification.

Add method Modify(int id, char*, char*, float, char*) to modify the id's record. If such id not exist, add it as a new record into the list

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