a.)Write a C++ program that consists of a function declaration, a function definition and a main. The function declaration is as follows: void endTime (int ch, int cm, char cap, int dh, int dm, int eh, int em, char eap) // given any current hour, minutes and 'A' or 'P' for am/pm in parameters ch, cm and cap respectively, // and also given the duration (hours and minutes) of an activity in parameters dh and dm, // the function stores the end time in parameters eh, em and eap. Where eh will hold the hour of the end time, em holds the minute and eap holds eithe 'A' or 'P' for the end time. // All values are using a 12 hour clock // Function assumes all activities end in the same day Also include a main program that feeds the following arguments to the functions: 11, 25, 'A', 3, 45, hour, minute, ampm causing the function to calculate the end time as 3 10 P Using the calculated results, the main then outputs: If the current time is 11:25AM and we have 3 hours and 45 minutes to go, we have to sit here until 3:10PM :( The main then calls the function a second time with arguments curHour, curMin, curAP, durHour, durMin, finHour, finMinute, finAmPm, where the parameters are set to the following values before the call: curHour to 9 curMin to 15 curAP to 'A' durHour to 0 durMin to 45 finHour to 3 finMinute to 4 finAmPm to 'P' The main then using the results from the function call, outputs the follows: If the current time is 9:15AM and we have 0 hours and 45 minutes to go, we have to sit here until 10:00AM :) Outputting the smiling and frowning faces are optional, also which one and under what conditions to output are also up to you. b.)changed the start time passed to the function from 12:25 AM to 11:25 AM, which of course will also affect the calculated end time.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

a.)Write a C++ program that consists of a function declaration, a function definition and a main. The function declaration is as follows:

void endTime (int ch, int cm, char cap, int dh, int dm, int eh, int em, char eap)
// given any current hour, minutes and 'A' or 'P' for am/pm in parameters ch, cm and cap respectively,
// and also given the duration (hours and minutes) of an activity in parameters dh and dm,
// the function stores the end time in parameters eh, em and eap. Where eh will hold the hour of the end time, em holds the minute and eap holds eithe 'A' or 'P' for the end time.
// All values are using a 12 hour clock
// Function assumes all activities end in the same day

Also include a main program that feeds the following arguments to the functions:
11, 25, 'A', 3, 45, hour, minute, ampm

causing the function to calculate the end time as 3 10 P
Using the calculated results, the main then outputs:
If the current time is 11:25AM and we have 3 hours and 45 minutes to go, we have to sit here until 3:10PM :(

The main then calls the function a second time with arguments curHour, curMin, curAP, durHour, durMin, finHour, finMinute, finAmPm, where the parameters are set to the following values before the call:

curHour to 9
curMin to 15
curAP to 'A'
durHour to 0
durMin to 45
finHour to 3
finMinute to 4
finAmPm to 'P'
The main then using the results from the function call, outputs the follows:
If the current time is 9:15AM and we have 0 hours and 45 minutes to go, we have to sit here until 10:00AM :)

Outputting the smiling and frowning faces are optional, also which one and under what conditions to output are also up to you.

b.)changed the start time passed to the function from 12:25 AM to 11:25 AM, which of course will also affect the calculated end time.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I dont need to use : #include <bits/stdc++.h>

what is an alternative, I only know basic C++ not that

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education