Write another method to return the perimeter

Assignment Help Other Subject
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

Reference no: EM13853397

Questions Cloud

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.

Reviews

Write a Review

Other Subject Questions & Answers

  Explain how do regulations legal andor ethical issues or

descriptive research method analytic research method and evaluation research methoddescribe how this information is

  Tolerance associated with relativism about religion

Why is Harris so much concerned with the easy sort of tolerance associated with relativism about religion? Alternatively -- a slightly different question -- why is Harris so obviously put off by the kind of cosmopolitan syncretism apparently endorsed..

  What factors make it more likely that a bill will become law

What factors make it more likely that a bill will become law? What factors make it less likely? Is it easy or difficult to pass a bill? What are some of the advantages of passing legislation quickly? What are some of the disadvantages?

  Boundaries of competence as defined in welfel

Which of the following is an acceptable example for meeting one or more of the Boundaries of Competence as defined in Welfel?

  Pick some bureaucracy in which you regularly find yourself

pick some bureaucracy in which you regularly find yourself. explain how the bureaucracy meet the five characteristics

  Others view her suicide as a final awakening a decision to

the awakening essay 4-6 pages double-spaced times new roman font. please include page numbers a title reflective of the

  Why was the region eventually abandoned

From the 9th-12th centuries AD, Ancestral Puebloan people built a series of large, well-planned monumental constructions in Chaco Canyon-now abandoned. What was the role of Chaco Canyon in Puebloan society? Why was the region eventually abandoned?

  Explain proximate or underlying determinants of risk factors

What are the proximate or underlying determinants of risk factors that are associated with any health problem for each study

  Describe the different gender socialization process

Describe the different gender socialization process using Nancy Chodorow’s work. Include what men and women need because something is lacking in their socialization process, and describe how men and women end up being different because of this pro..

  Planning and control

Apple computer inc. enjoyed a phenomenal early success after it was founded in 1977 by Steve Wozmak, a technical expert, and Steve Jobs, the marketing genius.

  Example of a subtractive process

Which of the following is the best example of a "subtractive" process?

  Neglect air resistance problem

A soccer ball is kicked from the ground with an initial speed of 20.0 m/s at an upward angle of 43.7?. A player 50.3 m away in the direction of the kick starts running to meet the ball at that instant. What must be his average speed if he is to meet ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd