16
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ? The Language resembles Pseudocode - good for teaching and learning fundamentals of programming

Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ? The Language resembles Pseudocode - good for teaching and learning fundamentals

Embed Size (px)

Citation preview

Page 1: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Mastering Char to ASCIIAND DOING MORE RELATED STRING MANIPULATION

Why VB.Net ? The Language resembles Pseudocode - good for teaching and learning fundamentals of programming

Page 2: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

*Each character on your keyboard has an ASCII code.

•Capital "A" = 65

•"a" = 97

•“@” = 64

And so on … (see Ascii table on Slide 5)

Page 3: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Create a Program that converts a char to ASCII

Task 1Task 1

Page 4: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Design this interfaceDesign this interface

Task 2Task 2

Page 5: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Add this code to make it workAdd this code to make it work

Page 6: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Task 3Task 3

Design this interface

Design this interface

Page 7: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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?

Page 8: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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.

Page 9: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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

Page 10: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

ASCII CHART: Note that characters like ! And # etc are between Decimal Numbers 32 – 64 and also 91 - 96

Page 11: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

Screenshot your solutionScreenshot your solution

Page 12: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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

Page 13: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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?

Page 14: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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

Page 15: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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

Page 16: Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals

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