Thursday, January 27, 2011

Chapter 10: Nuke it! (Microwave Oven Application)

This week we will finish discussing classes as they are outlined in Chapter 10 of our text.


To help you get started assembling the files for this project I will outline the files needed and I have attached the partially completed MicrowaveOven.vb file with code for the microwave interface. 

When I chose this assignment, I had envisioned separating the main functionality of the Microwave Oven application from the interface. I was expecting to see a Time class,  a MicrowaveOven class, and another file that would handle the button clicks and display, etc, for the microwave interface. The book's example has only two files, a Time class file (Time.vb) and a MicrowaveOven interface file (MicrowaveOven.vb). 

Here is the partially complete MicrowaveOven.vb file. You will need to complete the code for buttons 3-9, and 0, and the clear button. If you feel ambitious and would like to make an attempt at separating some of the functionality into a re-useable "MicrowaveOven" class (i.e. another file, containing a Public MicrowaveOven class), you are welcome to do so.

Below is a screenshot of the microwave interface, your microwave can be designed differently, if you prefer, this is just to give you an idea and help you get started.

 

The requirements for the functionality of the microwave are detailed in Exercise 10.11 (The Microwave Oven Application) on page 482. This assignment is due in two weeks on Thursday, February 10, 2011. Please zip and upload all associated files in Blackboard before class Thursday, February 10, 2011.


Thursday, January 20, 2011

Optional Assignment: 10.2 Time Class Case Study

If you would like some extra practice, you can work through the Time Class Case Study example on pages 419 - 424.

This example demonstrates the Time class and the graphical user interface test program that we discussed today.

After a successful build, zip and submit your files on Blackboard by Thursday, January 27, 2011.

Thursday, January 13, 2011

Using LINQ to Query an Array

Set up and build the "Using LINQ to Query an Array of Employee Objects" example on pages 403-5. 

Use the Chapter 9 files from the Visual Basic® 2008 How to Program Example Programs website. Use the sample program for Figures 9.3 and 9.4. You will have both the employee.vb and the LINQWithArrayOfObjects.vb files. 

The employee.vb file is the Employee class, and the LINQWithArrayOfObjects.vb is the main program that is being used to test the class and using LINQ.

  1. Once you have successfully built the program, add an additional LINQ Query (like the one used to filter the salary results on line 20). 
  2. Use the two queries to display salaries above $5000 and below $5000. 
  3. This means you will need to change the existing salary query as well.  
  4. Add 5 more employees with varying salaries.
  5. Build and debug the program.
Once you have successfully built the program, zip your files and submit them in Blackboard. 

This assignment is due Thursday, January 20, 2011.