Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

S. Write a program that reads in the length and width of a rectangular yard (in

ID: 3638090 • Letter: S

Question


S. Write a program that reads in the length and width of a rectangular
yard (in meters) and the length and width of a rectangular house (in
meters) placed in the yard. Your program should compute the time (in
minutes) required to cut the lawn around the house. Assume the mow-
ing rate in square meters per minutes is entered as a data item.

6. Write a program that reads and stores the numerators and denomina-
tors of two fractions as integer values. For example, if the numbers 1
and 4 are entered for the first fraction, the fraction is 1/4, The program
should print the product of the two fractions as a fraction and as a dec-
imal value. For example, 1/4 * 1/2 = 1/8 or 0.125.

10. Redo Programming Project 6-but this time compute the sum of the
two fractions.

11. 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
tel- Pythagorean triple. There is an infinite number of such triples. Given
two positive integers, m and n, where m» n, a Pythagorean triple can
generated by the following formulas:

sidel = m2 - n2
side2 = 2mn
rr-r-r-r-x-r-r-r-rrr-+z:
hypotenuse = Vside12+ side22

Write a program that reads in values for m and n and prints the values5
of the Pythagorean triple generated by the formulas above.

Explanation / Answer

please rate - thanks

 

CRAMSTER rule - 1 question per post.

I'll do more than 1, but only this time you owe me 1050 points

 

#include <iostream>
using namespace std;
int main()
{float lyard,wyard,lhouse,whouse,areahouse,areayard;
int hour,min,sec;
cout<<"Enter the width of the yard: ";
cin>>wyard;
cout<<"Enter the length of the yard: ";
cin>>lyard;
cout<<"Enter the width of the house: ";
cin>>whouse;
cout<<"Enter the kength of the house: ";
cin>>lhouse;
areahouse=lhouse*whouse;
areayard=lyard*wyard;

cout<<" The area of the house is "<<areahouse<<" square feet"<<endl;
cout<<"The area of the yard is "<<areayard <<" square feet"<<endl<<endl;
areayard-=areahouse;
cout<<"You must cut "<<areayard<<" square feet of grass ";
areayard/=2;
cout<<"Which will take "<<areayard<<" seconds ";
hour=areayard/3600;
areayard=(int)areayard%3600;
min=areayard/60;
sec=(int)areayard%60;
cout<<"which is "<<hour<<" hours, "<<min<<" minutes, and "<<sec<<" seconds ";
system("pause");
return 0;
}

 

--------------------------------------

#include <iostream>
using namespace std;
int main()
{int num,den,num2,den2,pnum,pden;
double ans;
cout<<"Enter numerator 1: ";
cin>>num;
cout<<"Enter denominator 1: ";
cin>>den;
 cout<<"Enter numerator 2: ";
cin>>num2;
cout<<"Enter denominator 2: ";
cin>>den2;
pnum=num*num2;
pden=den*den2;
ans=(double)pnum/pden;
cout<<num<<"/"<<den<<" * "<<num2<<"/"<<den2<<" = "<<pnum<<"/"<<pden<<" = "<<ans<<endl;
system("pause");
return 0;
}

------------------------------------

#include <iostream>
using namespace std;
int main()
{int num,den,num2,den2,pnum,pden;
double ans;
cout<<"Enter numerator 1: ";
cin>>num;
cout<<"Enter denominator 1: ";
cin>>den;
 cout<<"Enter numerator 2: ";
cin>>num2;
cout<<"Enter denominator 2: ";
cin>>den2;
pnum=(num*den2)+(num2*den);
pden=den*den2;
ans=(double)pnum/pden;
cout<<num<<"/"<<den<<" + "<<num2<<"/"<<den2<<" = "<<pnum<<"/"<<pden<<" = "<<ans<<endl;
system("pause");
return 0;
}

-------------------------------

#include <iostream>
using namespace std;
int main()
   {int m,n,a,b,c;
   cout<<"Enter m: ";
   cin>>m;
   cout<<"Enter n: ";
   cin>>n;
   a=m*m-n*n;
   b=2*m*n;
   c=m*m+n*n;
   cout<<"The pythagorian triple for m= "<<m<<" and n= "<<n<<" is: ";
   cout<<a<<"^2+"<<b<<"^2+"<<c<<endl;
   system ("pause");
   return 0;
}