Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program Output MUST be the same as the examples provided below. Write a program that displays the following menu and prompts the user for

C++ Program

Output MUST be the same as the examples provided below.

Write a program that displays the following menu and prompts the user for an option (13):

image text in transcribed

Any other option other than 1, 2, or 3 will terminate the program.

Case option 1:

Display a brief description of a circle, prompt for its center point and a point on its circumference, and display the static number of circles, its calculated radius, diameter, area and perimeter of a circle:

image text in transcribed

Note: If radius is determined to be zero, display an error without further calculation and terminate the program.

Case option 2:

Display a brief description of an irregular triangle, prompt for its 3 corner points, and display the static number of triangles, the calculated length of sides, area and perimeter of the triangle:

image text in transcribed

Note: If any length of sides is determined to be zero, display an error without further calculation and terminate the program.

Hint: http://mathterms.blogspot.com/2013/06/irregular-triangle.html

Case option 3:

Display a brief description of an irregular tetragon, prompts for its 4 corner points, and display the static number of tetragons, its calculated length of sides, area and perimeter of the tetragon:

image text in transcribed

Note: If any length of sides is determined to be zero, display an error without further calculation and terminate the program.

Hint: Brahmagupta's Formula

Requirements:

Must implement and use the following classes:

Point.h(header file) and Point.cpp(cpp file)

#ifndef POINT_H

#define POINT_H

#include

using namespace std;

class Point

double x, y;

static int numberOfObjects;

Point();

Point(double x, double y);

double getX() const;

void setX(double x);

double getY() const;

void setY(double y);

string getPoint() const;

double distance(Point p2) const;

static int getNumberOfObjects();

Circle.h and Circle.cpp

#ifndef CIRCLE_H

#define CIRCLE_H

#include "Point.h"

class Circle

Point P1;

Point P2;

static int numberOfObjects;

Circle();

Circle(Point, Point);

double getP1X() const;

void setP1X(double);

double getP1Y() const;

void setP1Y(double);

double getP2X() const;

void setP2X(double);

double getP2Y() const;

void setP2Y(double);

double getRadius() const;

double getDiameter() const;

double getArea() const;

double getPerimeter() const;

static int getNumberOfObjects();

IrregularTriangle.h and IrregularTriangle.cpp

#ifndef IRREGULAR_TRIANGLE_H

#define IRREGULAR_TRIANGLE_H

#include "Point.h"

class IrregularTriangle

Point P1;

Point P2;

Point P3;

static int numberOfObjects;

IrregularTriangle();

IrregularTriangle(Point, Point, Point);

double getP1X() const;

void setP1X(double);

double getP1Y() const;

void setP1Y(double);

double getP2X() const;

void setP2X(double);

double getP2Y() const;

void setP2Y(double);

double getP3X() const;

void setP3X(double);

double getP3Y() const;

void setP3Y(double);

double getSideA() const;

double getSideB() const;

double getSideC() const;

double getArea() const;

double getPerimeter() const;

static int getNumberOfObjects();

IrregularTetragon.h and IrregularTetragon.cpp

#ifndef IRREGULAR_TETRAGON_H

#define IRREGULAR_TETRAGON_H

#include "point.h"

class IrregularTetragon

Point P1;

Point P2;

Point P3;

Point P4;

static int numberOfObjects;

IrregularTetragon();

IrregularTetragon(Point, Point, Point, Point);

double getP1X() const;

void setP1X(double);

double getP1Y() const;

void setP1Y(double);

double getP2X() const;

void setP2X(double);

double getP2Y() const;

void setP2Y(double);

double getP3X() const;

void setP3X(double);

double getP3Y() const;

void setP3Y(double);

double getP4X() const;

void setP4X(double);

double getP4Y() const;

void setP4Y(double);

double getSide1() const;

double getSide2() const;

double getSide3() const;

double getSide4() const;

double getArea() const;

double getPerimeter() const;

static int getNumberOfObjects();

Must have ONE main.cpp that includes all header files and implement the menu

Must utilize and test all classes

Thank you in advance!

Main MenuFinding Area and Perimeter 1: Circle 2: Irregular Triangle 3 Irregular Tetragon other: quit Option

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

Students also viewed these Databases questions

Question

2. Why does unpredictability matter?

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago