The triple (side1 = 7, side2 = 24, hypotenuse = 25) is generated by this form wh
ID: 3885662 • Letter: T
Question
The triple (side1 = 7, side2 = 24, hypotenuse = 25) is generated by this form when M = 4 and n = 3. Write a program that takes values for m and n as and displays the values of the Pythagorean triple generated by the formula above. Write a program that calculates the acceleration (m/s^2) of a jet fighter launched from an aircraft-carrier catapult, given the jet's takeoff speed in km/hr and the distance (meters) over which the catapult accelerates the from rest to takeoff. Assume constant acceleration. Also calculate the time (seconds) for the fighter to be accelerated to takeoff speed. When you prompt the user, be sure to indicate the units for each input. For one run use a takeoff speed of 278 km/hr and a distance of 94 meters. Relevant formulas (v = velocity, a = acceleration, t = time, s = distance) v = at s = 1/2 at^2Explanation / Answer
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
int m = 0, n = 0, side1, side2, hyp;
cout<<" Enter the value for m and n: ";
cin>>m;
cin>>n;
side1 = (m * m) - (n * n);
side2 = 2 * m * n;
hyp = (m * m) + (n * n);
cout<<" Side1 = " <<side1;
cout<<" Side2 = " <<side2;
cout<<" Hypotensuse = " <<hyp;
return 0;
}
OUTPUT
Enter the value for m and n: 4
3
Side1 = 7
Side2 = 24
Hypotensuse = 25
Enter the value for m and n: 7
5
Side1 = 24
Side2 = 70
Hypotensuse = 74
--------------------------------------------------------------------------------------------
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
float s, d, a, t;
cout<<" Enter the speed of jet during take off in kmph: ";
cin>>s;
cout<<" Enter the distance over which catapult accelerates the jet from rest to take off: ";
cin>>d;
t = (2 * d)/s; //distance = (1/2)at^char32_t
a = s/t; //speed = acceleration * time (accelaration => time)
cout<<" The Jet Accelerates at "<<a <<" m/s^2 for " <<t <<" sec";
return 0;
}
OUTPUT
Enter the speed of jet during take off in kmph: 278
Enter the distance over which catapult accelerates the jet from rest to take off: 94
The Jet Accelerates at 411.085 m/s^2 for 0.676259 sec
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.