Question: Assignment 2 Error Handling and Helper Function Library Design Due: Sunday, 2/7/2021, 11:59pm on Canvas Code Due: Sunday, 2/14/2021, 11:59pm on TEACH Users are seldom
Assignment 2 Error Handling and Helper Function Library Design Due: Sunday, 2/7/2021, 11:59pm on Canvas Code Due: Sunday, 2/14/2021, 11:59pm on TEACH Users are seldom perfect. It is our job as programmers to catch mistakes and correct them to prevent crashing the program. The table below illustrates common functions you will use for error handling and working with user in the CS 16X series. Function Name Input (Parameters) Output (Return Type) Description/Notes check_range int lower_bound int upper_bound int test_value Boolean Indicates if the provided number is in the specified range is_capital char letter Boolean Indicates if a given character is a capital letter is_even int num Boolean Indicates if a given number is even is_odd int num Boolean Indicates if a given number is odd equality_test int num1 int num2 Int Tests num1 against num2 and returns -1 if num1 < num2, returns 0 if num1 == num2, returns 1 if num1 > num2 float_is_equal float num1 float num2 float precision Boolean Tests if num1 and num2 are equal to each other within a certain precision (hard coded) is_int string num Boolean Indicates if a given string is an integer numbers_present string sentence Boolean Indicates if the provided string contains numbers letters_present string sentence Boolean Indicates if the provided string contains letters contains_sub_string string sentence string sub_string Boolean Indicates if substring exists in sentence word_count string sentence Int Provides the number of words in a given string to_upper string sentence String Capitalizes all letters in a given string and leave all non-letter characters unchanged to_lower string sentence String Makes all letters lowercase in a given string and leave all non letter characters unchanged get_int string prompt Int Takes a prompt from the user as a string literal, checks if input is a valid integer, returns the provided integer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
