CSCI 1301 - Lab 07

Clément Aubert

January 29, 2018

Deadlines: This lab needs to be completed and perfectly understood before exam #1 (02/15).

Dependencies: This lab uses the knowledge you acquired in all the previous lab.

Part I - Milestone #1

You accomplished a lot since you started this class. Let’s take a moment to look back at what you learned, and to make sure you understand all those notions and skills. If you have a doubt, feel free to look back at the corresponding lab. If you haven’t already, look at the “Pushing Further” parts of those previous lab, as noted below.

What You Learned

To Use Visual Studio

To Be Methodical

  • Not to be afraid of the documentation (Lab 2 - Part II)
  • To use the following shortcuts (remember that there is a cheatsheet at http://visualstudioshortcuts.com/):
    • ALT + F4 to close VS (or any Windows program, actually)
    • Ctrl + Shift + b to build the solution
    • Ctrl + F5 to start the program without debugging
    • F10 or F11 to start the program with the debugger
    • Ctrl + Shift + n to create a new project
    • Ctrl + Shift + F12 to “jump” to the line where VS thinks there is an error
    • Ctrl + Shift + f to open the “Find and Replace” menu
    • CTRL + k, then CTRL + d to indent your code
  • To compile your code frequently (Lab 4 - Part 0)
  • To read the error messages (Lab 2 - Part IV)
  • To organize your files (Lab 3 - Part 0)

To Write Programs!

Academic Life

  • Not to be afraid of your professor (hopefully!).
  • How, where, and when to ask for help.
  • What are my expectations for this class.
  • How to organize your workflow, the importance of planning ahead.
  • … to be continued!

Maybe you decided what your major was going to be. Maybe you changed your mind. Maybe you’re not sure. Being confused and uncertain is sometimes part of the process of taking decisions and learning, and that’s all right. It is normal to hesitate. This page by a colleague in Computer Science may be a good read for students hesitating between IT, CS and MIS, or wanting to have more information about those majors.

Did You Pushed Further?

If you haven’t done the optional parts of the lab, it may be a good moment to go back and look at them. Computer Science and Information Technology (aspiring) majors are strongly recommended to look at those “Pushing Further” parts. Those parts help you to be ready for the future: they prepare you for the next lab, give you heads-up on the lecture, and tease your curiosity. In them, you learned (or you’ll learn):

  • How to classify programming languages (Lab 2)
  • What is the difference between .NET Core and .NET framework (Lab 3)
  • How to print unicode characters (Lab 3)
  • How to use composite formatting (Lab 4)
  • How to use namespaces in a different way (Lab 4 and Lab 5)
  • How to convert an int, a float and a double into a string (Lab 5 and Lab 6)
  1. Open one of your project. It can be any project, as long as it uses variables.
  2. Make sure you can compile and run it.
  3. Hit F11 once. Observe what happen. Move the black screen where the printing happen (called the console, or Command prompt) to see your code. Hit F11 a couple of times, and see what happen. You are executing your code line by line, and can track many useful information, including the value and datatype of your variables (in the “Locals” panel / window).
  4. You can find out at https://msdn.microsoft.com/en-us/library/y740d9d3.aspx (VS 2015) or https://docs.microsoft.com/en-us/visualstudio/debugger/navigating-through-code-with-the-debugger (VS 2017) alternative ways of starting the debugging functionalities of VS.

Part II - Working on Problem-Solving

Here is a problem that involves almost all the previously mentioned notions and skills. It is phrased in a more abstract way, closer to the kind of problem you will be facing if you were a software-developer. Think about what you need to do before starting to type your code, and when you start writing your code, make sure you compile it frequently.

Write a program that asks the user for their name, their number of guests, and the number of pizzas they have. Your program should then print the name of the user, the number of people at the party, the number of pizzas, and what portion of pizza will everyone have, assuming the pizzas will be shared equitably.

A couple of additional precisions:

It would be nice if you could use (some of) the following techniques: