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 namedas ‘add’ adds the given two linear equations and updates the first linear equation with the result andthe second function named as ‘print’ prints the given sum in the format ‘ax + b’ where a is thecoefficient of x and b is the constant. Take a and b of both the linear equations as input fromscanner. Consider a and b to be positive integers.Input Format :Line 1 : Two integers- a and b of 1st linear equationLine 2 : Two integers- a and b of 2nd linear equationSample Input 1 :2 31 5Sample Output 1 :3x + 8
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here