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

  Related to the biological view of deviance

Which of the following statements related to the biological view of deviance is true?

  Environmental forces-social-economic-technological

What trends in the environmental forces (social, economic, technological, competitive, and regulatory) work for and/or work against Rollerblade's potential growth in the 21st century?

  Describe the role of freedom of assembly in american society

Describe the role of the freedom of assembly in American society - and now globally. What are some reasons that assembly and protest are incredibly effective methods for bringing change to a society? What are some of the flaws of this method of socia..

  How will you keep track of the articles you have reviewed

How will you keep track of the articles you have reviewed and how will you save those that you intend to use in your literature review? What will you do to ensure that you have saved and backed up critical documents? What specific tools will you u..

  Zajoncas and lazarusas theories of emotion and cognition

What is the central point of tension between Zajoncâ's and Lazarusâ's theories of emotion and cognition? What is one possible resolution to this tension?

  How do design 84 operational requirements influence

objectivescast iron has been traditionally used as the braking disc material. in more recent years. however composites

  Bringing change to public leadership

Bringing Change to Public Leadership

  Review tenet characteristics of nursing practice

Review Tenet's characteristics of nursing practice. Pick one area and give an example where you exemplified one of these characteristics. Discuss how your work environment can help or hinder your ability to practice effectively within nursing ..

  Difference between hypothesis and theory is that hypothesis

The difference between a hypothesis and a theory is that a hypothesis

  Difference between act and rule utilitarianism

The theory of utilitarianism including the distinction between Bentham and Mill's versions; the difference between act and rule utilitarianism

  Use the getdate function

Write an UPDATE statement that modifies the InvoiceCopy table. Change the PaymentDate to today's date and the PaymentTotal to the balance due for each invoice with a balance due. Set today's date with a literal date string, or use the GETDATE() funct..

  I need a introduction letter for the exhibition catalog new

i need a introduction letter for the exhibition catalog.new york meets istanbul exhibition with charcoal drwaings

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