Question: 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(const Triangle& t);

#endif

Here is the prompt:

 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

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 The midpoint Function The midpoint between the two Points a and b, is the Point on the distance line, equi- distant from a and b as shown here. The formula to calculate the midpoint is simply the sum of a.x and b.x divided by 2, plus the sum ofa.y and b.y divided by 2. (4, 3) H,1 2 B 21 Y2 , Do the perimeter() function on your own. Ask questions on Piazza if you get stuck

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!