Problem build a class for a type called fractionnbspthis

Assignment Help Application Programming
Reference no: EM13346808

Problem: Build a class for a type called Fraction. 

This class is used to show a ration of two integers.  Include mutator functions that allow the user to set the numerator and the denominator.  Also, add a member function that returns the value of the numerator divided by the denominator as a double.  Include another member function that outputs the value of the fraction reduced to the lowest terms. 

For illustration, instead of outputting 20/60 the function should output 1/3.  This requires finding the greatest common divisor for the numerator and denominator, and then dividing both by that number.  Embed your class in a test program.  
 
For example, Write a test program that asks the user for an integer numerator and integer denominator, print the real number from evaluating the fraction, and then print the fraction reduced to its lowest terms.

Enter a numerator: 20
Enter a denominator: 60
The result of your fraction is .333333.
Your fraction in lowest terms is 1 / 3.
 
Prepare a Temperature class that internally stores a temperature in degrees Kelvin. 

Create functions named setTempKelvin, setTempFahrenheit, and setTempCelsius that take an input temperature in the specified temperature scale, convert the temperature to Kelvin, and store that temperature in the class member variable.  Also, create functions that return the stored temperature in degrees Kelvin, Fahrenheit, or Celsius. 

Write a main function to test your class.  Use the equations shown next to convert between the three temperatures scales.

Kelvin = Celsius + 273.15

Celsius = (5.0 / 9) * (Fahrenheit - 32)
 
For example, you might ask the user which kind of temperature he/she wants to enter, and then output the temperature in Kelvin, Fahrenheit, and Celsius.

Which kind of temperature would you like to enter (Kelvin (1), Fahrenheit(2), or Celsius(3))? 1

Enter your temperature: 20.0

Your temperature in Kelvin is 20.

Your temperature in Celsius is -253.15.

Your temperature in Fahrenheit is -423.67.

Reference no: EM13346808

Questions Cloud

Pulse width modulatorpart-1introduction a pulse width : pulse width modulatorpart-1introduction a pulse width modulation pwm circuit works by varying the duty cycle of the
Write the code and output screendesign a base class shape : write the code and output screendesign a base class shape with virtual functionsvoid drawgrapicwindowamp win constvoid
The open university running club ourc has engaged the : the open university running club ourc has engaged the services of a web design consultancy to develop a dynamic website
The schematic of the traffic light controller is as shown : the schematic of the traffic light controller is as shown in figure. there are three control buttons on the panel haz
Problem build a class for a type called fractionnbspthis : problem build a class for a type called fraction.nbspthis class is used to show a ration of two integers.nbsp include
1 let x1 be a random variable with probability function : 1 let x1 be a random variable with probability function given in the table belownbsp nbsp nbsp nbsp nbsp nbsp nbspnbsp
Question 1for a blackbody the frequency at which maximum : question 1for a blackbody the frequency at which maximum energy is emitted is 3 x 1013 hz a. give a wavenumber for
Amultiply x by x7 x5 x3 1 in gf28mod x8 x4x3x1b i verify : a.multiply x by x7 x5 x3 1 in gf28mod x8 x4x3x1.b. i verify that x6 x is the inverse of x5 x4x2 x 1in gf 28 mod x8
1 plot the bremsstrahlung emitted intensity vs energy from : 1. plot the bremsstrahlung emitted intensity vs energy from a copper target for i both 15 kev and 30 kev electrons ii

Reviews

Write a Review

Application Programming Questions & Answers

  If the user wants to read the input from a file then the

if the user wants to read the input from a file then the output will also go into a different file. if the user wants

  Imagine that your company has decided to expand to the web

imagine that your company has decided to expand to the web. you want to reuse some data entry code that has been

  Basic requirementsscreen one has three edittext views and

basic requirementsscreen one has three edittext views and one button.the edittext views allow you to enter a students

  Rtl sa is a company which develops bespoke solutions for

rtl sa is a company which develops bespoke solutions for the rubber industry. they produce both rubber compound which

  Create a application using the mvc architecture no

create a application using the mvc architecture. no scripting elements are allowed in jsp

  Question 1we are given the following knowledge base of

question 1we are given the following knowledge base of travel informationnbspbycaraucklandhamilton.

  In this project you will create an application to run in

in this project you will create an application to run in the amazon ec2 service and you will also create a client that

  Design a program that models the worms behavior in the

design a program that models the worms behavior in the subsequent scenarioa worm is moving toward an apple. each time

  1 here is a short program it prints out the value of a

1. here is a short program. it prints out the value of a variable x. ernie and bert disagree about what will be printed

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