CS 1400 Lab #3: Investigating Data Types in C#


After completing this assignment you should be able to declare and use the Value-Types int and double, and the Reference-Type string.

You should be able to input and output each of these in a Console program.

Study Material

Be sure that you are familiar with the slides for this week. Thoroughly study the examples shown in the slides.

Writing the Program

Study the instructions that follow. Think carefully about what variables you will need in your program and what data type each variable should be declared as. Then write a Console program that does the following:

  1. The program introduces itself by display the message "Hello, my name is Hal."
  2. The program then asks the user to type in their name.
  3. The program gets the user's input and saves it the first variable. Let's assume that the user typed in the name Sally.
  4. The program then displays the message "Hello Sally, how old are you?
  5. The program then gets the user's input and saves it in the second variable. Add one to this number. If the name of this variable is age, write

    age = age + 1;

    to add one to the variable age. Let's assume that the user types in 12.

  6. The program then displays the message "How much money do you have Sally"?
  7. The program then gets the user's input and saves it in the third variable. Let's assume that the user types in 4.50.
  8. Finally, display a message that shows the user's name, how old they will be on their next birthday, and how much money they have. Using the values given in the previous steps, this might look something like

    Thank you Sally. You are almost 12 years old and you have $4.50.


    When you submit this project to Canvas, answer the following two questions by adding a comment to your submission.

    Question #1: What data type did you make the variable that holds the person's age? Why did you choose that data type?

    Question #2: When you output the amount of money that the person has, you could have used any of these formatting specifications:

    Describe the benefits of using the last one.

When you are satisfied that your program works correctly, submit the code as explained below. Be sure that your code conforms to the style guidelines.

File(s) to Submit:

Place your complete project folder into a zip file and name the zip file
lab_03_your-initials_V1.0.zip. For example, I would name my file lab_03_RKD_V1.0.zip. Submit this assignment as Lab #3 on Canvas. Please do not include any other files in your submission.

Grading Guidelines

Description Points possible

Assignment has been properly submitted to Canvas.


Your program works correctly and meets the specifications.


You have correctly answered the two questions in this lab.

Total 7