Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function that takes, as arguments, two objects, value1 and value2. If value1 and value2 are either integers or strings containing only digits, cast
Write a function that takes, as arguments, two objects, value1 and value2. If value1 and value2 are either integers or strings containing only digits, cast value1 and value2 to integers and compute their average. If their average is greater than 50, return the string "Above 50" and if the average is less than 50, return the string "Below 50". If the average is equal to 50, return the string "Equal to 50", and if value1 or value2 are not integers or strings containing only digits, return the string "Invalid Input". Name this function compareToFifty(value1, value2) valuel 25 100 "45" 25 24.5 "hello" value2 25 "300" "100" 75 67 world" compareToFifty(value1, value2 "Below 50" "Above 50 "Above 50" "Equal to 50" "Invalid Input" "Invalid Input
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