Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Programming Language Expert

Problem1) Define the class for a type called Fraction. This class is used to represent a ration of two integers. Include mutator functions which permit the user to set numerator and the denominator. In addition, include a member function which returns the value of numerator divided by denominator as a double. Include another member function which outputs the value of the fraction reduced to lowest terms. Such as, instead of outputting 20/60 the function must output 1/3. This needs 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 ex, you may prepare a test program which 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.

Problem2) Create a Temperature class which internally stores a temperature in degrees Kelvin. Create functions named setTempKelvin, setTempFahrenheit, and setTempCelsius which 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 which return the stored temperature in degrees Kelvin, Fahrenheit, or Celsius. prepare the main function to test your class. Use equations shown next to convert between the three temperatures scales.

Kelvin = Celsius + 273.15

Celsius = (5.0 / 9) * (Fahrenheit – 32)

For ex, you may ask the user which type of temperature he/she wishes to enter, and then output the temperature in Kelvin, Fahrenheit, and Celsius.

Which type of temperature will 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.

In your implementation, ensure that you include the program header in your program, also to proper indentation/spacing and other comments!

Understanding the Problem

In your own words, describe what YOU think the problem is asking you to do. In this section, document your uncertainties about problem and anything else which you feel was unclear or vague. This is to make sure that YOUR understanding matches MY understanding of the problem.

Devising a Plan/Design

At a minimum, provide the algorithm/pseudo code you designed to help solve the problem. Also, include pictures/flow charts you used to help you devise your plan, as well as any other design decisions you made such as how to manage your time, how to decompose problem, where to start first, etc. You could scan any handwritten work and attach it to the document as needed.

Looking Back/Self-Reflection

Report any checking/self-reflection you did while solving the problem. For ex, how did you make sense of the output from the implementation? This includes things like using a calculator to ensure the output is accurate; testing to ensure your code runs correctly and behaves the way you expect under specific situation, using external sources of information like the internet to make sense of the results, etc.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91663

Have any Question? 


Related Questions in Programming Language

Develop a program that displays information about a family

Develop a program that displays information about a family member or friend. This program should print out information about what you like best about him or her. You might even describe your pet, if you have one. Present ...

Write 2 programsone program will use a structure to store

Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (such as East, West, North, or South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked f ...

The problem is design a class booktype that defines the

The problem is design a class bookType that defines the book as an ADT. requirements: each object of the class bookType can hold the following information about a book: title, up to four authors, publisher, ISBN, price, ...

1 write a program that reads input as a stream of

1. Write a program that reads input as a stream of characters until encountering EOF. Have the program report the number of uppercase characters, the number of lowercase characters, and the number of other characters rea ...

Create a program that allows the user to enter sets of

Create a program that allows the user to enter sets of integer values, in any order.Per set of data,the program is to output the largest number. EXAMPLE 1 Given the set of supplied values:(1,-3,22,-30),the program should ...

Generate code for the following three-address statements

Generate code for the following three-address statements again assuming stack allocation and assuming a and b are arrays whose elements are 4-byte values. a) The four-statement sequence x = a[i] y = b[j] a[i] = y b[j] = ...

Rainfall programwrite a rainfall program that stores the

Rainfall Program Write a RainFall program that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following: * The total rainfall for the year * The ...

Create a base class that will include the properties of

Create a base class that will include the properties of some type of data related to the company you work for or a favorite hobby. For example, I work for a healthcare provider, so my base class might be "Medical Facilit ...

Generate code for the given three-address statements

Generate code for the given three-address statements assuming all variables are stored in memory locations. a) x = 1 b) x = a c) x = a + 1 d) x = a + b e) The two statements x = b * c y = a + x

Assignmentan office building has 5 floors 4 levels above

Assignment An office building has 5 floors (4 levels above ground and a basement at level 0). There are 8 offices per floor, labeled A - H. This program will maintain data about the occupant type of employees in each off ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen