Question: Write a function that returns the order of a character in the alphabet ( e . g . , its position ) . Letter A
Write a function that returns the order of a character in the alphabet eg its position Letter A is is is dotsZ is The function accepts a character ch and returns its position in the alphabet. NOTE that the Ifunction should return the same order regardless of upper or lower case. SoA and a both should return
An easy way to do this is to remember that characters are represented by numerical code. So the letter has a number associated with it Thus ch A would return if ch is A if it was B etc. Remember to do the appropriate computation for both upper and lower case letters.
Examples:
charPosition
charPosition
charPosition
Your Answer:
public int charPositionchar ch
f
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
