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

1. Write a program to calculate and display the average of three integers. Your

ID: 3726562 • Letter: 1

Question

1. Write a program to calculate and display the average of three integers. Your program will prompt the user with the message "Enter three numbers". Your program must support floating point numbers. Display the average with the message The average. (70 pts) 2. Write a C++ program that displays a table of speed conversions from meters per second to miles per hour. The program needs to prompt the user for the starting speed, the ending speed, and the step size. Set the column size to 20 for each field. right justify the numbers and the headings. The headings for the two fields must be "meters per second" and "miles per hour" respectively. Use a row of dashes between the headings and the data. Display numbers using two decimal places. Use conversion factors 1 ft 0.3048 meters and 1 mile=5280 ft. (100 pts) The following demonstrates what the output should look like for the given sample data This program will convert from meters per second to miles per hour Enter the step size: 5 Enter the starting speed in meters per second: 0 Enter the ending speed in meters per second: 10 Meters per second Miles per hour 0.00 5.00 10.00 0.00 11.18 22.36 Note: The bolded numbers represents example of data that the user entered.

Explanation / Answer

1)

void main()

{

float a,b,c,avg;

cout<<"Enter three numbers:"<<endl;

cin>>a;

cin>>b;

cin>>c;

avg=(a+b+c)/3;

cout<<"The Average = "<<avg;

}

2)

void main()

{

int l,m,s;

float x,y;

cout<<"Enter the step size:"<<endl;

cin>>s;

cout<<"Enter the starting speed in meters per second:"<<endl;

cin>>l;

cout<<"Enter the ending speed in meters per second:"<<endl;

cin>>m;

x=l;

cout<<" Meters Per Second Miles Per Second "<<endl;

cout<<"--------------------------------------------------------------------------"<<endl;

while(x<=m)

{

y=(1/0.3048)*x*(1/5280)*3600;

cout<<" "<< x<<" "<< y<<" "<<endl;

x=x+s;

}

}

3)

void main()

{

char c1,c2,c3;

cout<<"Enter three characters each separated by a space:"<<endl;

cin>>c1;

cin>>c2;

cin>>c3;

cout<<" The reverse order of the characters is "<<c3<<" "<<c2<<" "<<c1;

}