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
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.
|