Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design and implement a C++ program based on the concept of composition. The program represents lines for computer graphic and each line consist of
Design and implement a C++ program based on the concept of composition. The program represents lines for computer graphic and each line consist of 2 points. Declare the class Point and Line to model the line and points in computer graphic in 2 dimensional space. Line object has an array of Point object as members. In term of classes relationship, Line class has Point class. Use the following driver function. You must not change the driver function and when executed it should produce the output listed below. Driver function int main() { Line oLine1("line1", 21, 3, 3,4); // connect p1(21,3) with p2(3,4) oLine1.showPointsInLine(); cout < < endl; Line oLine2("line2", 87, 13, 11, 40); // connect p3 (87,13) with p4 (11,40) oLine2.showPointsInLine(); cout < < endl < < endl;; Expected output The 2 points for linel are The 2 points for line2 are (21, 3) (3, 4) (87, 13) (11, 40)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started