1. Identify the format of the function used: no return type & no parameter, with return type & no parameter, no return type & with parameter and with return type & with parameter. 2. Identify the format and actual parameters. 3. Identify the function signature 4. Identify parameter if value parameter, reference parameter or constant reference parameter is used. 5. Identify the the scope of variable used. 6. Identify the type of C++ function is used.

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

PROGRAMMING LANGUAGE: C++

Note: Kindly refer to the attached screenshot for the sample program.

1. Identify the format of the function used: no return type & no parameter, with return type & no parameter, no return type & with parameter and with return type & with parameter.

2. Identify the format and actual parameters.

3. Identify the function signature

4. Identify parameter if value parameter, reference parameter or constant reference parameter is used.

5. Identify the the scope of variable used.

6. Identify the type of C++ function is used.

main.cpp
1 #include ciostream>
2 #include <string>
3
4 using namespace std;
5
6 int main()
string employeeName;
int arrivalHr;
10
11
12
13
14
15
16
int departureHr;
int departureMin;
bool departureAM;
char response;
char discard;
17
char isAM;
18
19
20
cout <« "This program calculates the total time spent by an "
« "employee on the job." <« endl;
cout <« "To run the program, enter (y/Y: ";
cin >> response;
21
22
cout « endl;
cin.get(discard);
23
24
25
26
while (response == 'y' || response == 'Y')
27
28
cout <« "Enter employee's name: ";
29
getline(cin, employeeName);
30
cout <« endl3;
31
32
if (isAM == 'y' || İSAM == 'Y')
arrivalAM = true;
33
34
35
else
36
arrivalAM = false;
37
38
39
cout <« "Enter departure hour: ";
cin >> departureHr;
cout « endl;
40
41
42
cout <« "Enter departure minute: ";
cin >> departureMin;
43
cout << endl;
44
45
46
47
cout <« "Enter (y/Y) if departure is before 12:00PM: ";
cin >> I AM;
cout <« endl;
if (isAM == 'y' || İSAM == 'Y')
departureAM = true;
48
49
50
else
51
departureAM = false;
52
53
54
cout <« employeeName << endl;
timeOn Job(arrivalHr, arrivalMin, arrivalAM,
55
departureHr, departureMin, departureAM);
56
57
cout <« "Enter arrival hour: ";
cin >> arrivalHr;
58
59
cout « endl;
60
cout <« "Enter arrival minute: ";
Transcribed Image Text:main.cpp 1 #include ciostream> 2 #include <string> 3 4 using namespace std; 5 6 int main() string employeeName; int arrivalHr; 10 11 12 13 14 15 16 int departureHr; int departureMin; bool departureAM; char response; char discard; 17 char isAM; 18 19 20 cout <« "This program calculates the total time spent by an " « "employee on the job." <« endl; cout <« "To run the program, enter (y/Y: "; cin >> response; 21 22 cout « endl; cin.get(discard); 23 24 25 26 while (response == 'y' || response == 'Y') 27 28 cout <« "Enter employee's name: "; 29 getline(cin, employeeName); 30 cout <« endl3; 31 32 if (isAM == 'y' || İSAM == 'Y') arrivalAM = true; 33 34 35 else 36 arrivalAM = false; 37 38 39 cout <« "Enter departure hour: "; cin >> departureHr; cout « endl; 40 41 42 cout <« "Enter departure minute: "; cin >> departureMin; 43 cout << endl; 44 45 46 47 cout <« "Enter (y/Y) if departure is before 12:00PM: "; cin >> I AM; cout <« endl; if (isAM == 'y' || İSAM == 'Y') departureAM = true; 48 49 50 else 51 departureAM = false; 52 53 54 cout <« employeeName << endl; timeOn Job(arrivalHr, arrivalMin, arrivalAM, 55 departureHr, departureMin, departureAM); 56 57 cout <« "Enter arrival hour: "; cin >> arrivalHr; 58 59 cout « endl; 60 cout <« "Enter arrival minute: ";
61
cin >> arrivalMin;
cout << endl;
cout <« "Enter (y/Y) if arrival is before 12:00PM: ";
cin >> isAM;
62
63
64
65
cout << endl;
66
67
int arrivalMin;
68
bool arrivalAM;
69
70
71
cout <« "Run program again (y/Y): ";
cin >> response;
cout <« endl3;
72
cin.get(discard);
73
74
75
return O;
76 }
77
78 void timeOn Job (int arvHr, int arvMin, bool arvISAM,
79
80 {
int depHr, int depMin, bool depIsAM)
int arvTimeInMin;
int depTimeInMin;
int timeOnJobInMin;
81
82
83
84
85
else if (arvISAM == true && depIsAM == false)
{
arvTimeInMin = arvHr * 60 - arvMin;
depTimeInMin = depHr * 60 - depMin;
86
87
88
89
timeonJobInMin =
cout <« "Time spent of job: "
90
(720 - arvTimeInMin)
depTimeInMin3;
91
92
<« timeOnJobInMin / 60 <« " hour(s) and "
<« timeOnJobInMin % 60 « " minutes." <« endl;
93
94
}
95
else
if (arvTimeInMin <= depTimeInMin)
96
97
timeOn JobInMin = depTimeInMin - arvTimeInMin;
cout <« "Time spent of job: "
<« timeOnJobInMin / 60 <« " hour(s) and "
<« timeOnJobInMin % 60 <« " minutes." <« endl;
98
9
10d
101
102
103
else
cout <« "Invalid input." <« endl;
if ((arvIsAM == true && depIsAM == true)
|I (arvIsAM == false && depISAM == false))
{
cout <« "Invalid input." <« endl;
104
105
106
107
108
109
110
111
112
void timeOnJob(int arvHr, int arvMin, bool arvIsAM,
int depHr, int depMin, bool depIsAM);
113
114 }
115
Transcribed Image Text:61 cin >> arrivalMin; cout << endl; cout <« "Enter (y/Y) if arrival is before 12:00PM: "; cin >> isAM; 62 63 64 65 cout << endl; 66 67 int arrivalMin; 68 bool arrivalAM; 69 70 71 cout <« "Run program again (y/Y): "; cin >> response; cout <« endl3; 72 cin.get(discard); 73 74 75 return O; 76 } 77 78 void timeOn Job (int arvHr, int arvMin, bool arvISAM, 79 80 { int depHr, int depMin, bool depIsAM) int arvTimeInMin; int depTimeInMin; int timeOnJobInMin; 81 82 83 84 85 else if (arvISAM == true && depIsAM == false) { arvTimeInMin = arvHr * 60 - arvMin; depTimeInMin = depHr * 60 - depMin; 86 87 88 89 timeonJobInMin = cout <« "Time spent of job: " 90 (720 - arvTimeInMin) depTimeInMin3; 91 92 <« timeOnJobInMin / 60 <« " hour(s) and " <« timeOnJobInMin % 60 « " minutes." <« endl; 93 94 } 95 else if (arvTimeInMin <= depTimeInMin) 96 97 timeOn JobInMin = depTimeInMin - arvTimeInMin; cout <« "Time spent of job: " <« timeOnJobInMin / 60 <« " hour(s) and " <« timeOnJobInMin % 60 <« " minutes." <« endl; 98 9 10d 101 102 103 else cout <« "Invalid input." <« endl; if ((arvIsAM == true && depIsAM == true) |I (arvIsAM == false && depISAM == false)) { cout <« "Invalid input." <« endl; 104 105 106 107 108 109 110 111 112 void timeOnJob(int arvHr, int arvMin, bool arvIsAM, int depHr, int depMin, bool depIsAM); 113 114 } 115
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Function Arguments
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