ComProg2 Act4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ACTIVTY 4

Rose Mae D. Cales


ICT 11 - 1
1.

#include <iostream>
#include <iomanip>
using namespace std;
/* run this program using the console pauser or add your own getch,
system("pause") or input loop */

int main(int argc, char** argv) {


double L1=1.62, L2=2.86, L3=4.26, L4=8.52, L5=12.29;
double W1=6.23, W2=7.52, W3=8.95, W4=10.86, W5=15.35;
double area1, area2, area3, area4, area5;

cout<<"\t\tArea of the Rectangles"<<endl<<endl;


cout<<"Length(in.)"<<"\t\tWidth(in.)"<<"\t\tArea"<<endl;
area1=L1*W1;
cout<<fixed<<setprecision(2);
cout<<L1<<"\t\t\t"<<W1<<"\t\t\t"<<area1<<" in.^2"<< endl;

area2=L2*W2;
cout<< fixed << setprecision(2);
cout<<L2<<"\t\t\t"<<W2<<"\t\t\t"<<area2<<" in.^2"<<endl;

area3=L3*W3;
cout<<fixed<<setprecision(2);
cout<<L3<<"\t\t\t"<<W3<<"\t\t\t"<<area3<<" in.^2"<<endl;

area4=L4*W4;
cout<<fixed<<setprecision(2);
cout<<L4<<"\t\t\t"<<W4<<"\t\t\t"<<area4<<" in.^2"<<endl;

area5=L5*W5;
cout<<fixed<<setprecision(2);
cout<<L5<<"\t\t\t"<<W5<<"\t\t\t"<<area5<<" in.^2"<<endl<<endl;

cout<<"\nProgrammer's Name: Rose Mae D. Cales";

return 0;
}
2.

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch,
system("pause") or input loop */
int main(int argc, char** argv) {
double ft=5280;
double m=2.36;
double d;

d=ft*m;

cout<<"\t\tDistance Calculator: miles to feet"<<endl<<endl;


cout<<"\tHow long is 2.36 miles in feet?";
cout<<"\n\tNote: One mile is equal to 5280"<<endl;
cout<<"\n\tAnswer: "<<d<<" ft."<<endl;
cout<<"\n\n\tProgrammer's Name: Rose Mae D. Cales";
return 0;
}
3.

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch,
system("pause") or input loop */

int main(int argc, char** argv) {

double t, d=183.67, s=58;

cout<<"\t\tCalculate the Elapsed Time"<<endl;


cout<<"\n\tDistance: "<<d<<" miles"<<endl;
cout<<"\tSpeed: "<<s<<"mph"<<endl;

t=d/s;
cout<<"\n\tElapsed time: " <<t<<" hr"<<endl;
cout<<"\n\tProgrammer's Name: Rose Mae D. Cales";

return 0;
}

You might also like