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

  What economic and social impact

What economic and social impact might a wildfire have on a community? Give at least six of each.

  Address the burden of non-communicable disease

I would like some assistance detailing how the identification and treatment of multiple risk factors can be used to address the burden of non-communicable disease. My chosen disease is asthma.

  Compose two analogies

Compose two analogies. You might select anything to write down about, yet ensure that the analogies are correct in form and logic.

  Carl jung and archetypes

Jung believed that the persona, anima/animus, and shadow were some of the archetypes that had evolved so completely that they could be considered separate systems within the personality. Which list below best describes those archetypes

  Federalism in the united states

Define Federalism. Explain the supremacy clause in Article VI of the US Constitution. What is the meaning of the 10th amendment to the US Constitution?

  Which belief was held by most progressives

Which belief was held by most Progressives?

  Your organization is about to review their energy use and

your organization is about to review their energy use and develop an energy plan including as many renewable power

  Writing assignments

Writing Assignments: Format policy, as outlined in the Student Handbook . Good papers should demonstrate knowledge of the course materials as well as the ability to apply the theories and concepts learned to your organizational situation.

  Effective brand name creation

Effective Brand Name Creation

  Etimate the skills against own skills create brief plan

write a 3-5 page paper on the concept of leadership skills. include at least three cites from the textbooks

  Explain the influence of federalism and the separation

Explain the influence of federalism and the separation of powers on current governance. Select specific examples of current governance to illustrate the influence of each concept.

  State the level of significance related issues

Discuss the possibility of a Type I or Type II error.

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