Program to implement an abstract data type rational-numbers

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

You are writing a program to implement an abstract data type Rational-Numbers. A rational number has two parts, numerator and denominator. Example 1/2 and 3/5 are rational numbers. You can perform math operations on rational numbers and the results are rational numbers. The following are the operations you are to implement.

Test your code with the following data:

Rational numbers: a = 3/8, b= 4/7, c = 1/5, d = 4/12, e = 3/5 f = 4/1 and g = 3/0 (your program should not error)

Compute and output the two rational numbers and their results: a + b, c * d, d / e, c - a

Below is where I am stuck:

Compute a+b*f - d print results

Compute d / a + c print results

Print out 'g' above.

Compare d == b Print both operands and the results.

Compare e != a Print both operands and the results.

Attachment:- rationalheader.zip

Reference no: EM13936596

Questions Cloud

What purpose do you feel the visual arts serve : Devise a definition of art that has meaning for you. What purpose do you feel the visual arts serve? What gives art meaning? Share your thoughts with the class
What are two or three differences between the two mammals : What are two or three differences between the two mammals? To what order does each of the mammal species you selected belong? Describe why they are classified. List two other species that belong to those same orders. The said questions are applied..
Multiple levels of virtual machines : Given a (very) tiny computer that has a word size of 6 bits, what are the smallest negative numbers and the largest positive numbers that this computer can represent in each of the following representations?
Explain how energy moves through an ecosystem : Great Barrier Reef: Explain how energy moves through an ecosystem. Start with producers, move up to keystone predators, and complete the energy flow by including the decomposers.
Program to implement an abstract data type rational-numbers : You are writing a program to implement an abstract data type Rational-Numbers. A rational number has two parts, numerator and denominator. Example 1/2 and 3/5 are rational numbers. You can perform math operations on rational numbers and the result..
Explain why glucose and palmitic acid : Explain why glucose and palmitic acid differ in their water solubility. Predict which molecule would more readily cross a biological membrane composed entirely of phospholipids and justify your reasoning.
What is the current plight of the honey bee : Pick a plant and an animal and tell me how these how plants and animals arrive, find, migrate or develop their habitat, respond to the food chain, climate and other living and non living factors. Give an example or short explanation of each. This ..
Argument to analyse the supplied assignment case study : Use the Toulmin's Model of Argument to analyse the supplied Assignment Case Study (see the Assignment Case Study section below) and provide your opinion on the strength or weakness of the argument with relation to the Claim that we have provided. ..
Explain photosynthesis : Explain photosynthesis and why it occurs in plants and not animals.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Takes 100 number in an array

Write a program in c++ that takes 100 number in an array and add them and print the sum

  Write programs to play a card game

You will write two programs to play a card game ("clubs"). A separate document describing the rules of "clubs" will be provided.The first program (clubber) will listen on its stdin for information about the game and give its moves to stdout.

  Write a program that prompts the user to input the masses

Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies.

  Write down a program which will calculate and displays min

write down a program which will calculate and displays the min temperature and the maximum temperature for seven days of a week.

  C program to mips program

Convert the following C program to MIPS program. Assuming that i, j, k, f, are stored in registers $s0, $s1, $s2, $s3 already.

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  Write a program at level that will accept a lower case

Write a program at level 3 (Instruction Set Architecture Level) that will accept a lower case letter and output the uppercase version of the letter.

  Industry standards in configuration management and control

Information related to configuration management and preventative maintenance. Industry standards in configuration management and control. Training approaches to allow for adaptive maintenance and confidence.

  Tcp terminate the new connection

If a copy of the old FIN is delivered, will TCP terminate the new connection? Why or why not? Can a router send request to another router for TCP connection? Give reason.

  Three dimensional array representing parking spaces

start with code in the file lab.cpp. This program works with a three dimensional array representing parking spaces in a parking garage on several floors. The code is incomplete. The functions "main", "display" and "showSpace" are complete. Your job i..

  How the function delete can be implemented for arrays

Explain in details how the function Delete() can be implemented for arrays to function exactly as it would with lists. Use pseudo code to clarify your explanation.

  Programming assignment is to tweak the existing mammal

programming assignment is to tweak the existing Mammal program and create your own Vehicle program.

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