Question: Please be specific on how the program is written down and please see if you can do all the steps. Thank you In this lab,
Please be specific on how the program is written down and please see if you can do all the steps. Thank you
In this lab, you will be experimenting with reading in data from the keyboard, and storing it in variables
of various types. This will require you to demonstrate and understanding of not only user input through
Console.ReadLine but also of type casting through the Convert class methods. Additionally, this lab
will require you to use both StreamWriter and StreamReader to save data to a file, and then read it back
in
EXAMPLE PROGRAM
There is no example program this week. Any sample I provided would have been very easy to modify
into your lab, as much of the syntax would have been identical. On the first labs I was okay with that, but
I want to give you a chance to demonstrate that you can work from scratch on this. Sample code will
resume next week with Lab
YOUR PROGRAM
Your program this week will ask a user to enter some information to register for some asofyet
unknown service. You will prompt the user to enter their full name, gender as M or F age as an
integer and salary as a double, with no dollar signs or commas You will store the information into
variables of the appropriate types, converting as necessary. Once all the data is gathered, you will open
a file for writing and save all the data to a file, one piece of data per line. Once the writing is complete,
you will close the file for writing, open it for reading, and read in all the information again, storing it in a
second set of variables to test that the data was properly written. The sample output below should help
guide you through the general form, as will the steps below:
Display the first welcomethanks messages.
Prompt for each piece of information, pausing for user input after each and storing the
value in the appropriate variables a string for name, char for gender, int for age, and
double for salary
Tell the user that you are going to save their data.
Open a file for writing. I called mine userdata.txt but the name is up to you.
Write the data all four pieces to the file. Use WriteLine, not Write, as reading will be
more difficult with the latter.
Close the file.
Tell the user that saving is complete and that you are going to do a test read.
Open the file for reading.
Read in the file, storing it in new variables of the appropriate types.
Close the file.
Output the values of the new variables to confirm that the information was correct.
End the program
Name the cs file according to the standard convention First InitialLast NameLabcs and submit
the completed cs file through the Blackboard assignment submission tool. Dont forget to include the
comment block at the top.
CITP Survey of Programming Languages Lab
CHALLENGE
This is the first lab that has a bit of weight to the code... my sample wasnt necessarily optimized, but
came in at about lines, with whitespace. Because of that, we have an easy challenge this week. Take
the time to comment your code, explaining what the variables will store, what each section of code
does, etc. There really isnt a right or wrong way, so just try to explain whats going on to the best of
your ability.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
