Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ASAP HELP PLEASE!! :( The hours of a day can be represented in the am/pm format or in 24 hour format. Your employer wants a

ASAP HELP PLEASE!! :(

The hours of a day can be represented in the am/pm format or in 24 hour format. Your employer wants a program that takes an hour in am/pm format and prints it in 24 hour format. You are given the following test data and an incomplete and erroneous program. The 24 hour clock used here may not be quite the same as the one you may be used to, but the test data we have provided conforms to the conventions used by your employer.

Input

Expected output

0 am

0

3 am

3

12 pm

12

1 pm

13

12 am

24

# Problem: convert hour from am/pm to 24 hour format

# Input: hour

# Input: indication

hour = 1

indication = 'pm'

# Output: hour, an integer from 0 to 24 inclusive

if indication == 'am'

hour = 24

if indication == 'pm'

hour = hour + 12

print(hour)

a.

i.What are the inputs and outputs of this problem and their types?

ii.What are the admissible values for the inputs?

b.

i.What are the syntax errors in this program?

ii.Once they are corrected, which of the above tests would the program still fail and why?

iii.Some borderline input values are missing from the test table. Indicate those input values and the expected outputs.

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

Students also viewed these Databases questions

Question

Formic acid (HCO2H) has Ka = 1.77 10-4.

Answered: 1 week ago

Question

List the different categories of international employees. page 642

Answered: 1 week ago