471,311 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,311 software developers and data experts.

intro to VB.net assignment

I'm in an intro to VB.net class. I'm haveing trouble with this
assignment, if anyone could help me please let me know. thanks!

Coding Assignment 7-Chapter 8 OOP-CSCI-171 Intro to VB.NET

1. Create a Windows application that models a carton of eggs:

Define a public class and call it cEggCarton to model the egg carton.
Declare a module-scope object variable of type cEggCarton. Since we
want the object to persist throughout the life of the program,
instantiate the cEggCarton class in the object declaration using the
New keyword, e.g.,
Private mobjEggCarton As New cEggCarton
Private Sub Form1_Load(ByVal sender As ...
Remember to declare your object variable outside of a procedure.
So you will create a single instance of cEggCarton on startup to
contain ALL the information about the egg carton.
2. The check boxes represent the eggs. The program starts out with 12
eggs in the carton, so set this as the object state in class
cEggCarton's New() constructor method. The top row models eggs 1-6,
the bottom row models eggs 7-12. A check indicates an egg is present
(broken or not). Each time you uncheck or recheck, the total eggs
TextBox is updated.
3. When you click the Show Diagram button, the program displays a
message box with a two-line diagram showing a graphic (diagram, really)
of the egg carton, similar to the array of checkboxes. In class
cEggCarton, implement public, read only property .Get6By2Diagram, whose
data type is String. .Get6By2Diagram returns a single string
consisting of 6 characters, vbCrLf (as the 7th character), then 6 more
characters. The first 6 characters are eggs 1-6. The 2nd set of 6
characters are eggs 7-12.
a. For each character/position, the diagram will show:
i. "+" unbroken egg
ii. "0" no egg
b. At first, with 12 eggs:
c. After eggs 2, 3, and 11 are removed (unchecked):

4. On startup, VB my try to access your object before you have created
it. To avoid a run-time error, you will probably need to use the Is
Nothing Boolean condition. E.G., if MobjEggCarton is an object
(instance) of class cEggCarton, you could avoid this problem by coding

If MobjEggCarton Is Nothing Then
'object not instantiated, do nothing
'object has been created, proceed
MobjEggCarton.IsPresent(8) = chkEgg9.Checked
End If

5. BEFORE YOU START CODING: Read the grading chart carefully as it
lists the required properties and methods.
Use the grading chart below to verify you have included all elements
to receive full credit:
6. Grading chart. 15 points will be awarded as follows:
(you will not receive any credit if your program does not load, has
syntax errors, or will not run)
a. ˝ point(s)-Title bar includes assignment # and your name.
b. Code is properly commented and indented, broken down:
i. ˝ point(s)-Comment block at top of each module with title,
description, etc..
ii. ˝ point(s)-Comment block after every procedure header, except
for even handling procedures
iii. ˝ point(s)-Other comments throughout code
c. 1 point(s)-Form size, form shape, and all control
sizes/shapes/layout/captions match the screen captures / prototype
d. 1 point(s)-Class cEggCarton's New() constructor initializes egg
carton to state of 12 eggs;
e. 1 point(s)-Class cEggCarton has a private instance variable that
tracks the presence of each of the 12 eggs, e.g., a 12-element Boolean
f. 2 point(s)-Class cEggCarton has a Public Property .IsPresent that
returns or sets whether or not an egg is considered present. Data type
is Boolean. Note: Eggs can be taken out and put back.
g. 3 point(s)-Each time a check box value changes, the object state
is updated to reflect whether the selected egg is present or not, using
the object's .IsPresent() method.
h. 3 point(s)-Class cEggCarton has a Public Property .Get6By2Diagram
as described above.
i. 1 point(s)-Class cEggCarton has a Public method .EggCount() which
returns the number of eggs. Broken and unbroken eggs are counted.
Implement .EggCount() as a public function.
j. 1 point(s)-Each time a check box value changes, egg count display
is updated using the object's .EggCount() method.
k. Point(s) off for these items
i. Diagram does not correctly reflect missing eggs
ii. "Total eggs" TextBox does not correctly reflect the # eggs in

Nov 13 '05 #1
2 2575

Chad wrote:
I'm in an intro to VB.net class. I'm haveing trouble with this
assignment, if anyone could help me please let me know. thanks!

Wow, you really are lost. First, Access does not use VB.net.
Second, I don't think you'll learn much if *we* do your homework.
Isn't that why you have it? If you're really lost, ask your
instructor. That's what he's there for.

Nov 13 '05 #2
yeah no kidding.
maybe you should major in something
easier like "general studies".

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Paul Rubin | last post: by
10 posts views Thread by Andrew Koenig | last post: by
20 posts views Thread by TimeHorse | last post: by
6 posts views Thread by shapper | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.