Buy Best Penn Foster 037094

Buy Best Penn Foster 037094

 

Object-Oriented
Programming
Fundamentals
OVERVIEW
YOUR PROJECT
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
project.
INSTRUCTIONS
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
project.
2. Add a new class to the project named LoginException.vb
(Figure 34).
Make the LoginException class a custom exception by
deriving from the Exception class. See Assignment 3 for
an example.
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
valid username?
5. Stop debugging the application. You’ll now add an exception
handling code.
6. Add a Try…Catch statement for the following line in the
btnLogin_Click event handler procedure:
Main.Login(text username.Text, txtPassword.Text)
Add the following line to the Catch block:
MessageBox.Show(“Incorrect password.”)
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
grocery items. 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 read only.
■ BrandName. The name as described on the item’s
packaging
■ 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 Goods, Drinks, Deli,
Dry Goods, Frozen Food, and Produce. See
Assignment 2 on how to create enumerations.
10. The class should contain the following public
constructors:
■ 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
values.
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 on this
code after testing.
SUBMISSION GUIDELINES
To submit your project, you must provide the following five
files:
■ Main. vb
■ LoginForm.vb
■ LoginException.vb
■ GroceryItem.vb
■ GroceryBasket.vb

 

Need Help with Penn Foster?

Get Exam Done provides qualified online tutoring to university students in the State. All aspects of the course, including assignments, discussions, quizzes, and examinations, are covered by our online tutoring service. To assist our university students, we have employed professionals who can handle emergencies. Therefore, regardless of not you are having trouble with a task or paying someone to take a test, we have got your back. Our online tutors work around the clock to complete your assignment and handle any issues you may be having. Our online course provider has fair prices as well. Get our online study assistance now to get started on the path to the grades you want!

Placeholder $3.99
Buy Best Penn Foster 037094
  • 200+ Downloads
  • 8k Views