Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started