Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Background For some reason, the U.S. military has been getting their time as the number of hours (double) or as the number of

image text in transcribed

In C++

Background For some reason, the U.S. military has been getting their time as the number of hours (double) or as the number of minutes (unsigned int) as the time elapsed from 00:00. Your task as their software engineer is to convert these measurements to a more readable format. More specifically, your task is to implement an overloaded function to convert either of these types of inputs to military time. Put simply, military time displays the hour count (023 inclusive) followed by the minute count ( 059 inclusive). If either the hour count or minute count is less than 10 (i.e., a single digit), you will need to prepend a 0 to it in your final answer. Assignment Prompt You are writing a program to convert a time measurement (can be minutes provided as integers or hours provided as doubles) to the time in the day (24 hours). Return the time in the format "hour":"minute". Note that if your minute and/or hour count is less than 10, you will need to prepend a 0 (i.e., 14:9 should be 14:09) as if you were reading the time on a digital clock displaying military time. For example, ToMilitaryTime (8.4)= " 08:24" OR ToMilitaryTime (389)= "06:29". When a double (representing the number of hours passed), round the time to the nearest minute using round () (\#include ). Note that the round () function returns a double. How can you convert this to a string? Furthermore, if you are given input that falls out of the range of military time (i.e., an hour or minute count is less than 0 OR hour count is >24.0 OR minute count > 1440 ), you will need to throw an exception. Functions to Implement

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions