Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Assigment . Please help me to write the code for h10.cpp and h10.h. Here is what I have for h10.cpp: #include #include using namespace

C++ Assigment. Please help me to write the code for h10.cpp and h10.h.

Here is what I have for h10.cpp:

#include #include using namespace std;

string STUDENT = ""; // Add your Canvas/occ-email ID

#include "h10.h" // Add your implementation here

/////////////// STUDENT TESTING //////////////////// int run() { cout

return 0; }

Here is h10.h:

#ifndef H10_H_ #define H10_H_

#include #include #include #include #include

// Place your Point structure here

// Place your Triangle structure here

/** * Reads a point in the form x,y. * @param in the input stream. * @param p the Point to populate */ void get(std::istream& in, Point& p);

/** * Displays a Point in the form (x, y). * @param out the stream to print on * @param p the Point to print */ void print(std::ostream& out, const Point& p);

/** * Calculate the distance between two Points. * @param a the first point. * @param b the second point. * @return the distance as a double. */ double distanceBetween(const Point& a, const Point& b);

/** * Given two points, find their midpoint. * @param a the first point. * @param b the second point. * @return the midpoint. */ Point midpoint(const Point& a, const Point& b);

/** * Calculates the perimeter of the Triangle t. * @param t the Triangle to examine. * @return the perimeter. */ double perimeter(Triangle triangle);

#endif

Here is the prompt:

image text in transcribed

image text in transcribed

image text in transcribed

Writing Functions Add the implementations for the functions in h1e0.cpp. The print() function should be fairly straightforward. We'd like to see Point objects printed as (x, y) In the get() function remember that input is entered as x, y where x and y are int, separated by a comma and optional spaces. That means that your get() function must read and discard the char value separating the two int values. Don't worry about exceptions. . The distanceBetween Function To find the distance between two points, you'll need to use the Pythagorean formula for finding the hypotenuse of a right triangle. Since you'll need the sqrt() function to do that, you have to be sure to include Y2 DISTANCE (c) ,',' 'A=Y22% C2 = A2 + B2

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions