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

Assignmentindent code and insert comments to document your

Assignment Indent code and insert comments to document your program. Program must be implemented and run as instructed. Source file and executable are placed in a folder. Define the class with the name BankAccount to sto ...

1 devise a register-allocation strategy on the assumption

1. Devise a register-allocation strategy on the assumption that we automatically store all registers on the stack before each procedure call and restore them after the return. 2. Construct the register-interference graph ...

Assignmentreference this assignment is an object oriented

Assignment Reference: This assignment is an object oriented version of the In-class assignment. The functionality supported for a single vehicle in ICA 01 would be extended to multiple vehicles using a single class Car, ...

Generate code for the following three-address statements

Generate code for the following three-address statements assuming stack allocation where register SP points to the top of the stack. a) x = 1 b) x = a c) x = a + 1 d) x = a + b e)The two statements x = b * c y = a + x

Assignmentin this assignment you will implement a

Assignment In this assignment, you will implement a simplified gradebook. Your application should: Ask for a student's name. Ask for how many letter grades will be inputted. After all of the valid letter grades are enter ...

Assignmentaverage salary of major league baseball

Assignment Average Salary of Major League Baseball Players Create an application that calculates the average and highest salary of Major League Baseball players in 2011 and 2012. When the user clicks a button, the applic ...

Assignment introduction to computer sciencepart a this

Assignment: Introduction to Computer Science Part A: This question is to be submitted to the instructor in the form of a Word (or OpenOffice) document containing the Java code and appropriate screen capture(s) of the out ...

Assignment problem missing number gamewrite the missing

Assignment Problem: Missing Number Game Write the Missing Number Game Program. You will write a program that will allow a user to play the missing number game.  The game will display a 4 (rows) x 3 (columns) board of num ...

Design a class named pet which should have the following

Design a class named Pet, which should have the following fields: •Name - The name field holds the name of a pet. •Type - The type field holds the type of animal that is the pet. Example values are "Dog", "Cat", and "Bir ...

Computer science assignmnetuse this Computer Science Assignmnet use this program

Computer Science Assignmnet use this program http://snap.berkeley.edu/snapsource/snap.html# The assignment is to create a block to simulate coin tosses in snap. The block should take in 2 parameters, the number of coin t ...

  • 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