Question: #include #include / / For std::setw and std::setfill using namespace std; / / Function prototypes void displayMenu ( ) ; void input ( int& hours,
#include
#include For std::setw and std::setfill
using namespace std;
Function prototypes
void displayMenu;
void inputint& hours, int& minutes, int& seconds;
void outputHourint hours, int minutes, int seconds, char type;
void outputHourint hours, int minutes, int seconds;
int convertToHourint hours, char& type;
int convertToHourint hours, char type;
int main
int hours, minutes, seconds;
char type, answer, choice;
do
Display the menu and get the user's choice
displayMenu;
cin choice;
switch choice
case : Convert hour to hour notation
inputhours minutes, seconds;
hours convertToHourhours type;
outputHourhours minutes, seconds, type;
break;
case : Convert hour to hour notation
inputhours minutes, seconds;
cout "Enter AM or PM AP: ;
cin type;
hours convertToHourhours type;
outputHourhours minutes, seconds;
break;
default:
cout "Invalid choice! Please select or endl;
break;
cout "Perform another conversion? yn: ;
cin answer;
while answer Y answer y;
return ;
Function to display the menu options
void displayMenu
cout "Choose the conversion type:" endl;
cout Convert hour notation to hour notation" endl;
cout Convert hour notation to hour notation" endl;
cout "Enter your choice or : ;
Function to get the input hours, minutes, and seconds
void inputint& hours, int& minutes, int& seconds
cout "Enter the hours: ;
cin hours;
cout "Enter the minutes: ;
cin minutes;
cout "Enter the seconds: ;
cin seconds;
Function to display the time in hour format
void outputHourint hours, int minutes, int seconds, char type
cout "The time is:
setw setfill hours :
setw setfill minutes :
setw setfill seconds ;
if type A
cout AM endl;
else
cout PM endl;
Function to display the time in hour format
void outputHourint hours, int minutes, int seconds
cout "The time is:
setw setfill hours :
setw setfill minutes :
setw setfill seconds endl;
Function to convert time from hour to hour notation
int convertToHourint hours, char& type
if hours
type A;
return ; Midnight case
else if hours
type P;
return ; Noon case
else if hours
type P;
return hours ; PM case
else
type A;
return hours; AM case
Function to convert time from hour to hour notation
int convertToHourint hours, char type
if type P && hours
return hours ; Convert PM to hour format
else if type A && hours
return ; Convert midnight case
else
return hours; Return hours unchanged for AM
Status: FAILED! Check: Test: Successful Output II Reason: Unable to find The time is: :: PM in the program's output. Choose the conversion type: Convert hour notation to hour notation Convert hour notation to hour notation Enter your choice or : Enter the hours: Enter the minutes: Enter the seconds: Enter AM or PM AP: The time is: ::
