Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals."— Presentation transcript:

1 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

2 *Each character on your keyboard has an ASCII code. Capital "A" = 65 "a" = 97 “@” = 64 And so on … (see Ascii table on Slide 5)

3 Create a Program that converts a char to ASCII Task 1

4 Design this interface Task 2

5 Add this code to make it work

6 Task 3 Design this interface

7 Add 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?

8 The code outputs each letter (at a time) in the word that is input into the text box Adding this would solve the problem.

9 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 #1 *This requires you to have an understanding of ASCII codes Follow on: See Challenge 4

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

11 Screenshot your solution

12 One way of developing the solution …. *This is not an ideal solution – although you could develop it and get it to work

13 Another [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?

14 Write a program that: 1.Asks the user to enter a username in the format: yearofbirth(xxxxFirstname, e.g. 1983Joey 2.Write code to extract the first four characters (the year) and output it in the format: “You were born in the year: xxxx” Challenge #2

15 Write a program that: 1.Asks the user to enter a word 2.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: AE 4. Extra challenge: Create a new word in the format: First character & Mid Character & Last Character Challenge #3

16 Write a program that: 1.Asks the user for an email address 2.If the characters before the “@” sign are NOT alphanumeric, to return an error message. Challenge #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


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

Similar presentations


Ads by Google