The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
12. The following pseudocode implements the elapsed time problem of Problem 10.5 if the elapsed time is less than 24 hours. Select test cases until every-statement coverage is achieved. Select additional test cases to achieve every-branch coverage
Â
read hr1 min1 AmOrPm1 read hr2 min2 AmOrPm2 if (hr1 == 12)
hr1 = 0 if (hr2 == 12)
hr2 = 0
if (AmOrPm1 == pm)
hr1 = hr1 + 12 if (AmOrPm2 == pm)
hr2 = hr2 + 12
Â
Â
if ( min2 min1)
min2 = min2 + 1 hr2 = hr2 – 1
if( hr2 hr1)
hr2 = hr2 + 24
elapsed = min2 – min1 + 60* (hr2 – hr1) print elapsed
Â
|
C0—Start Time |
Stop Time |
Expected Elapsed Time |
|
12:00 p.m. |
12:40 p.m. |
0:40 |
|
9:57 p.m. |
11:40 p.m. |
1:43 |
|
5:00 p.m. |
4:00 a.m. |
12:00 |
Â
Â
Â
Â
Â
|
C1—Start Time |
Stop Time |
Expected Elapsed Time |
|
Tests above plus the following: |
||
|
8:00 a.m. |
12:40 p.m. |
4:40 |
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll