Write a program to print the sum of two linear equations by creating a class named as ‘LinearEquations’ containing two data members, a and b and two functions. First function named as ‘add’ adds the...


Write a program to print the sum of two linear equations by creating a class named as
‘LinearEquations’ containing two data members, a and b and two functions. First function named
as ‘add’ adds the given two linear equations and updates the first linear equation with the result and
the second function named as ‘print’ prints the given sum in the format ‘ax + b’ where a is the
coefficient of x and b is the constant. Take a and b of both the linear equations as input from
scanner. Consider a and b to be positive integers.
Input Format :
Line 1 : Two integers- a and b of 1st linear equation
Line 2 : Two integers- a and b of 2nd linear equation
Sample Input 1 :
2 3
1 5
Sample Output 1 :
3x + 8



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here