Question: Function Name: charDivide Inputs: 1. ( char ) A decimal number Outputs: 1. ( char ) The left letter of the split 2. ( char
Function Name: charDivide
Inputs:
1. ( char ) A decimal number
Outputs:
1. ( char ) The left letter of the split
2. ( char ) The right letter of the split
Topics: ( rounding ), ( ASCII math ), (string-number conversions)
Background:
Michael is working on a new project for his residence hall! He is looking to
hang each letter of the alphabet up along the top of the hallway, but hes got a weird corner that
will cause his alphabet to be split up onto two different walls and is unsure of which letters
should be divided by the corner!
Function Description:
You are given a string that holds a decimal number, describing which letter will split the
alphabet. If your input is a decimal number, then that means your alphabet will be split between
two letters. Your first output will be the letter to the left of the split and your second output will be
the letter to the right of the split. If your input is a whole number, then your split occurs on a
letter and you should output the same letter for both outputs.
Example:
[leftLet, rightLet] = charDivide('13.3')
leftLet 'M'
rightLet 'N'
[leftLet, rightLet] = charDivide('21')
leftLet 'U'
rightLet 'U'
Notes:
Your alphabet should be uppercase letters only.
The letter 'A' will be described by the number 1 and the letter 'Z' will be described by
the number 26.
All inputs will be integers between 1 and 26 (inclusive).
Hints:
The str2num() , floor() , and ceil() functions may be useful.
Dont forget about doing math with ASCII values.
PLEASE SOLVE USING MATLAB. TO GET A THUMBS UP PLEASE DO NOT USE CONDITIONAL STATEMENTS AND ITERATIONS ON THIS PROBLEM!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
