Design and implement an immutable fraction class

Assignment Help Business Management
Reference no: EM132261094

Please solve this question in C++

Program Description:

Design and implement an immutable Fraction Class described in the Fraction case study. Your class must have the following methods to emulate arithmetic, relational, and I/O operations on Fractions.

1. Arithmetic operators: + - * /

2. Relational operators: < <= > >=

3. Equality operators: == !=

4. Stream Extraction: >> (i.e. 3/7 form)

5. Stream Insertion: << (i.e. 3/7 form)

6. Method to reduce fraction

Specific Requirements:

  • Your main testing program may only have two variables: start and userFraction which are both of type Fraction.
  • start should contain values set by you that are passed into the constructor.
  • userFraction should start out calling the default constructor and then have its values set through the overloaded >> operator.
  • There are to be no get/set methods for the Fraction class. Having get/set methods in your class will cause you to lose significant points.
  • Note that the testing program displays the words true or false for the relational operator testing.Be sure to test your program with several different fractions, but for your output you report to me, use the exact test values from the example output. Demonstrate all methods implemented.

Helpful notes:

  • You should create a .h file and two different .cpp files for this lab.
  • You will not need to create a destructor.
  • You may consider making a private helper function or two for simplifying your fraction.

Grading Rubric:

1. Correctness (meets specification) 5 points

2. Design (well-constructed solution) 2

3. Validation & Verification (Testing) 4

4. Style (readable for your client - me) 1

Example output:

*****Fraction Demonstration*****

We will start with the fraction 3/5

Enter a new fraction:

Numerator: 6

Denominator: 8

Your simplified fraction is: 3/4

********************************

Demonstrating overloaded math operators: -, +, *, /

This will show negation of 3/5 and then our two fractions

3/5 and 3/4 added, multiplied, and divided.

-: -3/5

+: 27/20

*: 9/20

/: 4/5

********************************

Demonstrating overloaded relational operators: <, <=, >, >=, == !=

by comparing 3/5 with 3/4.

<: true

<=: true

>: false

>=: false

==: false

!=: true

********************************

Reference no: EM132261094

Questions Cloud

Write down the definition of the cyber domain : The Chief Information Officer (CIO) of the organization you chose in the Week 1 discussion, "Key Components of an Information System as Related to the Cyber.
Rewrite below guessbirthday : Program: (Guess birthday) Rewrite below GuessBirthday.java to prompt the user to enter the character Y for Yes and N for No rather than entering 1 for Yes and 0
Do you think that this might be something that you could do : Do you think that this might be something that you could do, and do you think it might be beneficial in helping you build cultural awareness and competency?
What negative consequences might follow : In a well-organized, two to three page essay discuss the case of NATIONAL FEDERATION OF INDEPENDENT BUSINESS ET AL. v. SEBELIUS. Be sure to include.
Design and implement an immutable fraction class : Design and implement an immutable Fraction Class described in the Fraction case study. Your class must have the following methods to emulate arithmetic
The data that jack has gathered qualitative in nature : Why are the data that Jack has gathered qualitative in nature? Describe three other techniques and/or sources to gather qualitative data.
What is being done to prevent sexual assault : The first would determine what is being done to prevent sexual assault on college campuses from occurring again in the future?
How complex organizations can be better perceived : The video A Systems Story provides an example of how complex organizations can be better perceived when applying a systems thinking perspective.
Calculate the average of the numbers in the list : Modify and complete the function asn2_2() so it accepts one parameter-a list of numbers-and returns the average (rounded to 2 decimal places)

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

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