Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me on this I don't have time A straight line is expressed by the equation, y = mx + c where m is

please help me on this I don't have time

image text in transcribed
A straight line is expressed by the equation, y = mx + c where m is the slope of the line and c is the J-intercept, i.e. the y coordinate of the location where the line crosses the y-axis (see Figure I) y = mx + c hope m y-intercept C Figure I Define a class named Line whose attributes m and c to model a line. Use inline style to define the class. Use the provided template file, main.epp to write your code. The requirements for the program are as follows: 1. Define a constructor that accepts four parameters which are x1. yl, x2, and y2. representing the coordinates x and y of two points that the line passes through. The slope and y-intercept of the line are then calculated by: m = y2-v1 X2-x1 c = yl -mxl Declare this constructor such that it can also serve as a default constructor. In this case, it will model a line that passes through the points (0,0) and (1,I), which should result in m / and c=0. (4 marks)

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions