Getting input from our users
Having a program that is interactive with our users is priceless. But it also makes us need to test the information received to make sure that we can actually use it.
For example I may ask my user for their age, and instead of them giving me a number they may type in a word. this will break my program if I try and do math with a word.
In our first series of lessons we are going to pretend that our users are not actually trying to break our program.... you will learn how to test the data to make sure that it is what we want, but for now we are not going to worry about it.
For example I may ask my user for their age, and instead of them giving me a number they may type in a word. this will break my program if I try and do math with a word.
In our first series of lessons we are going to pretend that our users are not actually trying to break our program.... you will learn how to test the data to make sure that it is what we want, but for now we are not going to worry about it.
The Video
Intro to the lesson
Finishing up the program
The Assignment
Using the information in the videos above, make a simple calculator.
1. Ask the user for their name using Console.Write
example... Hello, what is your name?
2. Ask them for 2 different numbers using Console.Write and Console.Readline
example... Please input a number
Please input a second number
3. Using a Console.WriteLine tell your user what data they put in. Include their name and their two numbers.
example... "Thank you Simon, the two numbers that you put in are 7 and 14.
4. Finish your program with a greeting
example... Thank you for using this program today. Good bye
1. Ask the user for their name using Console.Write
example... Hello, what is your name?
2. Ask them for 2 different numbers using Console.Write and Console.Readline
example... Please input a number
Please input a second number
3. Using a Console.WriteLine tell your user what data they put in. Include their name and their two numbers.
example... "Thank you Simon, the two numbers that you put in are 7 and 14.
4. Finish your program with a greeting
example... Thank you for using this program today. Good bye