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

When you are calling your friends who live in different cities around the world,

ID: 3662026 • Letter: W

Question

When you are calling your friends who live in different cities around the world, it would be

helpful to know what time it is where they live. Otherwise you might end up calling and waking

them in the middle of the night. Below are the time differences between Philadelphia and

several cities around the world.

Honolulu

-6 hours

Seattle

-3 hours

London

+5 hours

Moscow

+8 hours

Hong Kong

+12 hours

Auckland

+17 hours

Write a program that asks the user to input the current time in Philadelphia in military format

(e.g.: 0900, 1730), and outputs the current time in the cities listed above. Two example runs are

given below.

Again, there is no need to use conditional statements. You must only use arithmetic statements

to produce your results. Use commands from the iomanip library to format your output.

Sample 1:

What is the current time in Philadelphia? 0415

Current times in other cities

Honolulu: 2215

Seattle: 0115

London: 0915

Moscow: 1215

Hong Kong: 1615

Aukland: 2115

Sample 2:

What is the current time in Philadelphia? 1440

Current times in other cities

Honolulu: 0840

Seattle: 1140

London: 1940

Moscow: 2240

Hong Kong: 0240

Aukland: 0740

I kind of know how to do it, but how would you account for when the time hits 0000. I don't want a negative output.

Explanation / Answer

The following program creates 2 classes. Time and extendtime..It sets up the time by taking input from the user for the city of philadelphia and then calculates the time in different city according to this time entered.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote