Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include fractionType.h using namespace std; int main() { fractionType num1(5, 6); //Line 1 fractionType num2; //Line 2 fractionType num3; //Line 3 cout cout

image text in transcribed
image text in transcribed
#include
#include
#include "fractionType.h"
using namespace std;
int main()
{
fractionType num1(5, 6); //Line 1
fractionType num2; //Line 2
fractionType num3; //Line 3
cout
cout
cout
cout
cout
cout
cin >> num2; //Line 10
cout
cout
//Line 12
num3 = num1 + num2; //Line 13
cout
cout
cout
num3 = num1 - num2; //Line 17
cout
cout
cout
cout
cout
cout = ("
= num2)
cout
cout ("
num2)
cout
return 0;
}
Problem Description: (30 marks) Task-1: Rational fractions are of the form a /b, in which a and b are integers and b 0. In this exercise, by fractions" we mean rational fractions. Suppose a/b andc/dare fractions. Arithmetic operations and relational operations on fractions are defined by the following rules: Arithmetic Operations: a/b tcld-(ad+bc)/bd (a/b)/(c/d)-adbe, in which cel #0 Relational Operations: (abs-cia)- (ad-be) (ab-c/d) = (ad-bc) Fractions are compared as follows: a/b op c / d if ad op bc, in which op is any of the relational operations. For example, a/bx should store 2/3 in x The statement: cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions