Exemplo n.º 1
0
void Rectangle::showResult()
{
	checkRectangle();

	cout << endl;
	cout << "SideAB = " << getSideAB() << endl;
	cout << "SideBC = " << getSideBC() << endl;
	cout << "SideCD = " << getSideCD() << endl;
	cout << "SideDA = " << getSideDA() << endl;

	cout << endl;
	cout << "Length of figure is " << length() << endl;
	cout << "Width of figure is " << width() << endl;
	cout << "Parameter of figure is " << perimeterOfRectangle() << endl;
	cout << "Area of figure is " << areaOfRectangle() << endl;
}
Exemplo n.º 2
0
double workpiece::quote() {
    double cost = 0; // Net cost counter
    rectangle* rects = (rectangle*)malloc(sizeof(rectangle) * (numArcs + 1)); // Array of bounding rectangles

    for (int i = 0; i < numSegments ; ++i)
        cost += lengthOfSegment(segments[i]) * machiningCost / maxCutterSpeed; // Add the cost of cutting line segments
    
    for (int i = 0; i < numArcs ; ++i) {
        cost += lengthOfArc(arcs[i]) * machiningCost * exp(1/radiusOfArc(arcs[i])) / maxCutterSpeed; // Add the cost of cutting circular arcs
        rects[i] = boundingRectangle(arcs[i]); // Compute bounding rectangle of arcs
    }
    
    rects[numArcs] = boundingRectangle(numSegments, segments); // Compute bounding rectangle of line segments
    
    // Add material cost of total boundign rectangle + padding
    cost += areaOfRectangle(boundingRectangle(numArcs + 1, rects), padding) * materialCost;
    
    return round(cost * 100) / 100;
}