Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x (int) miles

image text in transcribed

image text in transcribed

Description Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x (int) miles per hour and car B travels south at an average speed of y (int) miles per hour. Write a program that prompts the user to enter the average speed of both cars and the elapsed time (in hours and minutes, both will be int types) and then outputs the (shortest) distance between the cars (double). Specifications Make sure to comment your code (comment all of your variables and parts of your code that performs a specific task) Give your variables meaningful names Make sure you use the correct types for your variables Sample Output $ g++ Assignment02. cpp $ ./a.out Enter the speed of Car A and car B: 88 85 Enter elapsed time (hours and minutes): 1 24 The two cars are 171.287 miles apart from each other $ ./a. out Enter the speed of Car A and car B: 55 107 Enter elapsed time (hours and minutes): 0 1 The two cars are 2.00513 miles apart from each other $ ./a.out Enter the speed of Car A and car B: 199 199 Enter elapsed time (hours and minutes) 2 30 The two cars are 703.571 miles apart from each other

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

Students also viewed these Databases questions

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago