Preview

Pythagorean Theorem and C++ Program

Good Essays
Open Document
Open Document
631 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Pythagorean Theorem and C++ Program
Group 1
Write a C++ program or each of the following problems: 1. Write a C++ program to enter a distance in meters and print out its value in kilometers, yards, and miles. (Note: 1 m = 0.001 km = 1.094 yd = 0.0006215 mi). 2. Write a C++ program to enter length and width of a rectangle, compute and print the area and perimeter of the rectangle. Print both rounded to the nearest tenth of a foot. 3. Write a program to compute the cost for carpeting a room. Input should consist of the room length (in meters), room width (in meters), and carpet price per square meter. 4. Compute and print the number of minutes in a year. 5. Given a positive number, print its square and square root. 6. The arithmetic mean of two numbers is the result of dividing their some by 2. The geometric mean of two numbers is the square root of their product. The harmonic mean of two numbers is the arithmetic mean of their reciprocals. Write a program that takes two floating-point numbers as inputs and displays these three means. 7. Write a C++ program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at that depth in degrees Celsius and Fahrenheit. The relevant formulas are:

Celsius = 10 x (depth) + 20 (Celsius temperature at depth in km) Farhrenheit = 1.8 x (Celsius) + 32

8. The Pythagorean Theorem states that the sum of the squares of the sides of a right triangle is equal to the square of the hypotenuse. For example, if two sides of a right triangle have lengths 3 and 4, then the hypotenuse must have a length of 5. The integers 3, 4, and 5 together form a Pythagorean triple. There is an infinite number of such triples. Given two positive integers, m and n, where m > n, a Pythagorean triple can be generated by the following formulas:

Side1 = m2- n2 Side2 = 2mn Hypotenuse = side12 + side22

Group 2

1. In a laboratory, the time of an experiment is

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Measure the distances between letters on the line in millimeters and then convert to the other units listed.…

    • 1018 Words
    • 11 Pages
    Satisfactory Essays
  • Satisfactory Essays

    a. Write a C++ function named fracpart() that returns the fractional part of any number…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per foot for a company. Your program should display the company name, number of feet installed, and the total cost for the installation.…

    • 453 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per ft for a company. Your program should display the company name and the total cost.…

    • 777 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    2. Using a similar approach as the example provided in section 2.2(textbook page 78) for “The Sale Price Program continued”, provide your program design for the program you analyzed for calculating the number of square feet in a house. Be sure to describe the fundamental tasks needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that includes the Main module and the order of the module calls (see page 82 for an example). Finally, list all of your pseudocode for each module (See example 2.6 on page 83 as an example).…

    • 832 Words
    • 4 Pages
    Powerful Essays
  • Better Essays

    a mathematical method that is used to create all the notes of the musical scale from the harmonic series; this scale is called the Pythagorean Scale. The naturally happening harmonics are whole number multiples. To get the other notes of the scale, we must use fractions.…

    • 1141 Words
    • 5 Pages
    Better Essays
  • Powerful Essays

    The purpose of this Lab. is to familiarize student how to solve practical problems programmatically; they will practice on elementary programming using primitive data types, variables, constants, operators, expressions, and input and output. Also, they will learn how to diagnose errors that may occur when a program is compiled or executed. There are some exercises, through which they will understand the concept learn in this chapter.…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Good Essays

    The Pythagorean theorem is a statement about triangles containing a right angle. A right triangle is a triangle with a ninety-degree angle. With the Pythagorean theorem, you take a triangle with a right angle and make a square on each of the three sides; the biggest square has the exact same area as the two other squares put together.…

    • 392 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Comp 122 Week 1 Ilab

    • 662 Words
    • 3 Pages

    John wants to know the values of the area and perimeter of a rectangle. John can take measurements of the length and width of the rectangle in inches. John's measurements are expected to be accurate to within 0.1 inch.…

    • 662 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    For Question 9 -- Paste you pseudo code here. DO NOT paste Visual Basic program code as your design solution. That will result in 10 points deducted from the homework assignment.…

    • 651 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Week 5 Assignments New

    • 754 Words
    • 6 Pages

    1.) Design an if-then statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. (Simple if statement)…

    • 754 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    UNIT 2

    • 470 Words
    • 3 Pages

    Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per foot for a company. Your program should display the company name, number of feet installed, and the total cost for the installation.…

    • 470 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    5. Convert the measurements for each of the objects from millimeters to meters and record in Data Table 1.…

    • 2629 Words
    • 11 Pages
    Good Essays
  • Satisfactory Essays

    objects is calculated by measuring length (L), width (W), and height (H) in centimeters (cm) and…

    • 323 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Fermat's Last Theorem

    • 939 Words
    • 4 Pages

    Currently holding the world record for longest standing math problem ever, Fermat’s last theorem went unsolved for 365 years. Fermat's last theorem was one of the largest white whales in the study of math. Over the centuries, thousands were puzzled by the impossible problem. From its conception to its solution, Fermat's last theorem was one of the most difficult to solve yet easy to understand problems in mathematics. First, I will discuss the theorem and how it was introduced to the mathematics community. Second, I will discuss some of the influences Fermat's last theorem has had over its lengthy history. Third, I will discuss how solution finally came about.…

    • 939 Words
    • 4 Pages
    Good Essays