Answer to Question #203032 in Algorithms for Atifah

Question #203032

You have decided to enter a model boat race. You put your boat at the start line next to your 

best friend Jill’s boat. Create a program to print out the distance that both of your boats 

travelled given the speed your boat travels in (feet per minute), the speed that Jill’s boat 

travels and the number of minutes in the race. 

Distance = speed * time 

Use the following as your sample Data: 

speedMe = 6.2 

speedJill = 5.9 

time = 2 

distanceMe = speedMe * time = 6.2 * 2 = 12.4 

distanceJill = speedJill * time = 5.9 * 2


1
Expert's answer
2021-06-04T06:06:32-0400
Algorithm:

Start
	Declare variable speedMe
	Declare variable speedJill
	Declare variable time 
	Declare variable distanceMe
	Declare variable distanceJill
	Get the speed your boat travels in (feet per minute) (speedMe) from the keyboard
	Get the speed Jill's boat travels in (feet per minute) (speedJill) from the keyboard
	Get the number of minutes (time) from the keyboard
	distanceMe = speedMe * time
	distanceJill = speedJill * time
	Display distanceMe
	Display distanceJill
Stop



C++


#include <iostream>


using namespace std;


int main() {
	//Declare variable speedMe
	float speedMe;
	//Declare variable speedJill
	float speedJill;
	//Declare variable time 
	float time;
	//Declare variable distanceMe
	float distanceMe;
	//Declare variable distanceJill
	float distanceJill;
	//Get the speed your boat travels in (feet per minute) (speedMe) from the keyboard
	printf("Enter the speed your boat travels in (feet per minute): ");
	scanf("%f",&speedMe);
	//Get the speed Jill's boat travels in (feet per minute) (speedJill) from the keyboard
	printf("Enter the speed Jill's boat travels in (feet per minute): ");
	scanf("%f",&speedJill);
	//Get the number of minutes (time) from the keyboard
	printf("Enter the the number of minutes: ");
	scanf("%f",&time);
	//distanceMe = speedMe * time
	distanceMe = speedMe * time;
	//distanceJill = speedJill * time
	distanceJill = speedJill * time;
	//Display distanceMe
	cout<<"\nYour distance: "<<distanceMe<<"\n";
	//Displayf distanceJill
	cout<<"Jill's distance: "<<distanceJill<<"\n";


	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS