Upload
buck-cummings
View
220
Download
0
Embed Size (px)
Citation preview
Mastering Char to ASCIIAND DOING MORE RELATED STRING MANIPULATION
Why VB.Net ? The Language resembles Pseudocode - good for teaching and learning fundamentals of programming
*Each character on your keyboard has an ASCII code.
•Capital "A" = 65
•"a" = 97
•“@” = 64
And so on … (see Ascii table on Slide 5)
Create a Program that converts a char to ASCII
Task 1Task 1
Design this interfaceDesign this interface
Task 2Task 2
Add this code to make it workAdd this code to make it work
Task 3Task 3
Design this interface
Design this interface
Add this code to make it workAdd this code to make it work
Question 1: What will the output here be?
Question 1: There is one small mistake – how can
you correct this?
Question 1: What will the output here be?
Question 1: There is one small mistake – how can
you correct this?
The code outputs each letter (at a time) in the word that is input into the text box
Adding this would solve the
problem.
Adding this would solve the
problem.
Write a program that:
1.Asks a user for a letter grade.2.Validates this input. (i.e. if the user puts in an invalid character like an “@” or a “#” it would output an error message, else accept the input.
Challenge #1Challenge #1
*This requires you to have an understanding of ASCII codes
Follow on: See Challenge 4Follow on: See Challenge 4
ASCII CHART: Note that characters like ! And # etc are between Decimal Numbers 32 – 64 and also 91 - 96
Screenshot your solutionScreenshot your solution
One way of developing the solution ….One way of developing the solution ….
*This is not an ideal solution – although you could develop it and get it to work
Another [Partial] AnswerAnother [Partial] Answer
This code involves declaring a variable for converting to Ascii, and storing an integer (value) in it, corresponding to
the character input by the user. It also checks to see whether the ASCII value is above 64, and if it is NOT (i.e. it is below 64) - an error message is
returned. What needs to be changed / Added?
This code involves declaring a variable for converting to Ascii, and storing an integer (value) in it, corresponding to
the character input by the user. It also checks to see whether the ASCII value is above 64, and if it is NOT (i.e. it is below 64) - an error message is
returned. What needs to be changed / Added?
Write a program that:
1.Asks the user to enter a username in the format: yearofbirth(xxxxFirstname, e.g. 1983Joey2.Write code to extract the first four characters (the year) and output it in the format:“You were born in the year: xxxx”
Challenge #2Challenge #2
Write a program that:
1.Asks the user to enter a word2.Extracts all the vowels in the word (if any)3.Concatenates all the vowels together to form a new stringofcharacters
e.g. Input: APPLE Output: AE4. Extra challenge: Create a new word in the format:First character & Mid Character & Last Character
Challenge #3Challenge #3
Write a program that:
1.Asks the user for an email address2.If the characters before the “@” sign are NOT alphanumeric, to return an error message.
Challenge #4Challenge #4
*This requires you to have an understanding of ASCII codes
(See Challenge 1 – this is a follow on)
INVALID CHARACTER is present before the
“@” sign
INVALID CHARACTER is present before the
“@” sign