Reference no: EM13853397
Write, test, and debug a program that prompts the user for 3 sides of two triangles. Your program will be written using a Triangle class and will have 2 Triangle objects (variables/instances of the class).
You will need to write a method (member function) that saves those sides to private object variables, write another method(s) to return the side(s), write another method to return the perimeter, write another method to return the area. This means you will have a minimum of 4 methods in your program, you might have more depending on how you write the methods that save/return the sides.
Perimeter: a + b + c // triangle sides are a, b, c
Area:
#include <cmath> // you will need to include this for the square root function
sqrt(((a+b+c)/2)*(((a+b+c)/2)-a)*(((a+b+c)/2)-b)*(((a+b+c)/2)-c)); // Heron's Formula
Example program run:
This program will take the 3 sides of two triangles and calculate the perimeter and area
Please enter 3 sides of triangle 1: 16 14 10.5
Please enter 3 sides of triangle 2: 6 7.5 9
The triangle 1
with sides of 16, 14, 10.5
has a perimeter of 40.5
and has an area of 72.4185
The triangle 2
with sides of 6, 7.5, 9
has a perimeter of 22.5
and has an area of 22.3235
Calculate the total income and substitution effects
: Xiao-Ping has 24 hours a day to divide between work and leisure, and her boss allows her to work as many hours as she wants. She has $8 per day of non-labor income, and she works at a job that pays $8 per hour. Her preferences over leisure time R ? ..
|
How a project risk management strategy may be constructed
: The management of risk is proving to be one of the most difficult tasks for the project management profession. How can risk be managed effectively and who should be responsible for this task?
|
Explain how constraints occur in system designs
: Explain how constraints occur in system designs. Identify an example of a constraint you have encountered recently in your everyday life-whether at work or shopping
|
A candle maker produces jar candles
: 1. A candle maker produces jar candles that have a label weight of 20.4 oz. Assume that the distribution of the weights of these candles is N (21.37,0.16). Let X denote the weight of a candle selected at random from the production line.(a) Let X bar..
|
Write another method to return the perimeter
: Write another method to return the perimeter, write another method to return the area. This means you will have a minimum of 4 methods in your program, you might have more depending on how you write the methods that save/return the sides.
|
What is an autoimmune disease?
: What is an autoimmune disease?
|
Problem solving methodologies
: The mathematical problems need to show how you derived your answer and responses. While I'm looking at the final product or your final answer, I'm also watching your problem solving methodologies. It's actually more important to me than the answer it..
|
Effect of integration of logistics
: Effect of integration of logistics and supply chain management of Maternal, Newborn and child health (MNCH) commodities at Primary Health Care service delivery points.
|
Create an rfp for any event of your choice
: Create an RFP for any event of your choice. Make sure to include all information relevant to your event and cover all items outlined in the sample RFP in your textbook.
|