Define a class for a type called fraction

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

 Define a class for a type called Fraction. This class is used to represent a ratio of two

integers. Include mutator functions that allow the user to set the numerator and the

denominator. Also include a member function that returns the value of numerator /

denominator as a double (precision set to 5). Include an additional member function

that outputs the value of the fraction reduced to lowest terms, e.g. instead of

outputting 20/60 the method should output 1/3. This will require finding the greatest

common divisor for the numerator and denominator, and then dividing both by that

number. Embed your class in a test C++ program. Example input/output is shown

below. (25 Points)

Input:

20 60

Output:

0.33333 1/3

4. Write a C++ program that would take two 3x3 matrix and outputs the results of

addition, subtraction, and multiplication. Create a class that can internally store two

3x3 matrices and has three member functions: one that performs addition, one that

performs subtraction, and one that performs multiplication. Use this class in your

program. Example input/output is shown below. (25 Points)

Input:

1 1 1

2 2 2

3 3 3

1 2 3

1 2 3

1 2 3

Output:

2 3 4

3 4 5

4 5 6

0 -1 -2

1 0 -1

2 1 0

3 6 9

6 12 18

9 18 27

 

 

Reference no: EM13166835

Questions Cloud

User can input an odd number in the range from 1 - 25 : this pattern (9 rows), modify your program so that your user can input an odd number in the range from 1 - 25 for the number of rows in the diamond.
Write a program to help the weatherman with weather report : write a program to help the weatherman with his weather report. you will sample the temperature each hour on the hour over the course of 24 hours
What would be the volume of this gas at stp : A sample of neon is collected at 2.7 atm and 12.0 C. it has a volume of 2.25L.What would be the volume of this gas at STP?
What mass of sucrose should be combined : What mass of sucrose should be combined with 521 of water to make a solution with an osmotic pressure of 8.15 at 285 ? (Assume the density of the solution to be equal to the density of the solvent.)
Define a class for a type called fraction : Define a class for a type called Fraction. This class is used to represent a ratio of two integers. Include mutator functions that allow the user to set the numerator and the denominator.
What is the flask volume : What is the flask's volume?
What volume of hi at the same temperature and pressure : At a certain temperature and pressure 2.1 L of H2 reacts with 2.1 L of I2. If all the H2 and I2 are consumed, what volume of HI, at the same temperature and pressure, will be produced?
Explain why acetone in the cyclohexane would invalidate : Explain why acetone in the cyclohexane would invalidate the experiment?
Determine the molarity of the acid : A 100.0 mL of acetic acid solution of unknown molarity is titrated with 0.15 M NaOH solution. The titration requires 43.25 mL of the base. Determine the molarity of the acid, CH3COOH.

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