Part 3 - Basic Input
This section covers how to read input using the console and how to convert input to a numeric type so that you can do math with it.
User Input
What to Do?
Work through Part 3 - Keyboard Input tutorial
Make a project that you can experiment with as you do the readings
You will need to be able to convert data stored as a string to various numeric formats:
Use the Convert class for a wide range of conversions
Use the TryParse() method in Double and Int32 for built-in error proofing.
Complete the User Input Programming Assignment (Greetings, Adder, Distance, Hypotenuse).
These will be handed in.
It is a good skill to get used to reading through the official documentation provided by Microsoft in order to help you use various libraries in C#. Here is a link to the Math Class library. Have a look at the Methods section to see what other methods are available:
You will need the Sqrt() and Round() methods. See if you can figure out how to use them from the documentation. The Pow() method may also be useful.
Sometimes the examples are overly complicated and not helpful. If this is the case, look elsewhere on the internet.
SUBMIT
A project Part 3 - Console Input consisting of 4 parts:
Greetings
Optional bonus using system date.
Adder
Distance
Hypotenuse
Feel free to augment your assignment with colors and other console features:
Lesson Tutorial - User Input
User Input Assignment
Files
Hints/Tips/FAQ
Q: My program crashes when I try to convert a non-numeric value. How can I fix this?
A: In Part 5 we cover error checking by using TryParse() to convert instead of the Convert class. You are welcome to read ahead if you wish or use the internet to help you.