In the graded project for Lesson 2, you implemented the login
process for a Windows Forms application in Visual Studio.
In this project, you’ll add exception handling to the login
process. You’ll also create a class to represent a grocery item
and a custom collection class to represent a grocery basket.
The output of this project will be used in the next graded
1. In Visual Studio, load the GroceryApp project that you
completed in Lesson 2. If this isn’t available, then you’ll
need to ask your instructor for the finished Lesson 2
2. Add a new class to the project named LoginException.vb
Make the LoginException class a custom exception by
deriving from the Exception class. See Assignment 3 for
3. In the Login procedure of the Main module, replace the
two lines that read MessageBox.Show(“Incorrect password.”)
with the following code:
Throw New LoginException
4. Save your work and debug the application. What happens
now when you type in an incorrect password for a
5. Stop debugging the application. You’ll now add exception
6. Add a Try…Catch statement for the following line in the
btnLogin_Click event handler procedure:
Add the following line to the Catch block:
FIGURE 34—Enter LoginException.vb and click Enter.
7. Save your work and debug the application. It should
perform the same action as before.
8. Add a new public class to the project named
GroceryItem. See Assignment 1 for help.
9. The class should contain the following public properties:
■ ScanNumber. Represents the unique serial code for
the item on the shelf. This property should be readonly.
■ BrandName. The name as described on the item’s
■ Description. A short description of the item
■ Price. The amount of money it costs to buy the item.
Make sure that only positive values can be assigned
to this property.
■ Aisle. This should indicate one of the following
aisles: Bakery, Canned Good, Drinks, Deli,
Dry Goods, Frozen Food, and Produce. See
Assignment 2 on how to create enumerations.
10. The class should contain the following public
■ A constructor that accepts and sets only the
ScanNumber property. Remember, if a property is
read-only, then you’ll need to set the variable, not
use the property name.
■ A constructor that accepts and sets the
ScanNumber, BrandName, and Price properties.
11. Add a new public class to the project named
GroceryBasket. See Assignment 2 for help.
a. Derive from the generic Dictionary class.
b. Ensure that only String values are used as keys.
c. Ensure that only GroceryItem objects are stored as
12. Test your work. You can add code to the btnLogin_Click
event handler procedure to instantiate the GroceryItem
class and add multiple objects to the GroceryBasket
class. Make sure you either remove or comment out this
code after testing.
To submit your project, you must provide the following five
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at firstname.lastname@example.org.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at email@example.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at firstname.lastname@example.org.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.