Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OpenGL C + + Develop a class Point. A point is represented by 3 coordinates: x , y , and z . The class must

OpenGL
C++
Develop a class Point. A point is represented by 3 coordinates: x,y, and z. The class must provide
the following functions:
translate (int d, char axis).d is the distance the point will move in the given axis. axis can have one
of the following 3 values: 'x','y', and 'z'. If any other value is given, the function should do nothing
and return -1. If an invalid value is given for d, the function should do nothing and return -2. Invalid
values for d could be anything other than an integer value. The function returns 0 if everything is
valid and the point is translated.
Develop a class Triangle. A triangle consists of 3 Points. In the implementation of the attributes of
the triangle class, you must represent the three points as pointers to Point. You may name them
vertex_1, vertex_2, and vertex_3.
Implement a method translate (int d, char axis) that translates the three vertices of the triangle by d
in the direction of the given axis.
Implement a function to calculate the area of the triangle. Name it calcArea(). You decide its return
type.
Develop a constructor that takes three points as parameters.
Develop a default constructor that sets the three pointers to the three points to null.
Feel free to add any other functions that you see fit. Maybe a display function in Point or
Triangle??!! You decide 3.
Both the Point class and the Triangle class must have destructors.
Develop a driver class that allows the user to create a triangle and to translate the triangle. You
need to provide a menu option to display the triangle coordinates on the screen.
image text in transcribed

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

Students also viewed these Databases questions

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Provide the best employee relations environment.

Answered: 1 week ago