Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is a data structurs class. please answer question in c++ language. please answer the question following the coment lines, each comment line has what

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribedthis is a data structurs class. please answer question in c++ language. please answer the question following the coment lines, each comment line has what it requirments. program should be written in c++.
i dont understand the question
please just go ahead and solve the question. i still have a weak to review and submit it
Description: A line segment on a two-dimensional space has a defined length and is represented by two points. A point is given by two values (real numbers) x and y. In this project you are going to create three classes and methods for each class. You will then have a main program that will read in information on each line segment (x1, yl, x2, y2) and store the line segments (in an array that will be part of a class described below). We will then answer certain queries on these line segments that are stored (by invoking appropriate methods). Now let us begin by describing the classes you must have along with methods. Please note that you may have additional methods as you deem fit. In the code segments below, there may be syntax errors. It is your responsibility to fix, in case you need to. Also, keep watching for any updates on this project posted on canvas. Round all numbers to two decimal places. Point Class (More information on this is available on your textbook): Your Point class will have the following structure. class Point ( protected: double x; //x coordinate value double y; //y coordinate value public: Point (); //default constructor; x = 0.0 and y = 0.0 Point (double xvalue, double yvalue); /o-default constructor setLocation (double xvalue, double yvalue); // set x xvalue and // y yvalue double getxvalue (); //return x double getYvalue (); //return y void display (); // Print (0.0, 0.0) //other methods that are necessary LineSegment Class: A line segment consists of two Point objects and it has the following structure. class LineSegment { protected: Point Pl; Point P2; public: LineSegment ); //default constructor LineSegment (Point one, Point two); double length(); //return the length of the line segment Point midpoint (); //return the midpoint of the line segment Point xIntercept (); //return the x-intercept of the line segment Point yIntercept (); //return the y-intercept of the line segment double slope (); //return the slope of the line segment bool itIntersects (LineSegment L); //returns true if L intersects //with this line segment Point intersectionPoint (LineSegment L); bool isParallel (LineSegment L); //check if slopes are same void displayEquation () ; // you will print in the format // y = m * x +c where m is the slope //and' c is the y-intercept //other methods that are necessary Intervals Class: This class stores a set of line segments and has its own methods. class Intervals { protected: LineSegment* segments; int count; int maxSize; public: 0; maxSize = 0; Intervals (0; //segments Intervals (int size); /on-default constructor void addLineSegment (Linesegment L); void display (); - NULL; count = /* display all line segment stored in the y-mx+c format; see display for LineSegment, and print points, length, midpoint, k-intercept, y-intercept, for example: Line Segment: 1 P1 = (3.0, 9.0); P2 = (8.0, 16.0) slope = 1.4 equation length mid point x-intercept y-intercept y = 1.4*x + 4.8 8.60 (10.5, 12.5) %3D Line Segment: 2 (...); P2 (...) slope equation length mid point x-intercept y-intercept %3! ... %3D ... ... !3! ... //some extra help below: in case you need it Intervals::Intervals () { NULL; segments count 0; maxSize = 0; Intervals:: Intervals (int size) { = new LineSegment [size]; 0; //currently there is none size; segments count maxSize = Your main program will have the following structure (changes may be required). tinclude using namespace std; //define all your classes here (as given above) //write the methods after the class definition (not inside the class //definition, see above in the Intervals class int main () { //make sure you define all the variables; I have defined ANY //first line of input contains the number of segments cin >> noofsegments: //Go through a loop (noofSegments times) and read the information about // each segment it will be as follows: // 2.3 3.5 2.5 8.12 // 5.13 8.13 9.0 12.8 //. //After you read information on each segment you need to create two //Point objects, with these Point objects you will next create a //Linesegment object and then this Linesegment object is placed in the //object you create for Intervals class using the addLineSegment method //Next ... //Call the display method on the Intervals Object you created //Next // ... * Determine ALL PAIRS of intersecting Line Segments and print just their position in which they are stored in the array. For example, (0, 8) (0, 14) (0, 32) (1, 11) (1, 6) ... You must ensure that your program outputs the correct results. Redirected Input: Redirected input provides you a way to send a file to the standard input of a program without typing it using the keyboard. To use redirected input in Visual Studio environment, follow these steps: After you have opened or created a new project, on the menu go to project, project properties, expand configuration properties until you see Debugging, on the right you will see a set of options, and in the command arguments type using namespace std; int main () ( int r,c,cv, nsv; int val; cin >> r >> 'c >> cv >> nsv; for (int i=0; i > value; cout and using namespace std. 2. None of the projects is a group project. Consulting with other members of this class our seeking coding solutions from other sources including the web on programming projects is strictly not allowed and plagiarism charges will be imposed on students who do not follow this

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Where do the authors work?

Answered: 1 week ago

Question

How does nonverbal communication express cultural values?

Answered: 1 week ago