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
  • Good Essays

    MTH240 week 2

    • 460 Words
    • 2 Pages

    In week one, we learned a simple yet extremely useful math concept, the Distance Formula. This formula uses the Pythagorean Theorem to determine the distance between two points on the rectangular coordinate system. Variations of the Pythagorean Theorem such as the Distance Formula can be used in building things or making plans to build something.…

    • 460 Words
    • 2 Pages
    Good 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

    5.) Write the pseudocode for a program that will determine the average miles per gallon a car gets. (Inputs should be miles driven and gallons of gas used)…

    • 453 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    (a^2 + b^2 = c^2 (Page­ 433) Pythagorean Triple A set of 3 positive integers A, B, and C that satisfy the equation A^2 + B^2 = C^2 [Ex. (3,4,5) (5,12,13) (8, 15,17) and (7,24,25)]…

    • 895 Words
    • 7 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
  • 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

    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
  • 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
  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    7. Convert the While loop in the following code to a Do-While loop: int x;…

    • 431 Words
    • 2 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

    UNIT 2

    • 470 Words
    • 3 Pages

    5.) Write the pseudocode for a program that will determine the average miles per gallon a car gets. (Inputs should be miles driven and gallons of gas used)…

    • 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