Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Two buses, X and Y, start their journey at the same time on a 950km route. Bus X gives a 1-hour break after every 3

image text in transcribed
Two buses, X and Y, start their journey at the same time on a 950km route. Bus X gives a 1-hour break after every 3 hours' drive. So, it is at rest at the 4th,8th,12th,16th,20th, ... hours. Bus Y gives a 1-hour break after every 4 hours' drive. So, it is at rest at the 5th,10th,15th,20th, 25th, hours. You are given the speeds of the two buses Vx and Vy as 80 and 75 , respectively. Write a program that does the following: - Evaluate and display at the end of every hour the distance traveled by each bus. - When either one of the buses reach their destination, the evaluations terminate. Depending on whether X or Y or both reach their destination in the last hour, display one of the following messages before stopping (where n is the number of hours): "Within hour n, bus X reaches its destination." "Within hour n, bus Y reaches its destination." "Within hour n, both buses reach their destinations

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions