Build me a small C++ object oriented program

Completado Publicado hace 5 años Pagado a la entrega
Completado Pagado a la entrega

Your program should use text files as the only input. No keyboard input is permitted. The path to the input file should be the first parameter to the program.

Format output exactly as specified/exemplified in the descriptions

Follow good code writing practices:

Do not use global variables

Divide classes into .cpp and .h files

All parameters that are constants should be declared as such

All variable and class names should be in English, self-explanatory, and must use camelCase.

All code that is not used should be removed

Use code comments when the reasoning behind the solution is not obvious

Always check that that all allocated memory is released and avoid memory leaks

You should not use any external libraries other than cmath, iostream, fstream, and strings. If you wish to use another library please check with the lab assistants first.

The program should be robust against wrong input data. If there is an error with input file the program should gracefully terminate with a non zero exit code.

Real numbers should be printed with the precision of 3 decimal digits.

Implement an abstract class Shape with methods:

getType() returns a string denoting the type of a shape (point, line, polygon, triangle)

area() returns area of the object, or -1 if the shape is concave, intersecting, or does not have an area

circumference() returns circumference of the object

position() returns center coordinates of the object, or the center of the bounding box if the shape is not convex.

isConvex() returns true if shape is convex

distance(Shape s) returns distance to the center of another shape

Extend the Object classes into Point, Line, Triangle, and Polygon. Overload the inherited methods. Constructors of these classes take vertices coordinates as an input.

The program should load a shape from a file and output its surface area. The input file contains a series of real numbers indicating coordinates of vertices. Example:

1 2 3 4 5 6.43 // Denotes a triangle with vertices at (1, 2) (3, 4) (5, 6.43)

There should not be a limitation of how many points the program can load.

Example:

Input: 1 1 1 2 2 2 Output: 0.5

Input: 1 3.4 3 3 13.13 3 Output: 2.026

Input: 1 1 1 2 2 2 3 1 2 0 Output: 2.5

Input: 0 -10 Output: -1

Programación en C++ Arquitectura de software

Nº del proyecto: #18229978

Sobre el proyecto

2 propuestas Proyecto remoto Activo hace 5 años

Adjudicado a:

NovaSofts

Hello Sir/ Ma’am We are a group of Software Engineers having 10+ years of experience. Expert in JAVA, C, C++ , C# , Python, ANDROID, MATLAB. Done 550+ projects here on FREELANCER.COM. Please check our profile for ref Más

$30 USD en 1 día
(327 comentarios)
7.5

2 freelancers están ofertando un promedio de $40 por este trabajo

Mickelson

Hi Nice to meet you. I'm senior c++/c# expert. I have plenty experience of multithreading, opencv, REST api, and entityframework. I checked your job description and no problem. Also I can write comment as well. J Más

$50 USD en 1 día
(107 comentarios)
6.7