Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 1 - Fractions and Area using C++ Please use C++ programming notation when completing the following assignment. Goal Develop and implement a Fraction class

Project 1 - Fractions and Area using C++

Please use C++ programming notation when completing the following assignment.

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

Goal Develop and implement a Fraction class and use it to calculate the area of a polygon Details The Fraction class For this project, you should use the Fraction class you created in lab o Source code layout In this project you should use a conventional text editor and the g++ and make tools. Since l want you to get some additional experience with these tools, you should not use an IDE for this project. The project is also an exercise in separate compilation, where the source code is divided into mul- tiple parts. The project consists of four files . A fraction.h header file that contains the class definition; A fraction.cc file containing the class methods (functions); A file containing a main function that performs the intersection calculations A Makefile that directs the process of creating the executable file Calculating area To calculate the area, you must first be able to calculate the cross product of two points. Givern p1 (X1, y1) and p2 = (X2, y2), the cross product is pl x p2 1y2-2y1. Now, suppose you have a polygon whose vertices are (p1, p2, , pn), where the vertices are listed consecutively as you travel counterclockwise around the polygon. Then, the area of the polygon is given by (pi X Pi+1) where pn+1 pl. An easy way to perform the calculation is to keep track of three points: the first point in the list, the current most recently input point, and the previous point Read the first point and also make that the current point. Then, perform a do loop. Inside, do the following

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

Why is it desirable to prepare one?

Answered: 1 week ago