Uploaded by btukxzlqqlgcirvwjc

CSVB1Y8 TL 101 0 2019-Updated

advertisement
CSVB1Y8/101/0/2019
Tutorial Letter 101/0/2019
Introduction to Visual Basic.Net
CSVB1Y8
Year module
UNISA Centre for Lifelong Learning (UCL)
This tutorial letter contains important information
about your module.
BARCODE
CSVB1Y8/101/0/2019
CONTENTS
Page
1
INTRODUCTION .......................................................................................................................... 3
2
PURPOSE AND OUTCOMES ...................................................................................................... 3
3
LECTURER(S) AND CONTACT DETAILS................................................................................... 3
3.1
Lecturer(s) .................................................................................................................................... 3
3.2
UNISA Centre for Lifelong Learning (UCL) ................................................................................... 4
3.3
University ...................................................................................................................................... 4
4
RESOURCES ............................................................................................................................... 4
4.1
Prescribed book(s) ........................................................................................................................ 4
4.2
Recommended book(s) ................................................................................................................. 5
4.3
Electronic reserves (e-reserves) ................................................................................................... 5
4.4
Library services and resources ..................................................................................................... 5
5
STUDENT SUPPORT SERVICES ................................................................................................ 5
6
STUDY PLAN ............................................................................................................................... 5
6.1
Abbreviated Syllabus .................................................................................................................... 5
6.2
Detailed Syllabus .......................................................................................................................... 5
7
PRACTICAL WORK ..................................................................................................................... 6
8
ASSESSMENT ............................................................................................................................. 6
8.1
Assessment plan .......................................................................................................................... 6
8.2
Assignment numbers .................................................................................................................... 7
8.2.1
General assignment numbers ....................................................................................................... 7
8.2.2
Unique assignment numbers ........................................................................................................ 7
8.3
Assignment due dates .................................................................................................................. 7
8.4
Submission of assignments .......................................................................................................... 7
8.5
The assignments .......................................................................................................................... 8
Assignment 1: Multiple Choice Questions (MCQ) ............................................................................ 8
Unique Number: 766557 ......................................................................................................................... 8
Assignment 2: Written/Typed .......................................................................................................... 15
Unique Number: 629003 ....................................................................................................................... 15
Unique Number: 783951 ....................................................................................................................... 18
8.6
The examination ......................................................................................................................... 20
2
CSVB1Y8/101/0/2019
1
INTRODUCTION
Dear CSVB1Y8 Student
Welcome to this exiting programming module, in which you will study the basic principles and
concepts of Visual Basic.NET. This module is offered by the Centre for Software Engineering
(CENSE) within the Department of Computer Science and Information Systems at the University of
South Africa.
Visual Basic .NET is an event-driven programming language that is widely used in business applications.
It provides a sophisticated development environment for writing Windows-based programs. Since it is
relatively easy to use, Visual Basic .NET will soon give you a sense of achievement and motivation from
writing professional-looking programs. We really hope that you will enjoy the course.
We assume that all students have experience in using the Windows Operating system. In other words,
you must be able to type on the keyboard, work with a mouse, know what a menu, a file and a folder is,
and so on. Regular access to a computer and the Visual Basic.NET software is essential (you may not
use any earlier version of Visual Basic). Access to the Internet is recommended. The software is
provided free of charge with your study package.
2
PURPOSE AND OUTCOMES
We assume that all students have experience in using the Windows Operating system. In other words,
you must be able to type on the keyboard, work with a mouse, know what a menu, a file and a folder is,
and so on. Regular access to a computer and the Visual Basic.NET software is essential (you may not
use any earlier version of Visual Basic). Access to the Internet is recommended. The software is
provided free of charge
3
LECTURER(S) AND CONTACT DETAILS
3.1
Lecturer(s)
If you have a request about the content of this module, use the following details to contact the lecturer:
Name
Telephone number
Email address
Dr C Dongmo
011-471-2247
dongmc@unisa.ac.za

send an email message to dongmc@unisa.ac.za, or

write to us at the address below:
The Lecturer (CSVB1DG)
School of Computing
PO Box 392
UNISA
0003
Hence, all queries that are not of an administrative nature but are about the content of this module
should be directed to us. Please have your study material with you when you contact us.
3
CSVB1Y8/101/0/2019
3.2
UNISA Centre for Lifelong Learning (UCL)
If you need to contact the Unisa Center for Lifelong Learning about matters not related to the content of
this module, i.e. administrative matters, please use the following phone number:
+27 11 670 9131, Fax: 27 11 670 9274.
If you have queries regarding your registration (such as queries about payment or your student
number), change of your address, etc. please contact the chief administrator of the programmes at
(011) 670-9131 or send an e-mail to masalpd@unisa.ac.za.
3.3
University
If you need to contact the University about any other matters not related to the content of this
module, please use one of the following options:

For students residing in SA, send an sms to
32695

For all students, send an email request to
info@unisa.ac.za.
4
RESOURCES
4.1
Prescribed book(s)
The study material for this course consists of tutorial letters, a textbook, and the software. The details
are:
 Tutorial letter 101 (this tutorial letter) contains important information about the course as well as
all the assignments that you have to complete.
 The text book is:
Programming in Visual Basic 2010, by Julia Case Bradley and Anita C Millspaugh, 2010
International Student Edition, ISBN 978-0-07-131421-3.
You will receive the book as part of your study package.
 You will, progressively, receive tutorial letters containing the solutions to all the assignments
when they become ready.
 A copy of Microsoft Visual Basic .NET 2008 Express Edition, on 1 CD-ROM, is also part of your
study package. If you do not already have Visual Basic .NET installed on your computer, you
therefore have the option of using the Visual Basic .NET 2008 Express Edition.
In this course you will only learn how to program in Visual Basic .NET. To learn Visual C++, Visual
C# or any of the other languages included in the Visual Studio package you will have to do separate
courses.
Note:
Some of the above mentioned tutorial matter may not be available when you register. Tutorial matter that
is not available when you register will be posted to you as soon as possible, but is also available on the
myUnisa website.
4
CSVB1Y8/101/0/2019
4.2
Recommended book(s)
There is no recommended book for this module. However, a student is welcome to use any
recent book on Visual Basic.Net that may help him to increase his/her understanding, and
practice of the lessons learned from the prescribed textbook.
4.3
Electronic reserves (e-reserves)
Electronic copies of tutorial letters will also be available on the myUnisa website. You must have
access to the Internet to access this site – it is a requirement to study at the School of
Computing. You will therefore be able to download material from myUnisa. Hence, if the paper
copies of study material are (for whatever reason) not available in time, you are expected to
download these from myUnisa. Study material on this server may be uploaded from time to
time; hence you need to check myUnisa at least once a week.
4.4
Library services and resources
To access the myUnisa website, do the following:
1. Go to http://www.unisa.ac.za
2. Click on Join myUnisa or Login to myUnisa.
3. Thereafter follow the instructions on the screen.
You will receive a password for future use.
5
STUDENT SUPPORT SERVICES
The Study @ Unisa brochure is available on myUnisa: www.unisa.ac.za/brochures/studies
This brochure has all the tips and information you need to succeed at distance learning and,
specifically, at Unisa.
6
STUDY PLAN
Below is an abbreviated syllabus for this module:
6.1
Abbreviated Syllabus
The abbreviated syllabus for this module includes:
User interface design, Data Types, Variables and constants, Decisions, Menus, Functions/procedures,
Lists and Loops, printing, Arrays, Databases and files, and Object-Oriented Programming.
6.2
Detailed Syllabus
Chapter 1: An introduction to VB .NET
Chapter 2: User interface design with more
Controls
Chapter 3: Variables, Constants and
Calculations
Chapter 4: Decisions and Conditions
This chapter explains how to get started on Visual
Studio .NET. Study completely.
This chapter introduces more VB .NET controls and
discusses good user interface design. Study
completely.
Study completely.
Study completely.
5
CSVB1Y8/101/0/2019
Chapter 5: Menus, Sub procedures and
Functions
Chapter 6: Using multiple forms
Chapter 7: Lists, Loops and Printing
Chapter 8: Arrays
Chapter 9: Programming with Web Forms
Chapter 10: Accessing Database Files
Chapter 11: Saving Data and Objects in
Files
Chapter 12: OOP - Creating Object-Oriented
Programs
Chapter 13: Graphics, Animation, Sound and
Drag-and-Drop
7
Study completely.
Study completely.
Study completely.
Study completely.
Self-study. Not for examination purposes.
Study completely.
Study completely.
Study completely.
Self-study.
PRACTICAL WORK
Assignments are designed to enable students to apply programming principles to reasonable
size case studies to produce pieces of software programs.
8
ASSESSMENT
8.1
Assessment plan
CSVB1Y8 uses a year-mark system. This means that the mark (percentage) you get for the
work you do during the year counts as part of your final mark for this module. Every assignment
has a mark as well as a weight allocated to it. The weight for Assignment 01 is 0.3 (i.e. 30% of
your year mark), the weight for Assignment 02 is 0.7 (70%), and the weight of assignment 03 is
0.7 (70%).
Your year mark (YM) is calculated as follows:
YM = (0.3 * Ass01) + (0.7 * Ass0x), where
Ass01 = Percentage obtained for Assignment 01
Ass0x = Higher percentage obtained for Assignment 02 and Assignment 03
Ass03 = Percentage obtained for Assignment 03
Your year mark counts 20% towards your final mark and the examination mark makes up the
other 80%.
The Marking of Assignments
Please note the following:
(1) You must answer all the questions for an assignment. It is possible that not all questions will be marked. We
will make the decision beforehand as to which questions will be marked and students will not be informed of
the decision. The same questions will be marked throughout and only those questions marked will contribute to
the percentage you obtain for the particular assignment.
(2) Please pay attention to the important message as set out by the Department of Education on the front page
of this tutorial letter. If you fail to comply with these regulations you will not be allowed to write the CSVB1Y8
6
CSVB1Y8/101/0/2019
exam.
(3) Please ensure that you capture the correct assignment number for each assignment. Failure to comply with
this requirement may cause a considerable delay in the marking of your assignment. Each subsequent page
should contain at least the following information:
i.
Student number
ii.
Module code
iii.
Assignment number: general number (1, 2 or 3) and unique number.
8.2
Assignment numbers
8.2.1
General assignment numbers
There are three assignments, numbered 1, 2 and 3. Each assignment must be submitted by its
due date. Late assignments will be accepted under exceptional circumstances only. Solutions to
each assignment will be distributed after the due date.
8.2.2
8.3
8.4
Unique assignment numbers
Assignments
Unique Assignment number
1
766557
2
629003
3
783951
Assignment due dates
Assignment
Number
CHAPTERS
DUE DATES
1
Chapters 1,2 , 3 and 4
24/04/2019
2
Chapters 4, 5, 6 and 7
24/07/2019
3
Chapters 8, 10, 11 and 12
10/09/2019
Submission of assignments
You are strongly advised to submit your assignment electronically via myUnisa. Please submit by post
only if you don’t have the facilities to do so electronically; in such case, make a copy of the assignment
and keep in a safe place and be ready to re-submit , for example, in case of lost or damage.
Assignments may not be submitted by fax or e-mail. If you submit your assignment through myUnisa
then try to use PDF. Word documents will be accepted for electronic submission, however, we strongly
advise you to use word format only in case you cannot convert your document into a pdf file. The
marking tool only accepts pdf files and thus, the lecturer/marker will have to convert your document into
pdf.
To submit an assignment via myUnisa:
7
CSVB1Y8/101/0/2019
 Go to myUnisa: http://www.unisa.ac.za
 Log in with your student number and password.
 Select the module.
 Click on assignments on the left-hand menu.
 Click on the assignment number you want to submit.
Follow the instructions on the screen.
Any queries you have about this (for example, whether your assignment was received, or whether it has
been mailed back to you) must be directed to Unisa’s assignment department.
You can also track your assignment through MyUnisa.
8.5
The assignments
Assignment 1: Multiple Choice Questions (MCQ)
Unique Number: 766557
Due Date:
24 April 2019
Submission Procedure:
Multiple Choice Questions (MCQ)
Important: You will submit this as a written
assignment on myUnisa)
Chapters :
Chapters 1, 2, 3 and 4
Total for this Assignment: 30 marks
Compulsory:
1.1
An inspection, without any semantic analysis, of a program shows that the
instructions of the program are written in some specific order, determined by
the logic of the program. This is likely ______________ type of programs.
1. a Visual Basic.net
2. a C#
3. a Java
4. a Pascal
1.2
Object-oriented programming approach is centered on the concept of object.
However, one of its main advantages stems from the ability to group within a
class, the operations and characteristics of objects defined by the class. This
concept is known as _______________.
1. property
2. polymorphism
3. encapsulation
4. method
8
CSVB1Y8/101/0/2019
1.3
The visual basic programming environment provides for various tools to
design forms, write code, run and debug programs, etc. Such an environment
is known as ___________ environment / window.
1. a main window
2. an IDE
3. a Microsoft Visual Studio
4. a .Net Framework
1.4
During the execution of a visual basic program, when an error occurs and the
program halts, in what mode is the system and what is the status of the ide
window?
1. The system is in run time, and the IDE window title bar indicates running.
2. The system is in debugging time, and the IDE window title bar indicates running.
3. The system is in design time, and the IDE window title bar indicates designing.
4. The system is in debug time, and the IDE window title bar indicates debugging.
1.5
A program code may include various types of statements such as an
assignment, a remark, executing a method, and changing a property. It is
relatively easy to distinguish them because for example, _____________.
1. a method statement always has parentheses, contrary to properties
2. a remark is the only statement that is not allowed to have the equal sign
3. an assignment statement always has an equal sign and the others not
4. the value of a property in a statement is always enclosed in quotation marks
1.6
At design time, when the form designer is opened, a programmer wants to add
a button to a form and none of the opened windows seems to be helpful; In that
case, this is the most appropriate way to go.
1. Open the Solution Explorer Window, if it is not yet opened, and look for the
appropriate class module from which a button can be instantiated.
2. Look for the toolbox icon on the opened toolbar(s), open the toolbox and select
the button to be added to the form.
3. Open the help window to search for a link to the class of buttons from which the
button object is to be instantiated.
4. Open the properties window and specify the properties of the object to be created
so that VB.Net will know how to create the button according to its properties.
9
CSVB1Y8/101/0/2019
1.7
Visual Basic is one of the easy to use modern programming languages
however, during the design and coding phases, there is still certain difficulties
to be overcome by the programmer. Which of the following more likely reflects
such difficulties?
1. It is hard for a programmer to create a form, place the objects required on it, and
set their properties. Especially when it comes to arranging those objects on the
form and centering the form on the screen.
2. Since there are so many objects, with different characteristics and methods, to
work with, it is difficult for a programmer to known them all and use them
appropriately.
3. The logic of the programme remains the responsibility of the programmer who
must write the code, make sure the program runs correctly, and does exactly what
it is intended to do.
4. It remains the responsibility of a Visual Basic programmer to structure the entire
program, and integrate different type of statements into it, so that operations are
sequentially and appropriately executed.
1.8
To make your project easier to read, understand, and to debug, it is required to
apply Visual Basic naming rules. It is also recommended to follow appropriate
naming conventions; these are examples of naming rules.
1. An object name begins with a letter or an underscore, cannot include a space or
punctuation mark, and do not use an abbreviation.
2. An object name cannot be a reserve word but can contain one, can contain
letters, digits, underscores, but should not be only numbers, and must be
meaningful.
3. An object name may be formed with more than one word however, each of the
words must be capitalised and meaningful, as well as, the full name itself.
4. An object name must not begin with a number, cannot be a reserved word, but is
allowed to include one, as well as, letters, digits, and underscores.
Consider the following piece of a VB code:
Private Sub ExitButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ExitButton.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End
End Sub
10
CSVB1Y8/101/0/2019
1.9
An analysis of the structure of this code shows that ______________.
1. this code is a sub procedure to handle a click event on a button, including one
remark, one assignment and one method calling statements
2. this code is a sub procedure to handle a click event on a button named ExitButton.
It includes one assignment, and two methods statements
3. this code is an event procedure that includes one assignment statement, one
method statement, and one special statement indicated by a reserved word
4. this code is a visual basic sub-routine to display a print preview window. it includes
one assignment statement, one method statement, and one special instruction
1.10
A deeper analysis of the above piece of code indicates that ______________.
1. this code is definitely part of a project that has a form with one button named
ExitButton, and one print form component. It intends to display the form on a print
preview window. The code does not have any syntax, runtime or logic errors
2. this code might be part of a project that has a form with two button objects named,
ExitButton, and PrintForm1. The code has not detectable error and is intended to
display the form in a print preview window.
3. this code is indeed a procedure to handle the click event on the button ExitButton.
it aims to display a form on a print preview window however, to be syntactically
correct, the last statement should end with parentheses
4. although Pascal naming convention was used, the object PrintForm1 could be any
other object than a print form component, for example, a form or a button.
Therefore, the program may have a logic error, since it would run without bugs,
but generate a wrong output.
1.11
In a windows program, the user interface plays a vital role since it provides for
the only means to interact with the program. E.g. a program is as easy to use
as the user interface is clear and consistent. These are some criteria and ways
to rely on when designing your user interface.
1. Make controls operate in the standard way, follow industry standards for the color,
size, and placement of controls, and leave the default tab order as keyboard users
generally like to use the mouse to validate their activities.
2. Group controls on the form to aid the user, make controls operate in the standard
way and follow industry standards for the color, size, and placement of controls.
Adding tooltips may also contribute to make the interface easy to understand.
3. You should design your application to match other Windows applications, and
ensure that the program is easy to use. Create Group boxes to hold related items,
use a sans serif font and make them boldface.
4. Take advantage of Microsoft research and follow their guidelines, take time to
examine the screens and dialog boxes in Microsoft office, as well as those in
visual studio, define keyboard access keys, and call the accept button method to
set the accept button.
11
CSVB1Y8/101/0/2019
1.12
It is common practice in visual basic to join strings, e.g. concatenating a literal
and the value of a string variable or a text property. To achieve this, the
following operator called ampersand is used:
1. &
2. @
3. $
4. #
1.13
It is important for a programmer to be able to choose amongst similar controls,
the most appropriate one. The following statement illustrates the use of labels,
text boxes and rich text boxes.
1. The text box and rich text box controls are the same, they are both used for single and
multiple lines input, as well as static and modifiable outputs. The only difference is with
labels that can only be used to output non-modifiable information.
2. Rich text box controls are not needed, since text boxes and labels can be used to address
all the input/output problems. Labels are used for static outputs, and text boxes for single
and multiple lines inputs and modifiable outputs that may require little formatting from a
user.
3. Labels are normally not necessary, since a text box control can be used to display static
and modifiable outputs, in single or multiple lines. And the rich text box is adequate for
input/outputs with multiple lines that require basic formatting from the user.
4. Labels are lightweight controls appropriate for static outputs, text boxes are more
convenient for inputs and modifiable outputs with little or no formatting, and rich text
boxes are desirable for multiple lines input/output requiring some basic formatting from a
user.
Consider the following scenario:
A researcher wants to do a survey, (s)he draws a couple of questions that must be answered by the
respondents. For each question, a respondent must select only one of about five proposed options.
1.14
For the design of the user interface, these controls are chosen to assist the
researcher with the survey.
1. Label controls to display the questions, check boxes, in a group box, for options, and one
or two buttons to validate and terminate the survey.
2. Text boxes to display the questions, ratio buttons for options, and push buttons to confirm
the respondent choices and terminate the survey.
3. Labels to display the questions, push buttons to validate and terminate the survey, and
ratio buttons, in a group box, for options.
4. Text boxes for respondent comments, labels to describe each question, check boxes, in a
group box, for the proposed options, and push buttons to validate and terminate the
survey.
12
CSVB1Y8/101/0/2019
Suppose in your company at HR, a certain formula is regularly and repeatedly used to calculate salaries
based on a constant rate, the number of hours worked, and a coefficient that depend on the grade of the
worker. The hours worked is NORMALLY A whole positive number, that is always less than 200, and the
grade coefficient is a positive number less than 150 with two decimal places. You are requested to write a
Visual Basic program for HR that may use only as much computer memory as it is really needed. Suppose
the option Explicit is activated for the entire project and the following piece of code is in the project:
Const PAY_RATE_DOUBLE As Double = 0.50
Public Function CalculateSalary (ByVal HrsWorkedInteger As
Integer, ByVal GradeCoefDouble As Double) As Double
Dim $YourSalarySingle As Single
Return (PAY_RATE_DOUBLE + HrsWorkedInteger * GradeCoefDouble
_
/PAY_RATE_DOUBLE
–
0.30)
End Function
$YourSalarySingle = CalculateSalary(50, 20.00)
1.15
An analysis of the naming approach in this code indicates that Pascal naming
convention was followed, and that ___________ .
1. the naming rules are respected, but not the naming convention. This is because the first
part of the second argument of the function, Hrs. is too short despite the fact that its
meaning is commonly known to be Hours
2. the naming convention is respected but not the naming rules. This is because the variable
$YourSalaryDouble begins with a special character which is not authorised
3. the naming rules and naming conventions are both respected. The name
HrsWorkedInteger is conventionally correct; each part is meaningful and well capitalised.
4. none of the naming rules and convention is respected. Because the name
HrsWorkedInteger is not conventionally correct and $YourSalaryDouble does not respect
the naming rules.
Optional:
1.16
An analysis of the structure of this program indicates that ___________ .
1. the declaration of the constant and variable are syntactically correct, the declaration of the
function procedure is also correct, but the statement to return the function value is not
syntactically correct because the explicit line continuation character is not at the correct
position.
2. the first two lines of the function declaration do not make sense because each of them
forms an incomplete statement that may not be well interpreted by visual basic. The
assignment statement outside the function is however, syntactically correct.
3. the first two lines of the function are correct because an implicit line continuation is
appropriately used, and the last instruction is also syntactically correct because the
variable $YourSalarySingle is appropriately declared (within the function)
4. the variable and constant declarations are correct, the function declaration and the
statement within the function are also syntactically correct. But according to VB, the
variable $YourSalarySingle is not declared and is not syntactically correct.
13
CSVB1Y8/101/0/2019
1.17
An analysis of the data types used in the program, focusing on the constant
variable, the arguments of the function, the value returned by the function and
the variable $YourSalarySingle, shows that ______ byte(s) of the memory
space is required to store them.
1. 36
2. 32
3. 28
4. 24
1.18
Based on our knowledge of the format of a salary (currencies), and according
to the project specification, the data types in this program can be adjusted to
reduce the quantity of memory storage required. This is the most appropriate
suggestion to optimise the memory usage.
1. Change the type of the constant variable to single, the returned value to single, the first
argument of the function to short, and the second argument to single. Therefore, bringing
the overall required memory size to 18 bytes.
2. Change the type of the constant variable to single, the returned value to single, leave the
first argument of the function to single, and change the second argument to single.
Therefore, bringing the overall required memory size to 22 bytes.
3. Leave the data type of the function unchanged, and change the type of the first argument
to short, the second argument to Single, the constant variable to Short and the variable
$YourSalarySingle to Double. This brings the overall required memory size to 24 bytes.
4. Leave the constant variable unchanged, change the type of the function to Single, the
first argument to short, the second argument to Single, and the variable
$YourSalarySingle to Double. This brings the overall required memory size to 26 bytes.
1.19
These errors are found in the above piece of code.
1. One syntax error, the use of $ in the variable $YourSalarySingle breaks the VB naming
rule; and one logic error due to the loss of precision during the implicit conversion from
double to single in the last assignment statement.
2. One syntax error in the variable name $YourSalarySingle; one logic error, VB may
generate wrong results due to the fact that parentheses are not used to indicate the order
of the calculations.
3. A runtime error from the last assignment statement, due to the incompatibility between
Single and Double; and one syntax error due to the illegal use of the $ character in
$YourSalarySingle.
4. One syntax error in the name $YourSalarySingle, one logic error due to the missing
parentheses in the formula to calculate the salary and a runtime error due to the attempt
to assign a data of type double to a variable of type Single.
14
CSVB1Y8/101/0/2019
1.20
A call of the above function with the arguments 50 and 20.00 that is,
CalculateSalary (50, 20.00).ToString(“c”), would return ___________ .
1. $2,000.20
2. $2,019.70
3. $5,000.50
4. $5,050.00
Assignment 2: Written/Typed
Unique Number: 629003
Due Date:
24 July 2019
Submission Procedure:
Written/Typed
Chapters:
Chapter 4 to 7
Total for this Assignment: 70 marks
Question 1 (Chapter 4)
Consider the programming exercise 4.6 from the prescribed textbook, page 203.
(Select Case) Piecework workers are paid by the piece. Workers who produce a greater quantity of output
are often paid at a higher rate.
Form: Use text boxes to obtain the person’s name and the number of pieces completed. Include a
Calculate button to display the dollar amount earned. You will need a summary button to display the total
number of pieces, the total pay, and the average pay per person. A Clear button should clear the name
and the number of pieces for the current employee and a Clear All button should clear the summary totals
after confirming the operation with the user.
Include validation to check for missing data. If the user clicks on the Calculate button without first
entering a name and the number of pieces, display a message box. Also, you need to make sure to not
display a summary before any data are entered; you cannot calculate an average when no items have
been calculated. You can check the number of employees in the summary event procedure or disable the
Summary button until the first order has been calculated.
Pieces Completed
Price Paid per Piece for All Pieces
1-99
200-399
400-599
600 or more
.50
.55
.60
.65
15
CSVB1Y8/101/0/2019
1.1
Sketch a user form to be used for this program.
1.2
Plan the objects and properties for the program.
1.3
Plan the Event procedures for this program. Clearly indicate actions-pseudocodes to calculate the
salary and the average rating.
1.4
Write the program and make sure that your program is running correctly.
Submit solution for 1.1, 1.2 and 1.3.
Question 2 (Chapter 5)
Consider the programming exercise 5.4 from the prescribed textbook, page 246.
The local library has a summer reading program to encourage reading. The staff keeps a chart
with readers’ names and bonus points earned. Create a project using a menu and a function
procedure that determines and returns the bonus points.
Menu:
See textbook
Form: Use text boxes to obtain the reader’s name and the number of books read. Use a
ReadOnly text box or a label to display the number of bonus points.
The points menu item should call a function procedure to calculate the points using this
schedule: The first three books are worth 10 points each. The next three books are worth 15
points each. All books over six are worth 20 points each.
The summary menu item displays the average number of books read for all readers that
session.
The clear menu item clears the name, the number of books read, and the bonus points and then
resets the focus.
The Color and Font menu items change the color and font of the bonus points.
Use a message box to display the program name and your name as programmer for the About
option on the Help menu.
Name
Sandy Smug
Sam Sadness
Joe Whiz
Sales
1,000.00
999.99
2, 000.00
2.1 Sketch a user form to be used for this program.
16
CSVB1Y8/101/0/2019
2.2 Plan the objects and properties for the program.
2.3 Plan the Event procedures for this program. Clearly indicate actions-pseudocode to calculate bonus
points
2.4 Write the complete program and make sure that it is running correctly.
Submit the actions-pseudocode in 2.3 and the Visual Basic.Net program code from 2.4. For a clear
presentation, add the user interface followed by the code attached to it.
Question 3
(Chapter 6)
Consider the programming exercise 6.3 from the textbook, page 280 (Extension of 6.2 on pages 279 & 280).
Modify Programming Exercise 6.2 so that summary information is maintained for the total dollar amount
for parts, labor, sales tax, and total for all customers.
Add a Summary menu item under the Process menu with a separator bar between the two menu items.
When the user selects the Summary menu item, display the summary information in a Summary form. The
Summary form should have an OK button that closes the Summary form and returns the user to the main
form.
Programming exercise 6.2 from textbook, pages 279 and 280:
Create a project that will produce a summary of the amounts due for Pat’s Auto Repair Shop. Display a
splash screen first; then display the main form, which has only the menus. If you wish, you can add a
graphic to the form.
Job Information
The Job Information menu item will display the Job Information form.
Job Information Form. The Job Information form must have text boxes for the user to enter the job
number, customer name, amount charged for parts, and the hours of labor. Include labels and text boxes
for Parts, Labor, Subtotal, Sales Tax, and Total.
Include buttons for Calculate, Clear, and OK.
The Calculate button finds the charges and displays them in controls. The tax rate and the hourly labor
charge should be set up as named constants so that they can be easily modified if either changes. Current
charges are $50 per hour for labor and 8 percent (.08) for the sales tax rate. Sales tax is charged only on
parts, not on labor.
The Clear button clears the text boxes and resets the focus in the first text box.
The OK button closes the Job Information form and displays the main form.
Follow the tree-step process for planning and programming of Visual Basic projects to develop a software
program for the programming exercise 6.3 and submit the code. The document submitted must include all
user forms and code presented as follows for each form:
- Include each user form
- Add one or two, clear and succinct sentences, to explain the purpose of the form, then
- Add the code associated to the form.
Question 4 (Chapter 7)
17
CSVB1Y8/101/0/2019
Consider the programming exercise 7.5 from the prescribed textbook, page 322.
Maintain a list of bagel types for Bradley’s Bagels. Use a drop-down combo box to hold the bagel types
and use buttons or menu choices to Add Bagel Type, Remove Bagel Type, Clear Bagel List, Print Bagel
List, Display Bagel Type Count, and Exit. Keep the list sorted in alphabetical order.
Do not allow a blank type to be added to the list. Display an error message if the user attempts to add a
bagel type that is already in the list or if the user selects Remove without first selecting a bagel type.
Before clearing the list, display a message box to confirm the operation. Here are some suggested bagel
types. You can make up your own list.
Plain
Egg
Rye
Salt
4.1
4.2
Poppy seed
Sesame seed
Banana nut
Blueberry
Sketch a well-designed user form to be used for this program.
Write the code for this program and ensure that it is running correctly.
Submit both the user interface and the code.
Assignment 3: Written/Typed
Unique Number: 783951
Due Date:
10 September 2019
Submission Procedure:
Written / typed
Chapters:
Chapter 8, and 10 to 12
Total for this Assignment: 70 marks
Question 1 (Chapter 8 and 10)
1.1
Consider the programming exercise 8.1 from the textbook, page 355.
Create a project in which the user will complete a 10-Question survey. Create a form containing labels
with each of the questions and a group of radio buttons for each question with the following responses:
Always, Usually, Sometimes, Seldom, and Never. Use a two-dimensional array to accumulate the number
of each response for each question. Have a menu or button option that will print an item analysis on the
printer that shows the question number and the count for each response.
Poverty Guidelines for 2008:
Family size
Income
18
CSVB1Y8/101/0/2019
1
2
3
4
5
6
7
8
For each additional person add
10210
13690
17170
20650
24130
27610
31090
34570
3480
1.1.1
Sketch a well-designed user form to be used for this program.
1.1.2
Plan the objects and properties for the program.
1.1.3 Plan the Event procedures for this program. Clearly indicate actions-pseudocode to
calculate the accumulated number of each response for each question.
1.1.4
1.2
Write the complete Visual Basic.Net program for this question, and submit the code.
Considère Question 10.1 in chapter 10 page 433.
The Rnrbooks.mdb database file holds two tables: the Books table used in this chapter and the Subjects
table. The Subjects table has only two fields: the Subject Code (the key) and the Subject Name. Write a
project that displays the Subjects table in a grid. Hint: For a Web application, use a DataList control for
the grid.
Follow the steps as indicated in chapter 10 to do question 10.1 above and submit the user form and the
code.
Question 2
Consider the programming exercise 11.5 from the textbook on page 465.
Create a project that stores personal information for a little electronic “black book.” The fields in the file
should include name, phone number, pager number, cell phone number, voice mail number, and e-mail
address. Allow the user to enter the data into text boxes. Create a second project to load the names into a
list box. Perform a “Look up” and display the appropriate information for the selected name.
Note: Unless you include an Open File dialog, copy the file created in the bin\Debug folder for the first
folder into the bin\Debug folder for the second folder. [Not optional] you should allow the user to select
the file to open using the Open File dialog box.
Follow all the steps in the three-step, for the design and programming process for Visual Basic.Net
program, to do the programming exercise 11.5 and submit for each form:
- The form itself must be included in your assignment
- Indicate clearly and succinctly the purpose of the user interface, and
- Add the code associated to the form.
19
CSVB1Y8/101/0/2019
Question 3
Consider the programming exercise 12.11 from the prescribed textbook, on page 521.
Create a project that contains a Pet class. Each object will contain pet name, animal type, breed, and
color. The form should contain text boxes to enter the information for the pets. A button or menu item
should display the pet information on a separate form. Hint: Use a ReadOnly property on the input form
to pass the object to the second form.
Follow all the steps in the three-step, for the design and programming process for Visual Basic.Net
program, to do the programming exercise 12.11.
Submit for each form:
- The user interface (the form itself), followed by
- Indicate clearly and succinctly the purpose of the form,
- The code associated to the form.
8.6
The examination
This will be partial open book exam. That means, you will be allowed to use the prescribed textbook. A
part from the textbook, no other materials will be tolerated.
Important note:
By experience, we know that, having your textbook with you during the exam can only help if you have
studied hard throughout the year.
Please don’t just rely on the textbook, it won’t help you if you are not well prepared for the exam.
©
UNISA 2018
20
Download