Ask Question, Ask an Expert


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

Purposethe purpose of this assignment is to practice using

Purpose: The purpose of this assignment is to practice using loops, selections, and other basic features of Java in order to solve a real-world problem. Program Description: The Jeddah Broker Company is one of the compan ...

Engineering programmingi need this now please accurate

Engineering programming I need this now please accurate answers and must be high rated Problem #1 Write a program that asks the user to input the number of miles and convert the miles to kilometers, and then print the ou ...

Assignmentyou will write a program that acts like a simple

Assignment You will write a program that acts like a simple calculator for binary numbers. You should read in a string of input that has the format: number operator number. Each of the numbers should be presented in two' ...

Add a swift class file to the project that illustrates and

Add a SWIFT class file to the project that illustrates and contains the following: • The class name is 'Calculator' • Has public variables of the type float called numerator, denominator and total. • Has a method called ...

Csis program homeworkwrite a program where the user will

CSIS program homework Write a program where the user will enter a number between 1 and 50 representing a state. The program should display the full name of that state. Assume the states are in alphabetical order, that is ...

Shell programmingyou have created the directory structure

Shell Programming You have created the directory structure and some base files to be used by the Web server and Web site. For the Web site to be created in a production environment, you need to package your commands in a ...

Integrative programmingassignment- managing a user account

Integrative Programming Assignment- Managing a User Account List Objective: To manage a user list that can be modified and saved to a text file. Inputs: • Input text file consisting of pairs of usernames and passwords, s ...

1 tic tac toein a tic tac toe game two players x and o take

1 TIC TAC TOE In a Tic Tac Toe game two players, X and O, take turns to mark the spaces in a 3X3 grid. The winner will be the player who first succeeds in placing three of his/her marks in a horizontal, vertical, or diag ...

Consider the following three programswhere i k l are low

Consider the following three programs: where i, k, l are low variables and a, b, c, d, h, n are high variables. Assume db is a database with two columns (shown as array, where the index represents the row), lookup and is ...

The given machine description will provide the basis for

The given machine description will provide the basis for this assignment. You will create a virtual machine/operating system for the machine described below that will accept programs in the target machine language. The d ...

  • 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

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate