If there is one prayer that you should pray/sing every day and every hour, it is the
LORD's prayer (Our FATHER in Heaven prayer)
- Samuel Dominic Chukwuemeka
It is the most powerful prayer.
A pure heart, a clean mind, and a clear conscience is necessary for it.
For in GOD we live, and move, and have our being.
- Acts 17:28
The Joy of a Teacher is the Success of his Students.
- Samuel Dominic Chukwuemeka
I greet you this day,
For My Students, please do the following:
First: Download and install the Visual Studio IDE
Second: Review the required readings for each module including the Student-Teacher scenarios.
Third: Review the recommended readings for each module.
Fourth: Review the recommended videos and textbooks for each module.
Fifth: Complete the DB (Discussion Board) assignments for each module.
Sixth: Start thinking about your midterm project, final project, and final exam.
Seventh: Review the midterm exam and final exam study guides.
Eighth: Should you have any questions, comments, concerns, areas of improvement, and constructive criticisms;
please attend the weekly Office Hours/Live Sessions and/or contact me via the school's email system.
Ninth: If you are majoring in any IT (Information Technology) field
(especially for women and minorities),
you may want to check the Financial Aid section in any of my websites:
Scholarships or
Scholarships
For My Students and Visitors:
Comments, ideas, areas of improvement, questions, and constructive criticisms are welcome.
For All Those who Seek Peace:
Thank you for visiting.
Samuel Dominic Chukwuemeka (SamDom For Peace) B.Eng., A.A.T, M.Ed., M.S
(1.) Please review the
Rules of Netiquette
(2.) Please be creative.
Please paraphrase in your words as applicable.
(3.) No two posts should discuss the same thing.
Each post should be unique.
This implies that you should review any previous posts before you submit your own post.
(4.) The initial post is due on Thursday of the week for which it is required.
(5.) At least one response to the initial post is due on Saturday of the week for which it is required.
(6.) Only one thread per student is allowed.
Please do not create more than one thread.
Please respond to my comments (as applicable) in the same initial thread.
Please make any repost in the same initial thread.
Besides the Introduction DB (where I am required to welcome each student); usually, I make comments to some posts and some
responses submitted by Thursday of the week that a DB assignment is due.
If I make any comment to your initial post and/or response (submitted by Thursday); then it is very important you address any
concern in my comments.
If you do not understand my comments, please attend the Office Hours/Live Sessions and/or send an email to me and ask for
clarification.
I do not go back-and-forth (responding more than one time) to a student in DB forums.
The essence of DB forums is mainly for student communication and collaboration.
The professor only facilitates and makes few comments as necessary.
Typically, if I make any comment to your post and/or response for any DB assignment besides the Introduction DB,
it means that you need to fix some issues.
It is important you fix those issues to avoid deduction of points.
(7.) You may not do any of the same examples that I did for either a DB post or DB response.
(8.) You may do any of the questions in the Discuss tab as
a substantive post and/or substantive response.
(9.) You may make up your own substantive post and/or substantive response
if it is actually substantive.
However, in this case; it is very important you ask me for prior approval.
You may ask me during the Office Hours/Live Sessions and/or via the school's email.
(10.) You may solve the problems in the Assess tab as a DB assessment (post and response).
Questions in the Assess tab count for both DB post and DB response.
Each question in the Assess tab is to be uniquely done by only one student.
This means that it can be done by more than one student.
However, each post must be unique.
Further: For any Textbook Question:
(a.) Please submit a clear screenshot of the Question Number and the Question.
(b.) Any question from the textbook in the Assess tab should be done by only one student.
(11.) Sources must be cited accordingly.
You may use: APA (American Psychological Association) style, MLA (Modern Language Association) style, or the
Chicago Manual of Style.
(12.) Please submit clear screenshots.
For all applicable DB posts and responses, please use the Snipping Tool or the Snip & Sketch
on your computer to take clear screenshots and trim off excess space/irrelevant information from your program code
and output.
Then, use the Insert/Edit Image icon on the Blackboard editor to insert the screenshots of your code
and the output.
This is because your colleagues and I should be able to see your code and the output clearly.
Line numbers and all necessary details including the file names are also required.
You may need to increase the font size of your IDE so it is very clear.
You may need to take the screenshots of only the relevant window (the code window).
You may need to take several screenshots.
Also, please ensure you use a clear format for your writings.
Avoid any background colors in the Blackboard Editor.
(13.) Please do not submit an attachment for any DB assignment.
If you do, it will not be clicked. It will not be read. It will not be graded.
Your colleagues and I should be able to see your work directly without opening any attachment.
Any response to such post will not be counted.
Hence clear screenshots are required.
(14.) For all DB responses, please mention the first name of your colleague.
(15.) Provide a substantive response to your colleague.
A substantive response is the response that provides constructive criticism,
alternative approach that gives the same correct output, additional helpful information that will improve the post,
and the correction of any incorrect step and/or output among others.
How would you improve the initial post?
Did you find any errors in the initial post? If you do, please correct the error. Teach your colleague about the error, and
explain to him/her how to fix it. Provide screenshots as applicable.
What new knowledge can your colleague acquire from you based on your response?
Can you solve the initial post using an alternative approach that will give the same correct output?
What real-world examples/applications can you provide based on the initial post? Cite your sources accordingly.
Did your colleague learn anything meaningful from you based on your response to the initial post?
Please focus on the initial post. Do not deviate from the concept/topic in the initial post.
Do not bring up your own unrelated topic/concept.
Teach/Show your colleague something new and meaningful based on the initial post.
Write code examples as applicable, run them, and explain to your colleague.
Substantive responses should include screenshots as applicable.
(16.) Please use at least a size of 14 pt in your writings on the Blackboard Editor, and an acceptable
large font size on all your programs (IDE and output console among others).
(17.) Please proof-read your writings for mechanical accuracy errors.
Any use of "i" attracts deduction of points.
Multiple mechanical accuracy errors will lead to deduction of points.
I understand that this is not an English class. However, you are expected to write well.
(18.) Please make sure that you write comments for any program you submit.
Rule of Thumb for Comments (for academic purposes): Anyone (including those with little or no programming knowledge) should be
able to read your comments and have a basic idea of your program.
Unless written otherwise (for some questions), I am not saying you should write comments for every line of code.
I am asking you to write comments for every code block (section of code).
Do you read my comments? Of course, you should. I provide explanations in my comments.
Does it make sense? Yours should not be different.
A Computer program is a set of instructions given to a computer to perform specific tasks.
A Computer programmer also known as a coder is a person who writes computer programs.
Identifiers are the names used for declared elements such as the names of variables, constructors, methods/functions, and
classes among others.
Every element name in Visual Basic must follow these rules:
(1.) It must begin with an alphabet character ($A - Z$, $a - z$) or an underscore ($_$).
(2.) It must only contain alphabet characters ($A - Z$, $a - z$), decimal digits ($0 - 9$), and underscores ($_$).
(3.) It must contain at least one alphabet character ($A - Z$, $a - z$) or a decimal digit ($0 - 9$) if it begins with an underscore ($_$).
Fields/Variables are usually named in Camel casing (like the hump back of a camel) or Pascal casing.
Camel casing: Begin with a lowercase alphabet, middle is an uppercase alphabet (the hump of a camel) and end with a lowercase alphabet such as $testScore$
Pascal casing: Begin with an uppercase alphabet, middle is an uppercase alphabet, end with a lowercase alphabet such as $TestScore$
Class names begin with an uppercase alphabet such as $Student$
Constructors begin with an underscore and then use Camel casing such as _$testScore$
Procedures (Sub and Function) procedures are usually named using Pascal casing such as $TestScore$
Object-oriented Programming (OOP) Language is a programming language that uses objects
to accomplish the goals of a computer program.
Controls are tools used to create objects in a Visual Basic program.
An Object is an element that is created in a Visual Basic program with the controls.
It is anything that can be touched, seen, or used.
These include: data types (it can be used), variables (it can be used),
toolbox controls (it can be seen and used) among others.
An Object is also defined an instance of the class (when you use the class that has been
created).
Instantiation is the act of creating an object.
The Behavior of an object includes methods and events.
A Method is an action that an object can perform.
For example: The Exit button can use the $Me.Close()$ method to close an application.
In Object-Oriented Programming, methods are often called procedures
Events are the actions to which an object can respond.
For example: The Click event of the Exit button allows the button to respond to
a mouse click by exiting the program.
When a procedure is associated with an event, it is known as an event handler or an event procedure.
Properties are the set of attributes that determine the appearance and behavior
of an object.
They are the characteristics of an object.
You see them in the Properties window of the Visual Studio IDE.
Access Modifiers specify the level of access classes and class members provide to other
classes.
Encapsulation is the combination of fields, properties, methods, and events of an object in a class(capsule).
In other words, keep all the data and program logic in one place.
Inheritance is the ability to create a new class that reuses, extends, and
modifies the behavior defined in another class.
The main class whose members are inherited is known as the Base class or Super class
The class that inherits the members of the main class is known as the Derived class or Sub class
The derived class inherits members of the main class using the Inherits clause.
Abstraction is the hiding away of some details about a program so one can focus on the main
details.
For example, the $PrintForm()$ class in Visual Basic enables one to print a Windows form application at run time (when the program is running)
There are so many details about the $PrintForm()$ class. However, that is not your concern. Your concern is to use that class and print a form. So, those details are hidden from you.
Another example: You do not really want to know how the printer was developed. You just want to know how to use the printer
and print your documents.
Constructors are class methods whose instructions are processed automatically whenever
the class is used to create/instantiate the object.
They are used to initialize the variables of the class.
They are always a Sub procedure named New
Declared Elements are programming elements that is defined in a declaration statement.
They include: variables, constants, structures, properties, events, methods/procedures, and classes among others.
A Procedure is a block of Visual Basic statements enclosed by a declaration statement (Function, Sub, Operator,
Get, Set) and a matching End declaration.
All executable statements in Visual Basic must be within some procedure.
Visual Basic.NET language introducing concepts of object-oriented, event-driven program design and implementation. Prerequisite: None.
By the end of this course, you should be able to do the following:
(1.) Demonstrate best practices for designing end-user computing interfaces.
(2.) Discuss software development methodologies.
(3.) Use a programming or a scripting language to solve a problem.
(4.) Discuss significant trends and emerging technologies and their impact on our global society.
machine language, assembly language, low level language, high level language, IDE (Integrated Development Environment), text editor, compiler, development toolchain, linker, program, header file library, white space, braces, curly brackets, semicolon, string interpolation, concatenation operator, variable, object, function, main function, integer, code, block of code, System namespace, namespace, Program.vb, class, method, console, console application, desktop application
Students will:
(1.) Download and install the Visual Studio IDE
The Visual Studio IDE is highly recommended.
(2.) Discuss an overview of the Visual Basic (VB) programming langauge.
(3.) Write a simple program (Console Application) in VB
(4.) Write a simple program (Desktop Application) in VB
(1.) Textbook Chapter
(2.) VB Tutorials by Microsoft: Welcome to the Visual Studio IDE | Visual Basic: Overview
(3.) VB Tutorials by Tutlane: From: VB Introduction to: VB Hello World Program
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Visual Basic or VB in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Visual Basic or VB in the search bar and view/read the results.
00000 | 10011110 |
00001 | 11110100 |
00010 | 10011110 |
00011 | 11010100 |
00100 | 10111111 |
00101 | 00000000 |
Teacher: Please look at the code above.
Do you understand that code?
Student: The bunch of zeros and ones?
I have no idea what those mean.
Public num1 as Integer
Public num2 as Integer
Public sumNum as Integer
sumNum = num1 + num2
Console.WriteLine(sumNum)
Teacher: What about this code?
Do you understand it?
Student: I do not fully understand it.
However, it makes much sense than the first code?
Teacher: Both codes execute the same tasks.
Ask the user to input those numbers. Add those numbers. Output the sum.
Which code is better?
Student: The second code of course.
Teacher: The first code is the machine code.
It is the machine language.
It is a low level language.
It is the language the computer understands directly without translation.
The second code is the high level language.
It is the language humans can read and understand better.
Hence, there is the need to compile or interpret the high level language to
the machine language so that computers would do what we want them to do.
VB is one of the high level languages that we can use.
It is a compiled language.
This means that it is translated into machine language that can be understood directly by the
system.
In that regard, a set of tools are needed.
The set of tools is known as development toolchain
The core of the development toolchain are a compiler and its linker.
The best way to compile and run VB programs is to use an Integrated Development Environment
(IDE).
An IDE typically has several development tools including a text editor and tool to compile VB
programs directly.
For this course, the Microsoft Visual Studio Community Edition (it is free) is highly
recommended.
However, you may choose to use any IDE that you wish.
Here are some free IDEs for VB:
(1.) Microsoft Visual Studio
Community Edition 2019 (Windows)
(Highly recommended. The only IDE used for this course.)
We do have online compilers for VB.
The online compilers typically do not require any downloads and installs.
However, please note that all files in the project are required for your Midterm Project, Final Project, and
Final Exam.
In the case where you prefer to use an applicable online IDE, please make sure you download the completed
VB project (that includes all files).
Here are some free online compilers/IDEs for VB:
(1.) C# Online Compiler | .NET Fiddle (includes VB)
(2.) Visual Basic (VB.NET) - OneCompiler
(3.) Online VB Compiler
(This one allows you to upload a file; also allows you to save your file if you have a Gmail or Facebook account.)
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Basic VB Syntax
From Step $6$:
Line $6:$ Imports System
This implies that we can use the classes from the System namespace.
We shall discuss classes in detail in the Advanced VB course.
System is the namespace
Console is a class in that namespace
If we do not include the Imports System, then we would have to write: System.Console.WriteLine
in Line $11$
So, the Imports keyword for the namespace, System eliminates the need for writing
System.Console.WriteLine.
This means that Namespaces are used to organize classes.
Lines $7$, $10$, and $12$: VB ignores white space.
Usually, it is good to separate blocks of code with blank lines.
This makes for more readable program.
Line $8$: The Module keyword is similar to a namespace.
Module in VB is similar to a namepsace in C# and similar to a package in Java
The name of the module in this case is Introduction.Program
I understand you probably see only Program. However, if you click it, you will see Introduction.Program
Line $9$: The Sub keyword with the Main method:
This is the sub procedure or subroutine. It is a method. It is the main method in this case.
Every VB program requires a main method.
Line $11$: This the VB statement.
Line $13$: End the sub procedure.
Codes(statements) inside the main method are executed.
VB statements do not end with a semicolon...isn't that great?
Also, you do not have to worry about curly braces...isn't that cool?
Step 7
Step 8
Step 9
As seen from the pictures:
Single line comments and Multiline comments in VB are written the same way: there is a single quote
(single beginning quotation mark) before the comment
This implies that at at today: 03/10/2020; there is no actual way to do multiline comments in VB.
We do have a short way (shortcut) to do it (comment lines/multiple lines in VB):
Write the comments (lines); select all of them (CTRL + A); then do CTRL + K, followed by CTRL + C
To uncomment the lines, select all of them (CTRL + A); then do CTRL + K, followed by CTRL + U
I am not a fan of using the shortcut because it does not include a space between the quotation mark and the comment.
But, you are free to use it if you wish.
VB.NET advises that a space be included between the single quotation mark and the comment. So I prefer to comment each line.
An alternative way to write comments in VB is to use the REM keyword.
It is required that you included a space between the REM keyword and the comment in order for it to be a comment.
If you do not include the space between the REM keyword and the comment, VB will not treat it as a comment.
Please review this note on Writing VB.NET comments
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/rem-statement)
Comments in the Visual Studio IDE is green in color. We shall keep it that way.
Comments in other IDEs might be different colors.
Student: Can you change the comments to display a different color?
Teacher: Yes Sir, you can.
Student: How do I do so, Sir?
Teacher: You do realize that if you change it, the change would be for all the
programs you develop with the Visual Studio IDE. It would not just be for C#. It would also be for C++.
Changing the color of comments would be applied to the entire Visual Studio IDE.
Student: I understand. How do I change the color of the comments?
Teacher: Here are the steps.
These are the steps I did for C#. However, they are also applicable to VB
If you have any questions, please let me know.
First:
Second:
Teacher: In the second picture, you can change the color by selecting from the
dropdown menu.
If you do not like the colors you see there, you can add your own custom color.
However, please leave the default color for all work done in this course.
Comments are required for any program you write in this course.
Rule of Thumb for writing comments (for academic purposes): Anyone should be able to read your comments and have
a basic understanding
of the program.
Both single-line comment and multi-line comments are denoted with a single beginning quotation mark(apostrophe).
Let us review more code examples. Study these codes, write them, observe the punctuation marks, and run them.
Save your work
Step 9
Then, exit
Step 10
We have closed the application.
The application is a Console application.
This means that we should be able to run the executable file and see the output directly in the console
window of the computer.
Let us locate the file and try to run it directly
The file to run is the executable file
It has .exe extension
If you do not see the file extension, Click the View tab and check the box: File name extensions in order
to see the file extension.
Depending on where you saved your program, you can locate it by Clicking:
Application → Application folder → bin → Debug
→ netcoreapp3.1 → Application.exe
The Application folder is where you have the solution file (Application.sln)
To get directly to your project, double-click the solution file.
But let us run the executable file. Double-click that .exe file.
What do you notice?
Student: Something came up and then disappeared.
Teacher: Let us fix that issue.
We want to be able to run our application directly and see the output in the console.
This leads us to another concept....
The Console.ReadLine method reads the next line of characters from the standard input stream.
This means that when we write it as the last code in our program, the program will not close unexpectedly when we
try to run it directly.
The program will wait to see if there is any line to read and will just keep waiting until the user presses a key to
exit the program.
Let's go ahead and add that to our program.
Just double-click the solution file (Application.sln) to open the project.
As you can see, when you run the program; the cursor is blicking on the next line. It is waiting for the user to
do something: either close the application or just press any key on your keyboard.
Go ahead and stop running the project bu clicking the Stop Debugging icon or press Shift + F5 key.
Save All.
Exit the project.
Locate the executable file and run it directly.
The Console.ReadKey() method: obtains the next character or function key pressed by the user.
We can also use the Console.ReadKey method to prevent the program from closing unexpectedly when we run it directly.
Usually, before we write this method; it is important to ask the user to press the Enter key preferably
(but you can press any key) to exit the program.
The pressed key is displayed in the console window.
Then, we write the method.
The program will then wait for the user to press any key before closing the console window.
Let's go ahead and add that to our program.
Just double-click the solution file (Application.sln) to open the project.
When you run the executable file, the program will ask you to press the Enter key to exit the program.
Once you press that Enter key (or any key), the program will be closed.
This ensures that the program is not closed unexpectedly.
The use of these methods are not required.
However:
If you choose to submit a console application for your Final Project, you are required to use the
Console.ReadLine method (my preference) or the Console.ReadKey method
I should be able to run the executable file directly and see the output in the console.
Desktop Application is a GUI (Graphical User Interface)
Please review the Teacher-Student scenario
Student: Mr. C, why do we need to develop desktop application?
Can't we just focus on console applications?
Teacher: Desktop applications are required for several DB assessments and for your Midterm Project.
It is optional for your Final Project.
It is important you learn to develop them.
Student: But, why?
Teacher: These are the reasons:
(1.) GUIs (desktop applications) cover a significant part of Number (1.) of the Student Learning Outcomes of the course.
They also cover some parts of Numbers (2.), (3.), and (4.)
(2.) You can run the executable (.exe) file of a desktop application in any Windows desktop/laptop.
You can even run it on a Mac with some changes.
Student: What are executable files?
Teacher: Good question.
When you develop a VB program such as the one we shall develop in a moment, an executable file is also
developed. It is a file that is run on your computer to execute (do) something on your computer.
When you download and install a program on your computer, it is normally seen as install.exe,
setup.exe or other "something".exe with the word, Application used to describe it.
In our case, it is going to be a standalone file with the exe extension that when downloaded in
any Windows desktop, can run when double-clicked.
Usually, you will get a warning from your computer not to download it because it can destroy your computer.
If you do not know the source/origin of the executable file, do not download it.
But in this case, we shall develop the program so we know it is safe.
When we develop the program, we need to follow these steps to locate the executable file.
Double-click: Application folder → bin → Debug
→ net5.0windows → Application.exe
That Application.exe file is the executable file.
You can download it (no worries, it is safe), save it on your desktop, and run it on your desktop whenever
you want to.
Student: If I copy it to another desktop, will it run?
Teacher: Yes, it will run on any Windows desktop. That is the nice thing about it.
Student: Just that file?
It will run with all the functionality?
Without copying the entire folder?
Teacher: That is correct.
Click the PROJECTS tab of this website.
You will see some desktop applications done by my previous students.
You can go ahead and test them.
Student: Pretty cool.
Did you say it will also run on a Mac?
Teacher: It will run on a Mac.
However, you will need to install some software on a Mac to run it.
(3.) Assume you are working in a developing country (in Nigeria for example), you have a computer but no
internet service, and you really need to develop applications for the projects you are working on;
developing desktop applications is highly recommended in such cases because you do not need the Web/Internet
to run them. All you need is a laptop or desktop.
Student: But, I'm not working in Nigeria.
Neither do I intend to work there.
Teacher: What if you work for a multinational company and your company transfers you to work there?
What if you decide to join your church or organization on a charity mission trip?
(4.) Have you heard that the only thing that is not safe is anything on the Web?
Well-developed desktop applications minimizes your use of web and mobile applications, thereby minimizing cyber crimes.
There are limitations with desktop applications.
But, there are advantages too.
At least they are much better than console applications.
Usually, you may need to download some programs to run console applications.
If you review the PROJECTS (console applications) done by my C++ students, it may require some program downloads to run on
your machine (laptop/desktop).
But the VB desktop applications and the
C# desktop applications will run without any additional download.
One of the big advantages of VB is the developement of Desktop aplications.
Let me welcome you, my dearest students with a desktop application. 😊
As is the case for development of desktop applications, the three basic things to do are:
(1.) Create the user interface
(2.) Set the properties.
(3.) Write the program code.
Form
In the Properties window:
(1.) Change the Text property of the form to Welcome to our Visual Basic Class
Change the Name property of the form to IntroductionForm
(2.) Change the background color of the form to Cornsilk
Click the BackColor property
Click the Web tab and select Cornsilk color
(3.) Change the FormBorderStyle property to Fixed3D
(4.) Adjust the size as you see fit.
(5.) Change the Font property by clicking the ellipsis (three dots)
Font: Times New Roman
Font style: Regular
Font Size: 14
Click the OK button
(6.) Change the ForeColor property to Black
Repeat the same process as you did for the BackColor property.
Picture Box
(7.) Add a PictureBox from the Toolbox Common Controls
(8.) Change the Name property to MyPictureBox
(9.) Click the ellipsis (three dots) in the Property window
(10.) Import a picture and click Ok
(11.) Resize and position as you wish.
Label (You may use a RichTextBox if you wish)
(12.) Add a label from the Toolbox Common Controls
(13.) In the Properties window, change the AutoSize property to False
(14.) Expand as you wish.
(15.) Change the BorderStyle property to Fixed3D
(16.) Change the Name property to MessageLabel
Buttons
(17.) Add three buttons from the Toolbox Common Controls
(18.) Change the Text properties to Welcome Message, Clear, and Exit
(19.) Change the ForeColor properties of the buttons to Black
(20.) Change the BackColor properties of the button to White
Repeat the same process as you did for the BackColor property of the form.
(21.) Change the Name property to MessageButton, ClearButton and ExitButton
Please review the screenshots, and study the comments and the codes.
Teacher: What do you think we should do next?
Student: Excuse me. I'm not sure.
Teacher: Imagine you did a program like this for your little child.
You do not want your child to run the program on your computer so that he/she does not mess up your computer.
What should you do if you want him/her to see it?
Student: Take a picture of it and show it to him/her.
Teacher: What other option?
Student: Print it and paste it on the wall in the bedroom.
Teacher: Yes...Print the application.
(1.) Download and install the Visual Basic PowerPacks
(2.) Open the solution file, Application.sln named Visual Studio Solution by double-clicking it.
It is recommended that you always open the solution file whenever you open already-developed VB programs.
(3.) You can view the Code window, Toolbox, and Properties window by clicking the View menu and selecting
whatever window you would like to view.
Open the Toolbox and do the following tasks.
Based on the last screenshot, the PrintForm control has been successfully added, but has not been enabled.
No worries, we shall use it in a minute. Read on.
(4.) Let us print the Program code and the GUI
Print the source code (to study it)
Give it a file name and specify a location for the printed page
The printed page should look like like this:
Print the Design Form/User Interface (to give to your child)
Run the program
Use the Snipping Tool or the Snip & Sketch
on your computer and take the screenshot of the program (just as I did)
Then, print the user interface.
After creating your VB desktop application, please follow these steps if you want to make changes to it.
(1.) Open the solution file, Application.sln named Visual Studio Solution by double-clicking it.
It is recommended that you always open the solution file whenever you open already-developed VB
programs.
(2.) Double-click the Form1.vb to open the Design window
(3.) Make any changes you want to make.
You can view the Code window, Toolbox, and Properties window by clicking the View menu and selecting
whatever window you would like to view.
(4.) Also, it is highly recommended you Build Solution first before you Run the solution.
Student: Mr. C, I tried to run the executable file you sent.
I downloaded it on my computer and double-clicked it but it did not work.
Teacher: Did it open?
Student: No Sir.
Teacher: Did you download the .NET Framework and the PowerPacks as we did earlier?
Student: I did.
Teacher: This is what I recommend.
This should work.
However, if it does not, then try this.
Double-click the executable file.
The application should work.
Student: Okay, I tried to do what you explained.
I still cannot get the executable file to run outside the program folder.
Am I doing something wrong?
Teacher: Let us try this approach.
Actually, this is what we should have done first.
(1.) Click the Build menu.
(2.) Click the Rebuid Solution command and make sure the Build succeeded.
(3.) Click the Clean Solution command.
(4.) Click the Clean IntroductionDesktopApp command.
Please review the steps in the screenshots.
Student: I have another question.
Why did you not choose the Portable Target runtime?
Teacher: Good question.
The portable version has other files published with it.
It will not run independently. It has to run with all those files published with it.
Student: Else, it will not run?
Teacher: That is correct.
This is the executable file:
Mr. C's Introduction (Desktop App)
It should work. It should run by itself.
(1.) Discuss a brief history of VB.
(2.) Discuss the versions of VB including any significant change made for each version.
(3.) Discuss any console application developed with VB.
(4.) Discuss any desktop application developed with VB.
(5.) Discuss any web application developed with VB.
(6.) Discuss any mobile application developed with VB.
(7.) Discuss any IDE for VB including the advantages and disadvantages.
(8.) Explain using appropriate examples, any three new terms learned in this module.
(9.) Compare any three features of VB with any similar object-oriented language.
(10.) Contrast any three features of VB with any similar object-oriented language.
(1.) Include any missing gaps in the history of VB.
(2.) Include any missing gaps in the versions of VB.
(3.) Discuss an additional console application developed with VB.
(4.) Discuss an additional desktop application developed with VB.
(5.) Discuss an additional web application developed with VB.
(6.) Discuss any mobile application developed with VB.
(7.) Discuss any IDE for VB. Include the advantages and disadvantages.
(8.) Add to the post of the student who explained any three new terms learned in this module.
(9.) Add to the post of the student who compared three features of VB with another
object-oriented langauge.
(10.) Add to the post of the student who contrasted three features of VB with another
object-oriented langauge.
(11.) Provide any of these if it is lacking in any DB post that solved any question in the
Assess tab of this module: Well-written comments; another approach/method to solving the
question; any additional relevant details; etc.
(12.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(1.) Develop a desktop application titled: Introduction
The application should include three buttons: the About button, the Clear button, and the
Exit button.
When a user opens the application, it should display a blank page and the three buttons.
When the user clicks the About button, these information should be displayed:
(a.) Your picture
(b.) A brief summary of you. Write at least three sentences about yourself.
(c.) One sentence about the course and your major/program.
(d.) One sentence about the course expectations/accomplishments. What is your expectation about the course? What
do you intend to accomplish at the end of the course?
(e.) Any other thing you would like us to know about you.
When a user clicks the Clear button, the page should be blank.
When a user clicks the Exit button, the application should close.
I am more interested in the functionality.
However, I am also interested in the design/graphics/aesthetics.
Make a good design.
(2.) Write two different sentences on two different lines.
Insert a blank line between the first line and the second line.
Do NOT use the "vbNewLine" command.
vary, variable, identifier, data type, data value, value, parameter, container, ASCII (American Standard Code for Information Exchange), static variables, instance variables, array elements, value parameters, reference parameters, output parameters, local variables, definite assignment, assignment operator, initially assigned variables, initially unassigned variables, constant, keyword, reserved keyword, contextual keyword, access keys, tab index property, type conversion, implicit conversion, explicit conversion, widening conversion, narrowing conversion, string conversion, object conversion, array conversion, local variable, member variable, shared variable, instance variable, procedure, Hungarian notation, inline function, function call, CType function, casting,
Students will:
(1.) Discuss the meaning of variables in VB.NET
(2.) Discuss the data types in VB.NET
(3.) Discuss the rules for using identifiers in VB.NET
(4.) Write VB.NET programs involving the use of variables and data types.
(1.) Textbook Chapter
(2.) Visual Basic Tutorials by Microsoft - Part 1: Variables in Visual Basic
(3.) Visual Basic Tutorials by Microsoft - Part 2: From Data Types to Type Conversions
(4.) Visual Basic Tutorials by Tutlane: VB Data Types and VB Variables
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(5.) Type Visual Basic Variables and/or Visual Basic Data Types in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(6.) Type Visual Basic Variables and/or Visual Basic Data Types in the search bar and view/read the results.
A Variable is a portion of computer memory for storing a data value.
Because a variable stores a data value, it is important to identify the type of data value it stores.
This implies that any variable is associated with a data type.
The data type describes the type of data value stored by the variable.
What type of data is being stored? Are they numeric (numbers), non-numeric
(letters/characters/words), etc.?
As noted with the word: variable, any value stored by it can vary (can change).
A variable is created/declared in VB by specifying the data type associated with it and
assigning it to a value.
A variable has a name (the word used to refer to the value that the variable contains) and a data type
(which determines the kind of data stored in the variable)
Generally, we declare a variable in Visual Basic this way:
Dim variableName As dataType
OR
Dim variableName As dataType = value
The Dim statement is known as the Dimension statement.
The As clause allows us to define the data type or the object type of the variable.
The equal sign is the assignment statement.
In other words, we assign something in VB using the equal sign.
NOTE: It is possible to declare a variable without specifying the data type.
This approach is known as Local Type Inference.
It is only used for local variables.
A local variable is a variable that is declared within a procedure.
A procedure is a block of Visual Basic statements enclosed by a declaration statement (Function, Sub, Operator, Get, Set)
and a matching End declaration.
All executable statements in Visual Basic must be within some procedure.
We do have other types of variables. We shall discuss them at the end of this module.
For now, let us focus on local variables.
The Visual Basic compiler uses type inference to determine the data types of local variables declared without the As clause.
Based on the initial vaue of the expression, the compiler infers the type of the the variable.
To use the declare variables using the local type inference, the Option Infer must be set to On
By default, the Option Infer is set to On
Be it as it may, you are expected not to declare variables in this course without the As clause.
In other words, you should not use the local type inference declaration.
A data type is used to define the variable.
It tells what kind of variable is being declared.
When we declare a variable or constant in a program, we must specify the datay type
Sometimes, we may not be sure of the data type, or we may not want to associate the variable with a specific
data type.
In that case, we can use the Object data type.
This is because any data type can be stored in a variable of type Object
Let us review the data types in VB.
Data Type | Declaration | Size | Description |
---|---|---|---|
(1.) Signed Byte | SByte | $1$ byte ($8$ bits) | Integers from $-128$ to $127$ are stored |
(2.) Byte (Unsigned) | Byte | $1$ byte ($8$ bits) | Integers from $0$ to $255$ are stored |
(3.) Short (Signed Short Integer) | Short | $2$ bytes ($16$ bits) | Int16: Integers from $-32,768$ to $32,767$ are stored |
(4.) UShort (Unsigned Short Integer) | UShort | $2$ bytes ($16$ bits) | UInt16: Integers from $0$ to $65,535$ are stored |
(5.) Integer (Signed Integer) | Integer | $4$ bytes ($32$ bits) | Int32: Integers from $-2,147,483,648$ to $2,147,483,647$ are stored |
(6.) Unsigned Integer | UInteger | $4$ bytes ($32$ bits) | UInt32: Integers from $0$ to $4,294,967,295$ are stored |
(7.) Long (Signed Long Integer) | Long | $8$ bytes ($64$ bits) | Int64: Integers from $-9,223,372,036,854,775,808$ to $9,223,372,036,854,775,807$ are stored |
(8.) ULong (Unsigned Long Integer) | ULong | $8$ bytes ($64$ bits) | UInt64: Integers from $0$ to $18,446,744,073,709,551,615$ are stored |
(9.) Single (Single-precision floating point) | Single | $4$ bytes ($32$ bits) |
$-3.4028235E+38$ through $-1.401298E-45$ for negative values This means $-3.4028235 * 10^{38}$ through $-1.401298 * 10^{-45}$ for negative values $1.401298E-45$ through $3.4028235E+38$ for positive values $1.401298 * 10^{-45}$ through $3.4028235 * 10^{38}$ for positive values |
(10.) Double (Double-precision floating point) | Double | $8$ bytes ($64$ bits) |
$-1.79769313486231570E+308$ through $-4.94065645841246544E-324$ for negative values This means: $-1.79769313486231570 * 10^{308}$ through $-4.94065645841246544 * 10^{-324}$ for negative values $4.94065645841246544E-324$ through $1.79769313486231570E+308$ for positive values This means: $4.94065645841246544 * 10^{-324}$ through $1.79769313486231570 * 10^{308}$ for positive values |
(11.) Decimal | Decimal | $16$ bytes ($128$ bits) |
$0$ through $\pm 79,228,162,514,264,337,593,543,950,335$ with no decimal point $0$ through $\pm 7.9228162514264337593543950335$ with $28$ places to the right of the decimal |
(12.) Boolean | Boolean |
Storage depends on the implementing platform $0$ = False, $1$ = True Make the connection with electronic devices. $0$ = Off; $1$ = On |
True or False |
(13.) Character (Single Character) | Char | $2$ bytes ($16$ bits) |
Integers from $0$ to $65535$ (unsigned) are stored. Only a single character/letter is stored. Must be enclosed in double quotes. (unlike in C#, Java, C++ where it is enclosed in single quotes) |
(14.) String (variable-length) | String | Storage depends on the implementing platform |
$0$ to $\approx 2 * 10^{9}$ Unicode characters Must be enclosed in double quotes. |
(15.) Date | DateTime | $8$ bytes | 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999 |
(16.) Object | Object (class) |
$4$ bytes on $32-bit$ platform $8$ bytes on $64-bit$ platform |
Any data type can be stored in a variable of type Object |
(17.) User-Defined (structure) | inherits from ValueType | Storage depends on the implementing platform |
Each member of the structure has a range that is determined by its data type. The range is independent of the ranges of the other members. |
VB variables are identified with unique names known as idenfiers.
It is important to use identifiers that are meaningful and descriptive.
Anyone reviewing your program should not have to guess the meaning of your variable.
As you can see (based on the image below: Variables, Data Types, Values:)
The variables I used in that example are meaningful and descriptive
Those variables are:
state to denote the State of Ohio, OH
numState to denote the number of the State of Ohio in an alphabetical listing of the
state names
povertyRate to denote the poverty rate of Ohions according to the $2000$ census data
landArea to denote the land area of the Ohio according to the $2000$ census data
motto to denote the motto and seal of the Great State of Ohio
isMottoTrue to denote the Boolean data type if the motto is true
Even without the comments, you already have an idea of the meaning of my variables.
I should not have to guess the meaning of your variables.
Variable names:
(1.) Can be single letters (please avoid unless if used in loops)
(2.) Can contain a combination of letters, digits, and underscores but must not begin
with a number.
It may begin with a letter or an underscore.
If it begins with an underscore, it must contain at least one letter or digit.
Be it as it may:
(a.) Please avoid underscores
Avoid underscores even if the variable name does not begin with an underscore.
(b.) Use a combination of letters and digits such as:
num1 to represent the first number
variable1 to represent the first number
(3.) Can contain only letters but must not be any of the keywords.
They consist of: reserved keywords and unreserved keywords
Reserved keywords have special meanings in all VB programs.
Unreserved keywords are not reserved. This implies that you can be use them. However, please do not use them.
It is highly recommended to avoid using any keywords as an identifier in any VB program.
The reserved keywords are:
AddHandler, AddressOf, Alias, And, AndAlso, As, Boolean, ByRef, Byte, ByVal, Call, Case, Catch, CBool, CByte, CChar, CDate,
CDbl, CDec, Char, CInt, Class Constraint, Class Statement, CLng, CObj, Const, Continue, CSByte, CShort, CSng, CStr, CType,
CUInt, CULng, CUShort, Date, Decimal, Declare, Default, Delegate, Dim, DirectCast, Do, Double, Each, Else, ElseIf,
End Statement, End <keyword>, EndIf, Enum, Erase, Error, Event, Exit, False, Finally, For (in For...Next),
For Each...Next, Friend, Function, Get, GetType, GetXMLNamespace, Global, GoSub, GoTo, Handles, If, If(), Implements,
Implements Statement, Imports (.NET Namespace and Type), Imports (XML Namespace), In, In (Generic Modifier), Inherits,
Integer, Interface, Is, IsNot, Let, Lib, Like, Long, Loop, Me, Mod, Module, Module Statement, MustInherit, MustOverride,
MyBase, MyClass, NameOf, Namspace, Narrowing, New Constraint, New Operator, Next, Next (in Resume), Not, Nothing,
NotInheritable, NotOverridable, Object, Of, On, Operator, Option, Optional, Or, OrElse, Out (Generic Modifier), Overloads,
Overridable, Overrides, ParamArray, Partial, Private, Property, Protected, Public, RaiseEvent, ReadOnly, ReDim, REM,
RemoveHandler, Resume, Return, SByte, Select, Set, Shadows, Shared, Short, Single, Static, Step, Stop, String,
Structure Constraint, Structure Statement, Sub, SyncLock, Then, Throw, To, True, Try, TryCast, TypeOf…Is, UInteger, ULong,
UShort, Using, Variant, Wend, When, While, Widening, With, WithEvents, WriteOnly, Xor, #Const, #Else, #ElseIf, #End, #If,
=, &, &=, *, *=, /, /=, \, \=, ^, ^=, +, +=, -, -=, >> Operator, >>= Operator, <<,
<<=
EndIf, GoSub, Variant, Wend are no longer used in Visual Basic.
However, they are still retained as reserved keywords.
The unreserved keywords are:
Aggregate, Ansi, Assembly, Async, Auto, Await, Binary, Compare, Custom, Distinct, Equals, Explicit,
From, Group By, Group, Join, Into, IsFalse, IsTrue, Iterator, Join, Key, Mid, Off, Order By, Preserve,
Skip, Skip While, Strict, Take, Take While, Text, Unicode, Until, Where, Yield, #ExternalSource,
#Region
(a.) The letters can be Camel case (similar to the hump of a camel) such as:
firstVariable...the V is the hump
In Camel casing letters: two letters are merged as one; the first letter of the second word is
an uppercase letter while all other letters are lower case letters.
In firstVariable, V is uppercase; all other letters are lower case
(b.) The letters can be Pascal case such as FirstVariable
In Pascal casing, two letters are merged as one; the first letter of the first word and the
first letter of the second word are uppercase letters while all other letters are lower case letters.
In FirstVariable, F and V are uppercase; all other letters are lowercase.
(c.) uppercase letters (please avoid...it denotes someone who is yelling)
(d.) lowercase letters (okay, but try to avoid)
Student: What if you have three words?
How do you write it in Camel case? Pascal case?
Teacher: Say we want to write the variable, first arithmetic sequence
Camel case: firstArithmeticSequence...A and S are the only uppercase
Pascal case: FirstArithmeticSequence...F, A, S are the only uppercase
In this course, for all applicable variables; please use:
(i.) A combination of letters and digits such as num1 OR
(ii.) Camel case letters such as firstNumber OR
(iii.) Pascal case letters such as FirstNumber
***We shall use single characters when we write conditions for Iteration statements/Loops
because it is easier to use single characters in such cases. We shall see examples when we discuss loops.
However, feel free not to use it if you wish.***
(4.) Cannot be more than $1023$ characters long.
This length requirement also applies to the entire string of a full name such as:
outerNamespace.middleNamespace.innerNamespace.thisClass.thisElement
(5.) Cannot contain whitespaces.
A whitespace is a horizontal or vertical space.
For example: myNum has no whitespace; but my Num has a whitespace.
Variable names cannot contain whitespaces.
Hence: myNum is acceptable, but my Num is not acceptable.
Declaring Read-Only Variables: Use the ReadOnly keyword
As we have learned, a variable vary. The value changes.
However, read-only variables do not change.
Sometimes, we need these kind of variables.
We have to create/declare them using the ReadOnly keyword.
This must be declared at the Module level, not at the Procedure level
For example, if we want to use the approximate value of pi as $3.142$ rather than using the exact value, we can
declare it as:
ReadOnly $piValue$ As Double = $3.14159$
This means that the variable, piValue is a read-only variable
It will not change it's value.
Student: What do you mean that it must be declared at the Module level?
May you please give code examples?
Teacher: Sure.
We shall begin with console applications.
Then, we shall develop desktop applications.
We shall create a new project and name it: Module2
Let us review these two examples.
Let us try to modify the value of the read-only variable and try to run it to see the output.
Please do not run any program that compiles with an error.
As you can see, the variable $piValue1$ cannot be changed because it was declared as a read-only
variable (using the ReadOnly keyword)
Teacher: As you see: for the new value of piValue1, we can modify the value of any variable we create, by specifying another value for that same variable name.
Student: But, why do we need to do this?
Can't we just create another variable with that second value?
Teacher: Good point.
Yes, it is much better to create another variable with the new value.
However, when we work with statements and sorting techniques among others; it may be more efficient to just assign the new value to the same variable; rather than create another variable and assign the new value to it.
For example: if you are sorting through a loop also known as an iteration statement; we can create a variable, and write a conditional statement that when you compare an element in the array with the next element; assign the value of the greater element to the variable.
Rather than create a new variable, assign any greater value to the variable as you compare elements in the array.
There are some terms I just used, that we shall discuss in later modules.
(6.) Are case sensitive.
These are all different variables:
firstresult (lowercase),
firstResult (Camel case),
FirstResult (Pascal case),
Firstresult,
FIRSTRESULT (uppercase),
first_result (snake case)
strFirstResult (Hungarian notation)
Student: Hungarian notation?
Teacher: Hungarian notation is a naming convention that follows the camel case naming but in which
the name is preceded by the data type represented by a three-character ID.
str means string
Similarly, int is for integer; dec is for decimal;
dbl is for double; bln is for Boolean among others.
Variables, Data Types, Values Example: State of Ohio
Why discuss Type Conversions?
Reasons:
(A.) You might declare the result of a calculation as an integer.
You do the calculation and the result is say $32$
However, your professor wants the answer to a double with at least one decimal place.
This means that you have to either declare the result as a double before doing the calculation, or
you have to convert the Integer result to a Double.
And sometimes, you may need to do the latter especially if you need to use the Integer result in another
calculation.
(B.) You might have a Single data type variable that you need to pass as an argument to a method whose parameter is
declared as an Integer data type.
(C.) You might need to convert an Object to another data type.
If you do not understand what I wrote in (B.) and (C.), do not worry.
You will understand (B.) later in this course.
You will understand (C.) in the Advanced Visual Basic course.
These kinds of operations are known as type conversions.
Type Conversions is the conversion of a variable of a data type to
a different data type.
There are several approaches of conversions that can be performed in VB.
They are:
(I.) Implicit and Explicit Conversions
These are the conversions classified by whether Visual Basic perfoms them automatically
(II.) Widening and Narrowing Conversions
These are the conversions classified by whether the destination type can hold the data.
(III.) Conversions Between Strings and Other Types
These are the conversions between strings and other data types such as integers, singles, decimals, doubles,
Boolean, and/or data among others.
(IV.) Array Conversions
This is the conversion between arrays of different data types.
(V.) Conversion of an Object to Another Type
This is the conversion between an object of a data type to an object of another data type.
We shall focus on the first three conversions in this module.
We shall discuss the last conversion in the Advanced Visual Basic course.
(1.) Implicit Conversion: This is the conversion of a variable from a smaller data type to a larger data
type.
This is done automatically.
No special syntax is required. No information is lost.
The conversion always succeeds.
Examples include the conversions from:
SByte to Short Byte to Char Byte to Int Byte to Long Byte to Single Byte to Double Short to Char Short to Int short to Long Short to Single Short to Double Char to Int Char to Long Char to Float Char to Double Int to Long Int to Single Int to Double Long to Single Long to Double Single to Double ...among others(2.) Explicit Conversion (Casting): This is the conversion of a variable from a larger data type to a smaller data type.
Double to Single Double to Long Double to Int Double to Char Double to Short Double to Byte Single to Long Single to Int Single to Char Single to Short Single to Byte Long to Int Long to Char Long to Short Long to Byte Int to Char Int to Short Int to Byte Char to Short Char to Byte Short to Byte ... among othersThere are several approaches to performing explicit conversions.
Convert.To (data type) method
This is a method of the Convert Class from the System namespace
It converts a base data type to another base data type.
As usual, we shall develop desktop applications that involves the use of variables and data types.
Let us develop desktop applications for the console application we did for the State of Ohio
We shall use several toolboxes.
Remember that the Midterm Project is a desktop application.
Hence, it is necessary to start getting familiar with GUI programming.
Please review the desktop application we did in Module $1$
We shall give appropriate names for our projects.
Tasks:
User Interface and Properties
Form:
Name Property: Leave as is
Text Property: State of Ohio: RichTextBox and Buttons
BackColor Property: Web: Wheat
Font Property: Font: Times New Roman; Font style: Regular; Size: $16$; Script: Western
Toolbox | Property |
---|---|
Label $1$ (LHS) |
Name: leave as is Text: State |
Label $2$ (RHS) |
Name: StateLabel AutoSize: False Text: Delete it BorderStyle: Fixed3D BackColor: Web: White |
Copy, Paste, Adjust, Align: Label $1$ Label $3$ (LHS) |
Name: leave as is Text: Number |
Copy, Paste, Adjust, Align: Label $2$ Label $4$ (RHS) |
Name: NumberLabel |
Copy, Paste, Adjust, Align: Label $1$ Label $5$ (LHS) |
Name: leave as is Text: Poverty Rate |
Copy, Paste, Adjust, Align: Label $2$ Label $6$ (RHS) |
Name: PovertyRateLabel |
Copy, Paste, Adjust, Align: Label $1$ Label $7$ (LHS) |
Name: leave as is Text: Land Area |
Copy, Paste, Adjust, Align: Label $2$ Label $8$ (RHS) |
Name: LandAreaLabel |
Copy, Paste, Adjust, Align: Label $1$ Label $9$ (LHS) |
Name: leave as is Text: Motto |
Copy, Paste, Adjust, Align: Label $2$ Label $10$ (RHS) |
Name: MottoLabel |
Copy, Paste, Adjust, Align: Label $1$ Label $11$ (LHS) |
Name: leave as is Text: Is Motto true? |
Copy, Paste, Adjust, Align: Label $2$ Label $12$ (RHS) |
Name: BooleanLabel |
Button $1$ (RHS) |
Name: OhioButton Text: State of Ohio BackColor: Web: White |
Copy, Paste, Adjust, Align: Button $1$ Button $2$ (Middle position) |
Name: ClearButton Text: &Clear |
Copy, Paste, Adjust, Align: Button $1$ Button $3$ (RHS) |
Name: ExitButton Text: E&xit |
Select the first label on the left: the State label (Text property); hold the CTRL key on your keyboard and select all the Left
Hand Side (LHS) labels
Aligh all the LHS labels to the left
Click on an empty space in the form to deselect all the RHS labels.
Select the first label on the right: the StateLabel (Name property); hold the CTRL key on your keyboard and
select all the Right Hand Side (RHS) labels
Aligh all the RHS labels to the right
Click on an empty space in the form to deselect all the RHS labels.
Select the three buttons.
Click the Format menu, Make Same Size: Both
Click on an empty space in the form to deselect the three buttons.
Student: Mr. C
I have a question.
Why did you decide to include that symbol besides the "C" in the Clear button and the "x" in the Exit button?
Teacher: Very good question.
That symbol is known as the ampersand symbol
The underlined word is known as an Access Key
Student: What is an Access Key?
(1.) An Access Key is a key assigned to an object (toolbox control objects) by including the ampersand symbol, &
before a letter or number in the Text Property of the object.
(2.) When you run any desktop application, press the Alt key
If access keys were used in the application, you will see the underlined letter.
Any user can access the application by using a combination of the Alt key and the Access key
to select the specific object.
For example in our program: when we run the application; a combination of Alt + C clears the entries in the application.
Similarly, Alt + X combination selects the Exit button and exits the application.
(3.) Access keys are useful for those who cannot work with a mouse, or who do not want to work with a mouse.
(4.) It is important for programmers to assign access keys to objects that accept user input such as textboxes and to
objects that perfom actions such as buttons.
It is part of Accessibility Design for people with disabilities.
The use of access keys in the Midterm Project is required.
It is important to use meaningful access keys.
(5.) Pressing the Alt key temporarily shows the accessing keys.
(6.) Access keys are not case sensitive.
(7.) Toolbox controls that cannot receive focus cannot have access keys.
(1.) Go to the Design View of the form and double click the State of Ohio button
(2.) Declare the variables
(3.) Write the code.
(4.) Alternatively, you can go to the View menu, and view Code
Then, select the OhioButton in the Code View under the Form1() dropdown list.
(5.) In the same manner, code the Clear button and the Exit button
(6.) Build Solution
(7.) Run the program.
Please view the screenshots. Study the comments and the code.
The TextBox is a Windows control that:
(1.) Accepts user input.
It accepts only the string type by default. So, if we want to use numeric types say an integer; then we need to convert the
string to an integer using the Convert.ToInt32 method or the Int32.TryParse method.
The TextBox can also be used to display user input. It displays only strings by default.
So, if we want to use the TextBox to display a numeric type say a double; then we need to include it in a string interpolation
or use the ToString() method.
(2.) Provides MultiLine editing with vertical scroll bars.
To use this feature, we have to check the box: MultiLine when we drag the TextBox into the form.
The Label
is a Windows control that:
(1.) Provides descriptive text for a control.
(2.) is also used to display the program output.
It displays only strings by default.
So, if we want to use the Label to display a numeric type say a double; then we need to include it in a string interpolation
or use the ToString() method.
The AutoSize property needs to be set to False so the label can be expanded.
In addition, I prefer to set the BorderStyle property to Fixed3D.
The Button
is a Windows control that raises an event when a user clicks it (click event).
In other words, it performs an action when clicked.
Here, we shall use the RichTextBox and the Buttons. No labels.
The RichTextBox is a toolbox control that:
(1.) Accepts user input.
It accepts only the string type by default. So, if we want to use numeric types say an integer; then we need to convert the
string to an integer using the Convert.ToInt32 method or the Int32.TryParse method.
The TextBox can also be used to display user input. It displays only strings by default.
So, if we want to use the TextBox to display a numeric type say a double; then we need to include it in a string interpolation
or use the ToString() method.
(2.) Provides MultiLine editing with vertical scroll bars.
Tasks:
User Interface and Properties
Form:
Name Property: Leave as is
Text Property: State of Ohio: RichTextBox and Buttons
BackColor Property: Web: Cornsilk
Font Property: Font: Times New Roman; Font style: Regular; Size: $16$; Script: Western
Toolbox | Property |
---|---|
RichTextBox |
Name: OhioRichTextBox Text: Nothing |
Button $1$ (RHS) |
Name: OhioButton Text: State of Ohio BackColor: Web: White |
Copy, Paste, Adjust, Align: Button $1$ Button $2$ (Middle position) |
Name: ClearButton Text: &Clear |
Copy, Paste, Adjust, Align: Button $1$ Button $3$ (RHS) |
Name: ExitButton Text: E&xit |
Select the three buttons.
Click the Format menu, Make Same Size: Both (as we did in the first flashcard)
(1.) Double click the State of Ohio button
(2.) Declare the variables
(3.) Write the code.
(4.) Code the Clear button and the Exit button
(5.) Build Solution
(6.) Run the program.
Please view the screenshots. Study the comments and the code.
We shall explore more toolbox controls in subsequent modules.
(1.) Using at least five complete sentences and at least five different variables and data types,
write a program of the summary of what you learned in this module.
(2.) Write a program of a short story, a poem, or drama using at least five sentences and at least five different variables and data types.
(3.) Write a program that demonstrates at least ten examples of Implicit Type Conversions
Use the data types listed in this Module.
(4.) Write a program that demonstrates at least ten examples of Explicit Type Conversions
Use the data types listed in this Module.
(5.) Write a program of a short story, a poem, or drama using at least five sentences, the same variable,
and at least three different data types.
(6.) To be done by only one student on a first-come first-served basis
Assume you have three initials.
Write a program that declares variables to hold your three initials.
Display the three initials with a period following each one, for example: $S.D.C$
(1.) Provide any of these details if they are lacking in any DB post:
Well-written comments; another approach/method to solving the question; any additional relevant details; etc.
(2.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(3.) Other substantive responses.
(1.) Develop a Graphical User Interface (GUI) of a short story, a poem, or drama using at least five sentences and
at least five different variables and data types.
At least three buttons: the button that displays the information, the Clear button and the
Exit button should be included.
Include access keys for the three buttons.
(2.) Develop a Graphical User Interface of a short story, a poem, or drama using at least five sentences,
the same variable, and at least three different data types.
At least three buttons: the button that displays the information, the Clear button and the
Exit button should be included.
Include access keys for the three buttons.
(3.) Develop a GUI flashcard of all the data types.
A brief definition of each data type should be displayed when the user performs an event
(such as pointing the mouse or clicking) on each data type.
Use whatever toolbox controls you prefer.
number, variable, constant, literal, value element, operand, operator, operation, expression, arithmetic operators, comparison operators, concatenation operators, logical operators, bitwise operators, plus, addition, ampersand, assignment operator, compound assignment operators, standard input stream, null-conditional operators, bit shift operators, New operator, DirectCase operator, TryCast operator, NameOf operator, operator precedence and associativity, arithmetic overflow, division by zero, round-off errors, floating-point division, operator overloading, access keys, TabIndex property, ComboBox, MessageBox, calculator, short-circuit, Not operator, And operator, Or operator, Xor operator, AndAlso operator, OrElse operator,
Students will:
(1.) Discuss the operators in Visual Basic
(2.) Perform operations on variables/values
(3.) Write VB programs involving the use of operators.
(1.) Textbook Chapter
(2.) Operators and Expressions by Microsoft
(3.) Operators by Microsoft
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Visual Basic Numbers and/or Visual Basic Operators in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Visual Basic Numbers and/or Visual Basic Operators in the search bar and view/read the results.
These references will be useful as we progress through the course:
(6.) List of Visual Basic Math Functions
(7.) Format Types in .NET
.NET means that the format types are applicable to VB and C#
(8.) Standard Numeric Format Strings
Operators are special symbols that perform specific operations on one or more operands,
and returns an output.
An Operand is the variable/value on which an operation is done.
Based on the definitions by Microsoft:
An operator is a code element that performs an operation on one or more code elements that hold values.
Value elements include variables, constants, literals, properties, returns from Function, and Operator procedures, and
expressions.
An expression is a series of value elements combined with operators, which yields a new value.
The operators act on the value elements by performing calculations, comparison, or other operations.
The types of operators in Visual Basic.NET are:
(1.) Concatenation Operators
(2.) Arithmetic Operators
(3.) Assignment Operators
(4.) Comparison Operators
(5.) Null-conditional Operators
(6.) Logical/Bitwise Operators
(7.) Bit Shift Operators
(8.) New Operator
(9.) DirectCase Operator
(10.) TryCast Operator
(11.) NameOf Operator
The operators listed on Number (8.) through (11.) shall be discussed in the Advanced Visual Basic course.
Let us discuss some of these operators.
Concatenation Operators join multiple strings into a single string.
The two concatenation operators in VB are: $+$ (plus symbol) and the & (ampersand symbol)
Both operators are used to join strings and string data type.
However, the plus sign, $+$ joins numeric data types, string data types, and other data types.
In Modules $1$ and $2$, we used the plus sign: $+$ to join strings.
But the ampersand sign, & is recommended for string concatenation because it is exclusively defined for strings and reduces
the chances of generating an unintended conversion.
Feel free to use any or both of them.
However, going forward; we shall use the ampersand sign for only string data types.
Let us review some code examples with the use of both opeartors.
Arithmetic Operators are used to perform arithmetic operations on numeric values represented by literals, variables,
constants, other expressions, and function and property calls.
They are the:
Addition (+), Subtraction (-), Multiplication (*), Division (/), Integer Division (\), Exponentiation (^), and the
Modulus (Mod)
Did you notice the difference between the Division operator (forward slash, /) and the
Integer Division operator (backward slash, \)?
The Division operation gives the quotient and the remainder.
The Integer Division gives only the integer quotient of the division.
The Modulus operator gives only the integer remainder of the division.
Let us demonstrate some examples of Arithmetic operators.
Let us solve more examples.
Please visit my website on Numbers
(www.numbersandnotations.appspot.com/numbers.html)
Let us solve Questions $10$, $6$, $7$, and $23$ on that website
We shall use only Arithmetic Operators to solve Question $10$
We shall cover Functions (Methods) in Module $6$. However, it is important to introduce you to Visual Basic Math Functions in
this module because we are dealing with Numbers in this module.
We shall use Arithmetic Operators and Visual Basic Math Functions to solve Questions $6$, $7$, and $23$
This is the List of Visual Basic Math Functions
Please review the screenshots and the comments.
Teacher: You know one of the things I like about VB?
Student: What?
See how we declared the answers as double data type
But if the answer is an integer, VB displayed the answer as an integer rather than as a double
Java would have "messed" this up...displaying it as a double, then we have to convert that double back to an
integer
With VB, when we declare the answer as a double; if the answer is an integer, it will display it as an integer.
If the answer is a double, it will display it as a double.
Student: I like that too
Teacher: Yep...
But we need to declare it as a double because a double is a larger data type.
If we declare it as an integer and the answer is a double, then it will be rounded...that is not what we want.
Student: Look at Question (7.)
The answer on your website is not "exactly" the same as the answer displayed by the program
$84.7$ is not really $84.69999999999999$
Teacher: Good observation
The double data type has a double-precision floating point.
Hence, sometimes, it does not give the perfect accurate exact answer.
Assignment Operators are used to assign a value to a variable or property.
The equal sign is the assignment operator for programming languages (not just for VB)
Compound Assignment Operators are used to perform an operation on the value of a variable before assigning an
updated value to the variable.
They are:
$=$ operator (assignment operator)
$+=$ operator (compound assignment: add before assignment)
$-=$ operator (compound assignment: subtract before assignment)
$*=$ operator (compound assignment: multiply before assignment)
/= operator (compound assignment: divide before assignment)
\= operator (compound assignment: integer division before assignment)
^= operator (compound assignment: raise to an exponent before assignment)
≪ $=$ operator (compound assignment: arithmetic left shift before assignment)
≫ $=$ operator (compound assignment: arithmetic right shift before assignment)
&$=$ operator (compound assignment: concatenate a string expression to a string variable before assignment)
We use compound assignment operators if we want to do two things in one.
Rather than perform two tasks using two steps, perform those two tasks using one step.
Some people like it. Some people do not.
However, I prefer you learn it because you will most likely find it useful when we cover Statements in Module $5$
Let us demonstrate what I mean.
Please visit my website on Percent Applications
(www.fractions-decimals-percents.appspot.com/percentApplications.html)
Let us solve Question $1$ on that website
We covered Read-Only variables in Module $2$
However, we do have the Const keyword for declaring constants.
Like a Read-only variable, a constant cannot be modified or assigned a new value once it is declared.
The use of any of them (read-only variable or constant) depends on the program.
We shall use constants primarily in object-oriented programming (Advanced VB course)
However, let us illustrate it's use in this example...in the case of the sales tax
We could also declare the sales tax as a read-only variable if we want to.
But let us look at the use of constants.
So, what's the difference between the two?
First Difference: A read-only variable must be declared at the Module level while a constant is declared at the Procedure
(Method) level.
Because this calculation deals with currency (money), we shall use the currency format specifier
The advantage of using the currency format specifier is that it rounds the value to two decimal places
(money/currency is rounded to two decimal places) and it also includes the currency.
These are the Format Types in .NET
These are the Standard Numeric Format Strings
Let us format the result display in the console.
Please review the screenshots and the comments.
Comparison Operators are operators that compare two expressions.
They compare numeric values, strings, and objects.
They return a Boolean value (True or False) after the comparison.
The Boolean value represents the relationship of their values.
Let us discuss comparison operators.
Comparison Operator | Condition Tested | Examples |
---|---|---|
Comparing Numeric Values (Numbers) | ||
Equality: $=$ | Is the value of the first expression equal to the value of the second expression? |
25 = 25 ' True 25 = 7 ' False |
Inequality (Unequal): <> | Is the value of the first expression not equal to the value of the second expression? |
25 <> 25 ' False 25 <> 7 ' True |
Less than: < | Is the value of the first expression less than the value of the second expression? |
25 < 25 ' False 25 < 7 ' False |
Greater than: > | Is the value of the first expression greater than the value of the second expression? |
25 > 25 ' False 25 > 7 ' True |
Less than or equal to: <= | Is the value of the first expression less than or equal to the value of the second expression? |
25 <= 25 ' True 25 <= 7 ' False |
Greater than or equal to: >= | Is the value of the first expression greater than or equal to the value of the second expression? |
25 >= 25 ' True 25 >= 7 ' True |
Comparing Strings | ||
Equality: $=$ |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string sorted as the first character in the second string? If yes, is the second character in the first string sorted as the second character in the second string? If yes, is the third character in the first string sorted as the third characer in the second string? ...and so on |
"25" = "25" ' True because 2 = 2; 5 = 5 "255" = "25" ' False because "255" is a longer string "555" = "55" ' False because "555" is a longer string "251" = "253" ' False because 2 = 2; 5 = 5; but 1 is not equal to 3 "25" = "7" ' False because 2 is not equal to 7 |
Inequality (Unequal): <> |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string not sorted as the first character in the second string? If yes, is the second character in the first string not sorted as the second character in the second string? If yes, is the third character in the first string not sorted as the third characer in the second string? ...and so on |
"25" <> "25" ' False because 2 is not unequal to 2; 5 is not unequal to 5 "251" <> "253" 'True because 2 is not unequal to 2; 5 is not unequal to 5 but 1 is not equal to 3 "253" <> "789" ' True because 2 is not equal to 7 |
Less than: < |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string sorted before the first character in the second string? If yes, is the second character in the first string sorted before the second character in the second string? If yes, is the third character in the first string not sorted as the third characer in the second string? ...and so on |
"25" < "25" ' False because 2 is not less than 2 "25" < "7" ' True because 2 is less than 7 "25" < "154" ' False because 2 is greater than 1 |
Greater than: > |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string sorted after the first character in the second string? If yes, is the second character in the first string sorted after the second character in the second string? If yes, is the third character in the first string not sorted as the third characer in the second string? ...and so on |
"25" > "25" ' False because 2 is not greater than 2 "25" > "7" ' False because 2 is less than 7 "25" > "154" ' True because 2 is greater than 1 |
Less than or equal to: <= |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string sorted before, or sorted as the first character in the second string? If yes, is the second character in the first string sorted before, or sorted as the second character in the second string? If yes, is the third character in the first string not sorted as the third characer in the second string? ...and so on |
"25" <= "25" ' True because 2 is equal to 2, and 5 is equal to 5 "25" <= "7" ' True because 2 is less than 7 "25" <= "154" ' True because 2 is greater than 1 |
Greater than or equal to: >= |
Default sorting: Ascending order (from least to greatest) Is the first character in the first string sorted after, or sorted as the first character in the second string? If yes, is the second character in the first string sorted after, or sorted as the second character in the second string? If yes, is the third character in the first string not sorted as the third characer in the second string? ...and so on |
"25" >= "25" ' True because 2 is equal to 2, and 5 is equal to 5 "25" >= "7" ' False because 2 is less than 7 "25" >= "154" ' True because 2 is greater than 1 |
For the rest of the String comparisons, please review Module 4 For comparing objects, please review the Advanced Visual Basic course. Please see the implementation of these operators in Module 4 screenshots under Booleans. |
Detailed information on Logical operators
are on my website: www.samdomforpeace.com/Logic/logic.html
Logical operators compare Boolean expressions and return a Boolean result.
They consists of:
(A.) Unary Logical Operators: are operators that take one operand
(1.) Example is the Not operator.
The Not operator negates the Boolean expression.
If the Boolean expression is True, the Not operator makes it False.
If the Boolean expression is False, the Not operator makes it True.
(B.) Binary Logical Operators: are operators that take two operands.
They are:
(2.) The And operator
The And operator performs logical conjunction on two Boolean expressions.
It outputs True only when both operands are True and outputs False when either operand is False or when both operands
are False
(3.) The Or (Inclusive Or) operator
The Or operator performs logical disjunction (otherwise known as logical inclusion) on two Boolean
expressions.
It outputs True if either operand is True and outputs False only when both operands are False
(4.) The Xor (Exclusive Or) operator (Either Or but not both)
The Xor operator performs logical exclusion on two Boolean expressions.
It outputs True when either operand is True, outputs False when both operands are True, and also outputs False when both
operands are False.
Compare it to a ballroom with two doors that has switches on the wall close to both door ends.
When both switches are turned ON, the light is OFF. When both switches are turned OFF, the light is OFF.
When either switch is ON, the light is ON.
(C.) Short-Circuiting Logical Operators: are binary operators that does not evalaute the second operand on some conditions
based on the Boolean value of the first operand.
They are:
(5.) The AndAlso operator
We already know that for the And operator, if either Boolean expression is False; the Boolean result is False.
In that sense, if the first operand is False; the And operator results to False ragardless of the second operand.
So, there is no need evaluating the second operand if the first operand is False.
This is known as short-circuiting.
This is what the AndAlso does.
The AndAlso operator outputs False if the first operand is False because it does not see the need to evaluate the
second operand.
Student: Mr. C, but what happens if the first operand is True?
How would the AndAlso operator work?
Teacher: Very good question.
Short-circuiting will skip it.
That is the problem.
Short-circuiting improves performance only when we know that evaluating the other operand will not alter the result of the
logical operation.
In that sense, we shall not be using it. But we shall do some examples on the cases when there is no need to evaluate the
second operand.
(6.) The OrElse operator
This is another short-circuiting operator.
We already know that for the Or operator, if either Boolean expression is True; the Boolean result is True.
In that sense, if the first operand is True; the Or operator results to True ragardless of the second operand.
So, there is no need evaluating the second operand if the first operand is True.
The OrElse operator does it.
The OrElse operator outputs True if the first operand is True because it does not see the need to evaluate the
second operand.
Please see the implementation of these operators in Module 4 screenshots under Booleans.
One of the nice features of the Visual Basic.NET langauge is the Input/Output feature.
This feature is interactive.
You use this input/output feature in several applications.
A common application is an application that verifies one's identity by inputting the first name, last name, date of
birth, etc.
To use the Input/Output feature, the Console.ReadLine() method is used.
Remember we discussed the Console.ReadLine() method in Module $1$. Please review Module $1$
Console.ReadLine() method reads the next line of characters from the standard input stream.
It reads strings.
We also have:
Console.Read() method: This method reads the next character from the standard input stream.
Let us demonstrate the input/output feature with numbers so we see how it works.
Please review the screenshots and the comments.
Input/Output Feature: Example $1$
Let us solve Question $12$ on the Numbers
website.
Input/Output Feature: Example $2$
Let us do a real-world application for this example.
Onto the ...
Please review the BMI information on these two government websites [from the Center for Disease Control and Prevention (CDC) and the National Heart, Lung, and Blood Institute of the National Institutes of Health (NIH)]
About Adult BMI | Healthy Weight, Nutrition, and Physical Activity | CDC and
Calculate Your BMI - Standard BMI Calculator
As at today, the 3rd day of September, 2020; the BMI information on both websites are:
NIH website
Calculate Your BMI - Standard BMI Calculator
CDC website
About Adult BMI | Healthy Weight, Nutrition, and Physical Activity | CDC
$ BMI = \left(\dfrac{weight}{height * height}\right) * 703 \\[5ex] weight\:\:is\:\:in\:\:pounds (lb) \\[3ex] height\:\:is\:\:in\:\:inches (in) $
$ BMI = \left(\dfrac{weight}{height * height}\right) \\[5ex] weight\:\:is\:\:in\:\:kilograms (kg) \\[3ex] height\:\:is\:\:in\:\:meters (m) \\[3ex] $ If you need help with conversion of units, please review the Tables and Examples in Measurements and Units
Teacher: What do you notice in both websites?
Student: They both have the information on the BMI.
In addition, the CDC website has information for both Adult BMI and Child & Teen BMI among others.
The NIH website has recommendations among others.
Teacher: That is correct. What else?
Student: They have the BMI calculator.
Teacher: Did you notice any difference in the calculator on both websites?
Student: The NIH website has BMI calculator for both Standard and Metric versions.
The CDC website has the BMI calculator for only the Metric version.
Teacher: Did you notice any issue/concern about the BMI information?
Student: Not really. Why?
Teacher: So, this is what we are going to do.
We are going to develop the BMI calculator.
That calculator will calculate the BMI.
Then, we shall interpret that BMI, and make a recommendation.
.
The CDC website gave us the formula for calculating the BMI. So, we shall use it.
As you can see, our calculator would have to use conditional statements for the interpretation and recommendation.
But, here is the issue.
Student: Wait, I think I see the issue.
The issue is with the domains.
Teacher: Correct!
Anyone having a BMI between $18.5$ and $24.9$ both endpoints included has a Normal weight.
This is: Normal weight: [18.5, 24.9]. It is a closed interval (relate with Mathematics).
So, the Overweight range for the BMI should be the weight greater than $24.9$, (rather than beginning from $25$) and ending at $29.9$
For the Overweight range, the first endpoint is not included, but the second endpoint is included.
This is: Overweight: (24.9, 29.9]. It is a half-open half-closed interval (relate with Mathematics)
Teacher: Do you know why this would be a problem if the programmer does not fix these issues before developing the calculator?
Student: Yes. Because there would not be any interpretation for anyone whose BMI is between $24.9$ and $25$
But, I do see that the BMI information is for values rounded to one decimal place.
Teacher: That is correct.
And we shall develop our calculator to round to one decimal place.
But, it is important we fix the issues.
What if we do not want to round?
Look at the two examples on the CDC website. The BMI values were rounded to two decimal places.
If we developed our calculator to round to two decimal places with the information on those websites "as is"; then we would not have the interpretation and recommendation for those two examples ($24.98$ and $24.96$) because those values are greater than $24.9$ but less than $25$.
Student: That makes sense.
So, the last one: Obese should be BMI greater than $29.9$, rather than greater than $30$?
Teacher: That is correct.
We are going to apply what we learned so far.
We shall develop a console application and a desktop application for the Body Mass Index (BMI) calculator.
I do the console application.
You do the desktop application.
We are yet to cover Statements (covered in Module $5$). However, do not worry.
I explained my comments very well. You will understand the comments.
Please ask questions if you do not understand any of the comments.
We shall use part of Module $5$ (Decision-making statements) in the program.
Please review the screenshots and the comments.
(1.) The program should accept user inputs of:
(I.) First name
(II.) Last name
(III.) Weight
(IV. Height
(2.) The program should output the:
(A.) BMI value
(B.) Interpretation
(C.) Recommendation
(3.) The program should address user-input errors of non-positive numbers for the weight and the height.
Inform the user.
Then, exit the program. Do not allow the program to continue.
To exit the program, we use the command: Environment.Exit(0)
Student: I have several questions, Mr. C
Teacher: Please go ahead
Student: First Question: Why did you initialize those variables?
The interpretBMI and the adviceBMI...you initialized them to String.Empty
Teacher: Good question.
Assume we did not initialize them
We only defined them within the block of code: the If-Then Statement
Then, we want to print them/output them outside the block of code
The program "will not be happy"
Compare it to this scenario.
A student registered to attend a school.
We did not register the front office registration desk.
But we sent the student to a classroom and the classroom teacher registered that student.
The parents come, looking for their child.
Where will the parent go first?
Student: At the front desk of course
Teacher: Good.
The front desk will first keep a record of the student before sending the student to the class.
We have to first assign the string to something before we send it to the blocks of code, and then output it.
We cannot just declare it without an assignment, then send it to a block of code to be used within that block of
code only, and then want to output it outside the block of code.
Does it make sense?
Student: Yes, it does.
But what if we do not want to print the value outside the block of code?
What if we want to print the value inside each block of code where it is used?
Teacher: I am impressed by your questions.
Yes, we can do that.
But you know what that means...right?
Student: We have to write it each time for each of the conditional statement.
Teacher: That is correct.
Student: Second Question: Why did you underline the 0 on the console window?
....process exited with 0?
Teacher: Unless defined in the program otherwise; anytime you run a program and the program exited with 0,
it means that the program successfully exited.
0 basically lets you know that the program ended successfully.
Student: Third Question: how did you color the heading in the Console window?
Teacher: We can format (set foreground and background colors for) our results in the console window.
This is the List of the Console Log Formatting Commands
Console.ForegroundColor = ConsoleColor.Yellow command sets the foreground color of the text in the console to yellow.
Console.ResetColor() command resets it (ends the color).
It is important to reset it, else it will underline the entire text in the console.
We have done several console applications.
Now onto desktop applications.
Before we begin, let us make a note of an important concept: Property Names of the Toolbox Controls
Notice the three dots in this screenshot image (indicated by the arrow):
Whenever you notice something like that anywhere in your code, it is important to point your mouse at it and click the
Show potential fixes link:
Notice the issue was a naming rule violation. It is not a "big" issue hence those three dots.
It is not a warning. It is not an error. But it is a violation.
You do want to ensure your project is free of all violations (not just warnings and errors).
So, let us address that naming rule violation.
Going forward, we shall name each property of any toolbox control using Pascal casing.
Let us apply the knowledge we acquired in this module to develop a desktop application.
Which application comes to mind right away...a desktop application that deals with Numbers and Operators?
It's the Standard Calculator. Let's develop it. 😊
Please review the desktop applications we developed in previous modules beginning from Module $1$
Let us begin with the desktop calculator on your Windows PC/Laptop
Please see the screenshots
Let us develop the function buttons as seen in the red rectangle.
We are yet to cover Statements (covered in Module $5$). However, do not worry.
I explained the comments very well. You will understand the comments.
Please ask questions if you do not understand any of the comments.
We shall use part of Module 5 (Conditional statements) in the program.
Form1.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Standard Calculator © 2021 SamDom4Peace Designs (Sample)
BackColor property: Web: Purple
ForeColor property: Web: White
Font: property: Font: Times New Roman; Font Style: Regular; Size: 24
FormBorderStyle property: Fixed3D
MaximizeBox property: False
The MaximizeBox property is set to False if we do not want the user to maximize the application.
The reason is because we want the interface to have a consistent look.
The TextBox is a Windows control that:
(1.) Accepts user input.
It accepts only the string type by default. So, if we want to use numeric types say an integer; then we need to convert the
string to an integer using the Convert.ToInt32 method or the Int32.TryParse method.
The TextBox can also be used to display user input. It displays only strings by default.
So, if we want to use the TextBox to display a numeric type say a double; then we need to include it in a string interpolation
or use the ToString() method.
(2.) Provides MultiLine editing with vertical scroll bars.
To use this feature, we have to check the box: MultiLine when we drag the TextBox into the form.
The Label
is a Windows control that:
(1.) Provides descriptive text for a control.
(2.) is also used to display the program output.
It displays only strings by default.
So, if we want to use the Label to display a numeric type say a double; then we need to include it in a string interpolation
or use the ToString() method.
The AutoSize property needs to be set to False so the label can be expanded.
In addition, I prefer to set the BorderStyle property to Fixed3D.
The Button
is a Windows control that raises an event when a user clicks it (click event).
In other words, it performs an action when clicked.
Toolbox Controls | Property |
---|---|
Label: Adjust and Align |
AutoSize: False (do this first) BorderStyle: Fixed3D Text: Delete Label1 Adjust and Align again TextAlign: MiddleRight (Name): CalculatorLabel |
TextBox: Adjust and Align |
Text: $0$ (because we want $0$ to be the default) TextAlign: Right (because we want to align the $0$ to the right) (Name): CalculatorTextBox |
Button: Adjust and Align |
Text: $1/x$ ForeColor: Web: Black BackColor: Web: White (Name): ReciprocalButton |
Copy and Paste Button: Adjust and Align |
Text: $x^2$ (Name): SquareButton |
Copy and Paste Button: Adjust and Align |
Text: $\sqrt{x}$ (Name): SquareRootButton |
Copy and Paste Button: Adjust and Align |
Text: $\div$ (Name): DivideButton |
Copy and Paste all previous four Buttons: Adjust and Align Then, begin to work on each button. |
Text: $7$ (Name): SevenButton |
Button: Adjust and Align |
Text: $8$ (Name): EightButton |
Button: Adjust and Align |
Text: $9$ (Name): NineButton |
Button: Adjust and Align |
Text: $\times$ (Name): MultiplyButton |
Copy and Paste all previous four Buttons: Adjust and Align Then, begin to work on each button. |
Text: $4$ (Name): FourButton |
Button: Adjust and Align |
Text: $5$ (Name): FiveButton |
Button: Adjust and Align |
Text: $6$ (Name): SixButton |
Button: Adjust and Align |
Text: $-$ (Name): MinusButton |
Copy and Paste all previous four Buttons: Adjust and Align Then, begin to work on each button. |
Text: $1$ (Name): OneButton |
Button: Adjust and Align |
Text: $2$ (Name): TwoButton |
Button: Adjust and Align |
Text: $3$ (Name): ThreeButton |
Button: Adjust and Align |
Text: $+$ (Name): PlusButton |
Copy and Paste all previous four Buttons: Adjust and Align Then, begin to work on each button. |
Text: $+/-$ (Name): PlusMinusButton |
Button: Adjust and Align |
Text: $0$ (Name): ZeroButton |
Button: Adjust and Align |
Text: $.$ (Name): DecimalButton |
Button: Adjust and Align |
Text: $=$ (Name): EqualButton |
Copy and Paste Button: Adjust and Align |
Text: &Clear (Access key: C) (Name): ClearButton |
Copy and Paste Button: Adjust and Align |
Text: E&xit (Access key: x) (Name): ExitButton |
(1.) Double-click the $1/x$ button in the Design window.
This leads to the Code window
Scroll a little bit to the top, write the comments, and begin to...
(2.) Write the code.
Let us use a top-down approach.
Double-click each button in the Design window to open the Code window.
Then write the code for the event: what should happen when the user clicks the button?
Please review the screenshots.
Review the comments.
Design Area
Access keys: C for the Clear and x for the Exit button
Program Code
Run the Program
$\infty$ means Infinity
NaN means Not a Number
It is not a real number.
But it is an imaginary number.
It is covered under Complex Numbers in Algebra)
This calculator deals with only with real numbers.
$-\infty$ means Negative Infinity
Functionalities of the Calculator
(1.) For operation involving two numbers: the calculator works for any positive numbers.
(2.) For operation involving two numbers: the calculator works if the first number is negative.
(3.) For operation involving one number: the calculator works for any number.
(4.) For any operation: the user sees what he/she did.
(5.) Division of a number by zero is handled. The square root of a negative number is handled.
Limitations of the Calculator
(1.) For operation involving two numbers: the calculator does not work for two negative numbers.
(2.) The calculator computes one operation at a time. It does not perform multiple operations simultaneously.
Let us design another calcuator using more toolbox controls.
For this calculator:
(1.) We want two textboxes for user-input.
The two textboxes will receive user-input for two numbers (the operands).
Remember that textboxes accept only strings.
But we want them to accept numbers.
We shall define those numbers using the double data type (to accomodate decimals).
Then, we shall convert those numbers as strings so that the textboxes will accept them.
(2.) We want a ComboBox.
The ComboBox will contain a dropdown list of items: the operations.
We shall expand our list of operations. So, this calculator will be more of a scientific calculator.
I shall do some functions.
You do the rest of the functions (just as we did for the Standard Calculator).
We shall use an access key with the ComboBox.
(3.) We want four buttons: the Calculate, Clear Some, Clear All, and Exit buttons.
We shall use access keys with these buttons.
(4.) When we run our program, we want the cursor to be focused on the first textbox.
Then, we want the user to be able to use the Tab key on the keyboard to perform any operation without using a mouse.
This is an important software design concept to accommodate users with disabilities.
Access keys is one of the ways to work only with the keyboard keys.
Another way is the TabIndex Property.
Once the user enters the first number in the first textbox; move to the ComboBox and select an operation from the
dropdown list and press the Tab key; use the Tab to move to the second textbox (as applicable), enter the second number and
press the Tab key (as applicable); move to the Calculate button and hit the Enter key to get the result.
The TabIndex property controls that ability for the Tab to move in that order.
We shall set the TabIndex property of each toolbox control accordingly.
For operations that involve two numbers such as calculating the sum, difference and the like: we want it to be:
first number → operation → second number → calculate
For operations that involve only one number such as calculating the reciprocal, square root and the like: we want to
disable the second textbox so that the user would not enter a second number.
The TabIndex property contains a number that represents that order in which the toolbox controls are added to the form.
It determines the order in each toolbox control receives focus when the user presses the Tab key or uses an Access key
while an application is running.
The TabIndex property is zero-indexed. This means that the first one begins with a 0, the next one is a 1, the next is a 2
among others.
The TabIndex can be changed by:
(1.) Click the form: → View menu → the Tab Order or
(2.) Click each control and change the TabIndex property from the Properties menu.
It is important to note that some toolbox controls do not have a TabIndex property.
The user may decide to use the access key to do the calculation.
However, we want the user to be able to use only the Tab key and perform operations because the some users may not
remember access keys. Besides, any two programmers may decide to use different access keys for the same button.
If the user does ALT + C, it leads to the Calculate button and the calculation is done.
Alternatively, the user can decide to move the Tab key to the Calculate button and then press the ENTER key when the focus
is on the button. The calculation will also be done.
Either way is fine. However, the use of only the Tab key has the priority.
It is necessary to accommodate users by allowing users to perform operations with Tab keys especially when they
do not know the access keys.
Hence, the TabIndex property is important.
As we insert the toolboc controls in the form, we want to check the TabIndex property and ensure that they are in order.
To do so, it is imporant to arrange the toolbox controls in order.
Even if you do not arrange them in order initially, it is important to set the TabIndex property in the order you want the
tab to move for the user to run the application.
Recap:
Assume the user is working with only the keyboard (software design to accommodate users who cannot use the mouse)
(1.) When the user runs the application, the cursor focus should be in the first textbox waiting for user input.
The user enters a number and presses the tab key
(2.) The next focus should be the ComboBox waiting for the user to make a selection.
The user selects an operation.
If the operation involves only one number, the second textbox is disabled so the focus moves to the Calculate
button.
The command used to disable the textbox is: TextBox.Enabled = False
As you can see, to disable a TextBox; the Enabled property of the Textbox is set to the Boolean value: false
If the operation involves two numbers, the cursor focus moves to the second textbox waiting for the user to enter the
second number. The user enters the second number and presses the tab key.
The next focus would be the Calculate button.
The user presses the ENTER key and the calculation is done. The result is displayed in the label: ResultLabel.
(3.) The user presses the tab key and the focus should be the Clear Some button.
The user presses the ENTER key and the entries in the textboxes and the label are cleared.
(4.) The user presses the tab key and the focus should be the Clear All button.
The user presses the ENTER key and all entries (all items in the ComboBox) are cleared.
(5.) The user presses the tab key and the focus is the EXit button.
The user presses the ENTER key and the application is closed.
Form1.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Scientific Calculator © 2021 SamDom4Peace Designs (Sample)
BackColor property: Web: Green
ForeColor property: Web: White
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
FormBorderStyle property: Fixed3D
MaximizeBox property: False
We set the MaximizeBox property to False because we do not want the user to maximize the application.
We want the interface to have a consistent look.
Toolbox Controls | Property |
---|---|
Label: Adjust and Align |
Text: First Number: |
TextBox: Adjust and Align |
Text: TextAlign: Right (because we want to align the number to the right) (Name): FirstNumberTextBox TabIndex: 1 |
Copy the previous label: Adjust and Align Label: |
Text: Operation: |
ComboBox: Adjust and Align Please see the screenshots on how to insert the ComboBox |
Text: (Name): OperationComboBox TabIndex: 3 |
The items in the ComboBox are written that way for teaching purposes.
Reviewing those items, it is easy for you to see the operations that involve one number (first number only) and the
operations that involve two numbers (the first number and the second number)
Select the first label (click) and textbox (CTRL) Copy (CTRL + C) and Paste (CTRL + V) Label: Adjust and Align |
Text: Second Number: |
Select the first label (click) and textbox (CTRL) Copy (CTRL + C) and Paste (CTRL + V) TextBox: Adjust and Align |
(Name): SecondNumberTextBox TabIndex: 5 |
Select the first label (click) and textbox (CTRL) Copy (CTRL + C) and Paste (CTRL + V) Label: Adjust and Align |
Text: Result: |
Label: Adjust and Align |
AutoSize: False (do this first) Text: Delete label5 (Name): ResultLabel BackColor: Web: White BorderStyle: Fixed3D ForeColor: Web: Black |
Button: Adjust and Align |
Text: &Calculate (Access key: C) (Name): CalculateButton BackColor: Web: White ForeColor: Web: Black TabIndex: 8 |
Copy and Paste Button: Adjust and Align |
Text: Clear &Some (Access key: S) (Name): ClearSomeButton TabIndex: 9 |
Copy and Paste Button: Adjust and Align |
Text: Clear &All (Access key: A) (Name): ClearAllButton TabIndex: 10 |
Copy and Paste Button: Adjust and Align |
Text: E&xit (Access key: x) (Name): ExitButton TabIndex: 11 |
Select the four buttons and Format: Make Same Size: Both |
A ComboBox
is a combination of a TextBox and a ListBox.
(https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.combobox?view=net-5.0)
It enables the user to select items from the a list or enter a new value.
It is an object of the ComboBox class.
There are several properties of the ComboBox.
We shall discuss only one property in this module: the SelectedIndex
property.
The SelectedIndex property gets or sets the index of a selected item.
The ComboBox items are zero-indexed just like arrays.
This means that the first item has index: $0$, the second item has index $1$, and the third item has index $2$ among others.
The command used to specify a selected item in the ComboBox is: ComboBox.SelectedIndex == Index
Based on the items in the ComboBox in our program:
ComboBox Items | Index |
---|---|
Addition (+) [2 numbers] | $0$ |
Subtraction (-) [2 numbers] | $1$ |
Multiplication (*) [2 numbers] | $2$ |
Division (÷) [2 numbers] | $3$ |
Modulo (mod) [2 numbers] | $4$ |
Exponent (xⁿ) [2 numbers: x is the base; n is the exponent] | $5$ |
$Log_{x}n$ [2 numbers: x is the base; n is the number] | $6$ |
nth Root of x [2 numbers: x is the radicand; n is the index] | $7$ |
Reciprocal (1/x) [1 number] | $8$ |
Percent (%) [1 number] | $9$ |
Absolute Value (|x|) [1 number] | $10$ |
n! [1 number] | $11$ |
Tangent in DEG (tan) [1 number] | $12$ |
Sine in RAD (sin) [1 number] | $13$ |
Cosine in GRAD (cos) [1 number] | $14$ |
(1.) Double-click the Calculate button in the Design window.
This leads to the Code window
Scroll a little bit to the top, write the comments, and begin to...
(2.) Write the code.
What should happen when the user clicks the Calculate button?
Please review the screenshots.
Review the comments.
Design Area
Access keys: C for the Calculate, A for the Clear All, S for the Clear Some and
x for the Exit buttons
Program Code
Another approach to clearing texts in the Textbox is to use the Clear() method. For example: Textbox.Clear()
To clear all the items in a ComboBox besides the selected item, we also use the Clear() method.
For example: ComboBox.Items.Clear()
To clear the selected item in a ComboBox, we use the command: ComboBox.ResetText()
Student: Mr. C, you used the same name variable: result for different events.
Is that allowed?
Teacher: Very good observation.
Yes, we can do that.
Here is the reason: we used it within each event (each conditional statement).
We defined it as a class member variable. But remember we did not specify any value for it.
Hence, we are free to use it as local variables.
But you are very welcome to use different variables for the different events if you choose.
Notice that we did not have issues with the variables we defined in the class such as firstNumber
We can use those variables anywhere within the class.
Student: Another question.
You did not convert the variable: result back to a string. It is a double...right?
I thought we were supposed to convert it back to a string to display it in the label because the label accepts only
strings just like the textbox. Is that correct?
Teacher: That is correct.
We are supposed to convert it back to a string in order to display it in the label.
However, the String Interpolation takes care of that.
That is one of the several benefits of using String Interpolation in the formatting of the output.
Notice I have been using it since we discussed it in Module 1
Student: I guess those whitespaces are to format the display of the result?
Teacher: That is correct.
Run the Program
(1.) Visit my website on Numbers
(www.numbersandnotations.appspot.com/numbers.html)
Choose any applicable question and write a VB program to solve it.
Please make sure that the output of your program gives the same result as the solution of the
question on my website.
You may use Arithmetic Operators, Math Functions, or both.
(2.) Visit my website on Percent Applications
(www.fractions-decimals-percents.appspot.com/percentApplications.html)
Choose any applicable question and write a VB program to solve it.
Please make sure that the output of your program gives the same result as the solution of the
question on my website.
You may use Arithmetic Operators, Math Functions, or both.
(3.) Program to determine your age
***Because your age is a PII (Personal Identifiable Information), you may use a fictitious age.
However, you need to test it (privately) with your actual age to make sure it works.***
Develop a VB program to determine your age based on these instructions.
ONLY one variable is required.
(Hint: If only one variable is required, this implies that you need to use Compound
Assignment operators)
The user wants you to note that these instructions would only work for ages determined this
year, and wants you
to specify it in the program.
(a.) Pick an integer between $0$ and $10$ ($0$ and $10$ exclusive).
(b.) Multiply the integer by two.
(c.) Add five to the result.
(d.) Multiply the result by fifty.
(e.) If you already had your birthday this year, add the result to one thousand, seven hundred
and seventy-two.
If you have not had your birthday this year, add the result to one thousand, seven hundred
and seventy-one. (valid for 2022, adjust accordingly after 2022)
(f.) Subtract your four-digit birth year from the result.
Run the code and display the output.
Explain your result.
(4.) A client wants you to develop a program to calculate the age of his child.
The instruction for the previous question still applies to this question.
However, in this case; the program will give the instructions to the child, and the child will
respond.
This program is an Input/Output program.
Develop a VB program for this child.
(5.) Program to determine your date of birth.
***Because your date of birth is a PII (Personal Identifiable Information), you may use a
fictitious age. However, you need to test it (privately) with your actual age to make sure it
works.
Develop a VB program to determine your date of birth based on these instructions.***
ONLY one variable is required.
(Hint: If only one variable is required, this implies that you need to use Compound
Assignment operators).
(a.) Pick the integer that is your month of birth.
(b.) Multiply the integer by two hundred.
(c.) Add three hundred and eighty two to the result.
(d.) Divide the result by two.
(e.) Add your day of birth to the result.
(f.) Multiply the result by 100.
(g.) Add thirteen thousand, eight hundred and forty to the result.
(h.) Add the last two digits of your year of birth to the result.
(i.) Subtract thirty two thousand, nine hundred and forty from the result.
Run the code and display the output.
Explain your result.
(6.) A client wants you to develop a program to calculate the date of birth of her child.
The instructions for the previous question still applies to this question.
However, in this case; the program will give the instructions to the child, and the child will
respond.
This program is an Input/Output program.
Develop a VB program for this child.
(7.) Develop a Body Mass Index (BMI) desktop application using the United States System.
Test each condition just like we did in our example for the United States System.
Address user-input errors.
(8.) Develop a Body Mass Index (BMI) console application using the International System.
The formula is on the screenshot.
Test each condition just like we did in our example for the United States System.
Address user-input errors.
(9.) Develop a Body Mass Index (BMI) desktop application using the International System.
The formula is on the screenshot.
Test each condition just like we did for the United States System.
Address user-input errors.
Questions (10.) and (11.) are meant to prepare you for the Midterm Project.
For Questions (10.) and (11.)
Develop a VB program that meets these requirements.
(I.) Consider any concept/scenario that uses conditional statements.
It will be great if you find a real-world application. However, you can make up your own.
If you decide to make up your own, please explain the scenario and the conditions well.
If you use a real-world application, please cite your source(s) accordingly. Explain the scenario and the conditions well.
Use at least two (two or more) different conditions.
The BMI Calculator has four different conditions.
But, please use any application that has at least two different conditions.
(II.) Accept user input(s).
(III.) Address user input errors.
(IV.) Test your program and display the result/output for each condition.
(V.) Test your program for user-input errors.
(VI.) Submit all the screenshots accordingly.
(10.) Develop a console application for your concept.
(11.) Develop a desktop application for your concept.
For those who do not mind messing around with several languages at the same time
Student: Excuse me, Mr. C
This course is only for VB.NET
What do you mean?
Teacher: You are correct.
But, these subsequent questions are not for everyone.
That is the reason I am putting them at the end.
I have a question for you.
Have you ever seen any IT/Computer Science position that requires the knowledge of only one programming language?
Student: I have not checked, Sir.
Teacher: If you intend to be in the IT/Programming field for the long run, at least four (four or more)
languages are required.
If you look for IT positions at Indeed.com or other career/job websites, you will realize what I mean.
Search for visual basic programmer, you might be surprised that even for entry level positions
for a Visual Basic Programmer; they require you to have a working knowledge of several other programming languages.
Mr. C is preparing you for that...if you intend to work in the programming field for a long time.
Besides, this is a critical thinking approach.
I am required to develop and promote critical thinking questions for my students.
A programmer is basically a problem-solver irrespective of the programming language used to solve the problem.
Yes, we are working with Visual Basic.
However, if you find out that C# would be better in solving a particular problem in your workplace,
then you need to use C# unless your employer says otherwise.
The knowledge of several languages is a good asset. It makes you highly valuable.
Further, anyone who attempts any of the subsequent questions will still have to write the program in VB and get the same
result.
The questions and solutions are in another language.
But the student will have to write the program in VB and come up with the same solution. So, we are still on track.
It is critical thinking...multiple approaches to solving a question.
Be it as it may, these subsequent questions are not required.
It is okay even if you do not look at them. 😊
C# Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) C# Basic Declarations and Expressions : Exercises, Practice, Solution
(B.) C# Basic Algorithm: Exercises, Practice, Solution
(C.) C# Data Types : Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(12.) Please focus only on Questions that deals with Numbers and Operators.
Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
Java Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) Java Math: Exercises, Practice, Solution
(B.) Java Basic Programming - Part 1: Exercises, Practice, Solution
(C.) Java Basic Programming - Part 2: Exercises, Practice, Solution
(D.) Java Data Types: Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(13.) Please focus only on Questions that deals with Numbers and Operators.
Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
C++ Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) C++ Basic: Exercises, Practice, Solution
(B.) C++ Basic Algorithm: Exercises, Practice, Solution
(C.) C++ Math: Exercises, Practice, Solution
(D.) C++ Numbers: Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(14.) Please focus only on Questions that deals with Numbers and Operators.
Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
(1.) Provide any of these if it is lacking in any DB post that solved any question in the
Assess tab of this module: Well-written comments; another approach/method to solving the
question; any additional relevant details; etc.
For Questions $(3.)$ and $(4.)$ in the Substantive Posts
Student: Mr. C, the instructions in Questions (3.) and (4.) are incorrect.
The result is not my age.
How can you ask us to write a program that does not work?
(2.) Explain the result to the Student. (Answer this question only if any of your colleagues made a similar statement in the initial post.)
(3.) The Student wants only his/her age to be the result.
Without modifying any of the instructions (but using all of them) and one more instruction, extend the
program to display only the Student's age.
What is the extra instruction that you would include to work for all ages?
Write it. Run it. Submit clear screenshot(s).
For Questions $(5.)$ and $(6.)$ in the Substantive Posts
Student: Mr. C, I want the date of birth to display properly.
Teacher: Use a delimiter.
Student: What is a delimiter?
Teacher: A delimiter is a sequence of chararcters that specifies limits/boundaries of
characters in a text, expression, word, etc.
A good example is the forward slash that you can use to separate that DOB in the form of: mm/dd/yyyy.
The forward slash is a delimiter.
Another example is the pipe delimiter: mm | dd | yyyy.
Another example is the hyphen delimiter: mm-dd-yyyy.
Student: Okay, how do I display the result in that format?
(4.) Explain how you would display the result for the Student.
Write the code. Run it. Submit clear screenshot(s).
(5.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(6.) Other substantive responses.
This is the desktop application of the Standard Calculator
(1.) Please review the Functionalities of the Calculator and the Limitations of the Calculator as explained in
the Learn tab.
Maintain all the functionalities of the calculator.
Address any or all the limitations.
Submit some clear screenshots that maintains the functionalities.
Submit clear screenshots that addressed the limitations.
You may use my code if you wish
(in this case because you are extending the functionalities of my program) and/or your code.
(2.) The first standard calculator we programmed did not contain all the functions.
This is what we did.
This is what you should do.
Develop a calculator that contains all the functions enclosed with a red border besides the plus-minus button: $+/-$
In other words, the plus-minus button is not required.
However, all other functions enclosed within the red border are required.
Please note:
The C function is the Clear function. It deletes everything.
It clears the first number, operation, and the second number.
The CE function is the Clear Entries function. It deletes "some" things.
It clears only the second number. You can replace the second number and continue with the calculation.
It does not clear everything.
This is used when the entire calculation does not need to be deleted.
The BS (backspace) function (you may use alt+174 key if you prefer) is the backspace function.
It deletes part of the first number or the second number.
This is also used when the entire calculation does not need to be deleted.
Let us look at an example. You may test it.
$
\underline{Example} \\[3ex]
25 + 32 \\[3ex]
\color{red}{C} \;\; deletes\;\;everything \\[3ex]
\color{red}{CE} \;\; deletes\;\;only\;\;32 \\[3ex]
\color{red}{BS} \;\; deletes\;\;only\;\;2 \\[3ex]
$
This is the desktop application of the Scientific Calculator
(3.) We developed the scientific calculator.
However, it does not contain all the functions.
Develop the scientific calculator GUI that contains all the functions.
You may extend my application by adding the missing functions if you wish, or you may develop your own with all the functions.
You may use my code if you wish
(in this case because you are extending the functionalities of my program) and/or your code.
(4.) Develop a console application for an extension of the Body Mass Index (BMI) application example.
We did the application for the United States System (Customary System).
Extend the application by developing the calculator for the International System (Metric System).
The formula is on the screenshot.
Ask the user which system he/she wants to use to calculate the BMI.
Based on the user's selection, display the appropriate units for the weight and the height, as well as the output.
Test all the conditions for both systems.
(5.) Develop a desktop application for an extension of the Body Mass Index (BMI) application example.
We did the application for the United States System (Customary System).
Extend the application by developing the calculator for the International System (Metric System).
The formula is on the screenshot.
Ask the user which system he/she wants to use to calculate the BMI.
Your desktop application should have the dropdown list for both systems, but should be null be default (using a ComboBox)
Alternatively, you may choose to use Radio Buttons.
Based on the user's selection, display the appropriate units for the weight and the height, as well as the output.
Test all the conditions for both systems.
Question (6.) is meant to prepare you for the Midterm Project.
Develop a VB program that meets these requirements.
(I.) Consider any concept/scenario that uses conditional statements.
A real-world application is required. You may not make up your own.
Please cite your source(s) accordingly. Explain the scenario and the conditions well.
Use at least two (two or more) different conditions.
The BMI Calculator has four different conditions.
But, please use any application that has at least two different conditions.
(II.) Accept user input(s).
(III.) Address user input errors.
(IV.) Test your program and display the result/output for each condition.
(V.) Test your program for user-input errors.
(VI.) Submit all the screenshots accordingly.
(6.) Develop a console application and a desktop application for your concept.
Textbook Questions: Desktop Applications
(7.) Question $10$ on Page $166$
(8.) Question $6$ on Page $177$
(9.) Question $8$ on Page $178$
(10.) Question $10$ on Page $178$
character, string, Boolean, date, time, Option keyword, Option Compare statement, Option Explicit statement, Option Infer statement, Option Strict statement, bool, concatenator operator, string literal, empty string, date, time, function, argument, comparands, dot member access operator,
Students will:
(1.) Discuss the Option Compare statement.
(2.) Discuss the VB string data type.
(3.) Discuss the VB Boolean data type.
(4.) Discuss Date and Time in VB.
(5.) Write programs that involves the String data type.
(6.) Write programs that involves the Boolean data type.
(7.) Write programs that involves Date and Time.
(1.) Textbook Chapter
(2.) Strings in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/strings/)
(3.) String Functions in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/string-functions)
(4.) Date Data Type in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/date-data-type)
(5.) DateAndTime Class in VB.NET by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.dateandtime?view=net-5.0)
(6.) System.String Class in .NET (VB and C#) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/system.string?view=net-5.0)
Scroll down till you see Methods
(7.) DateTime Struct by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0)
Scroll down till you see Methods
(8.) Dates, Times, and Time Zones by Microsoft
(https://docs.microsoft.com/en-us/dotnet/standard/datetime/)
Focus on TimeZoneInfo and DateTimeOffset only (not TimeZone)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(9.) Type Visual Basic Strings and/or Visual Basic Booleans and/or Visual Basic Date and Time in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(10.) Type Visual Basic Strings and/or Visual Basic Booleans and/or Visual Basic Date and Time in the search bar and view/read the results.
(11.) The Option <keyword> Statement by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/option-keyword-statement)
A String is a sequence of ordered characters.
It is built out of characters.
It is enclosed in matching double quotation marks.
The Option <keyword> Statement introduces that specifies a compiler option that applies to the entire source file.
It controls whether:
(1.) strings should be compared as text or as binary quantities ...Option Compare
(2.) all variables must be explicitly declared or whether to allow implicit declarations of variables ...Option Explicit
(3.) to allow the use of local type inference in declaring variables ...Option Infer
(4.) narrowing type conversions must be explicit ...Option Strict
We shall only focus on the Option Compare statement in this module.
Option Compare statement: declares the default comparison method to use when comparing strings.
It has two modes of comparisons: Binary and Text
This statement is optional. However, when not declared; the binary mode is the default mode.
The syntax for declaring it is Option Compare { Binary | Text }
The Binary comparison results in string comparisons based on the sorting derived from the internal binary
representations of the characters.
It is useful for comparing strings that contain characters that should not be interpreted as text.
It is also useful for comparing case-sensitive strings.
For example: in a binary sort order: $C \lt D \lt S \lt c \lt d \lt s$
It is the default mode for comparing strings.
The Text comparison results in string comparisons based on a case-insensitive text sort order by the user's local
system.
It is is useful for comparing strings that contain all text characters, case-insensitive strings, and closely related letters.
For example: in a text sort order: $(C = c) \lt (D = d) \lt (S = s)$
In Module 3, we compared some strings using the Comparison operator.
As discussed in Module 3, comparison operators return a Boolean value (True or False) after the comparison.
We also stated that we shall discuss the rest of string comparisons in this module.
Let us compare strings based on the Comparison operator and the Option Compare statement
Please review the screenshots and the comments.
No Option Compare Statement
Option Compare Statement: Binary Comparison
Option Compare Statement: Binary Comparison
The StrComp function:
(1.) compares two strings according to the sort used in the Option Compare statement (Binary and Text comparisons)
(2.) returns an integer (rather than a Boolean value).
The integer values are: $0$ if the two strings are equal; $1$ if the first string is greater than the second string; and
$-1$ if the first string is smaller than the second string.
As you can see, this is limited in functionality compared to the Comparison operators.
(3.) "typically" accepts three arguments: the first argument is the first string; the second argument is the second string;
and the third argument is the method of comparison: (binary or text)
If you only use two arguments (the first and second strings), then the method of comparison will be binary comparison by
default.
Let us demonstrate some examples.
StrComp Function
The String.Compare method:
(1.) compares two strings according to the lexical relationship between the two comparands.
It uses the Binary comparison.
(2.) returns an integer that indicates their ralative position in the sort order.
The integer values are: $0$ if the two strings occur in the same position in the sort order;
$-1$ if the first string precedes the second string in the sort order; and
$1$ if the first string succeeds the second string in the sort order.
As you can see, this is also limited in functionality compared to the Comparison operators.
(3.) can accept two arguments: the first argument is the first string and the second argument is the second string
Let us demonstrate some examples.
String.Compare Method
The Like operator is used to compare a string against a pattern.
It returns a Boolean value.
The syntax is: result = string Like pattern
The result is the Boolean value. It is the result of the comparison.
...
There are many String built-in functions (System methods).
We have done two examples: the StrComp function from Part 1 and the String.Compare method from Part 2.
Please review the rest of the functions including the examples of the implementation of each function.
(1.) VB String Methods: Part 1 (Examples are written in VB) Less work
Please review the:
String Functions in Visual Basic
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/string-functions)
We are not done. We still have some more. 😊
(2.) .NET (VB and C#) String Methods: Part 2 (Examples are written in C#) A little extra work because you need to write in VB
Please review the:
System.String Class in .NET (VB and C#) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/system.string?view=net-5.0)
Scroll down till you see Methods
Review the methods.
Teacher: What are you looking at?
You already know.
Student tries to hide it.
Teacher: I want to ask you something.
Look at it.
Please turn it off...remember the course syllabus.
Before you turn it off, do you see two numbers in the Power off button?
Student: Numbers?
I do not see numbers.
It's an icon.
Teacher: Yes, they are numbers.
The numbers are: $0$ and $1$
$1$ is inside the $0$ in most devices.
Student: Interesting.
Teacher: $0$ represents OFF
$1$ represents ON
You see these two numbers in almost all electronic devices (tablets, smartphones, computers) including some
electric switches.
In Logic, $0$ represents FALSE
$1$ represents TRUE
We use true and false Boolean values in Statements including conditional statements and
iterative statements. We shall cover Statements in the next module.
The use of these two numbers: $0$ and $1$ in Mathematics and Computer Science to repesent FALSE and
TRUE values is known as Boolean Algebra
It was developed by George Boole, an English mathematician/philospher/logician.
We can also use these Boolean numbers $0$ and $1$ to represent choices/options of NO and YES
A Boolean is a fundamental data type in VB that:
(1.) is declared with the keyword: Boolean
(2.) can represent only one of two states: True or False
(3.) gives an output of only one of two values: True or False
(4.) is used for comparison (in comparison operators and logical operators) to compare expressions.
(5.) is used in statements (conditional statements and iterative statements) to make decisions.
A Boolean Expression is an expression that returns a Boolean value.
Let us demonstrate some examples of the use of Booleans.
Booleans: Example 1
Booleans: Example 2
Date and time stamps are needed for: transactions, receipts, appointments, agreements, events, rules/laws, and
tickets (by cops and troopers) among others.
Besides, we shall use the date and time functions in the midterm project.
Notable Notes on VB Date and Time
(1.) Date is a data type (Value Type) in .NET standard (C# and VB) declared as DateTime
(2.) It covers the date and time range from: 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999
(3.) It is an object of the DateTime Structure.
(4.) It has several constructors, properties, methods, and operators.
If you did not understand Numbers (4.) and (5.), do not worry.
I shall explain more in the comments in the screenshots.
(5.) For all arithmetic operations (especially Addition and Subtraction operations) involving Date and Time, please use
only the built-in operators.
This is important to avoid getting errors (especially errors of undercounting or overcounting by 1, 0.1, 0.001)
The built-in operators are: .Add, .Subtract, etc.
Do not use the "usual" arithmetic operators.
This is what I mean.
For example: to determine the number of days of the sum of two dates:
Do: example1.Date.Add(example2.Date).Days;
Do Not: (example1.Date + example2.Date).Days;
For example: to determine the number of days of the difference between two dates:
Do: example1.Date.Subtract(example2.Date).Days;
Do Not: (example1.Date - example2.Date).Days;
Before we continue, let us review the format specifiers for displaying date and time in .NET (VB and C#)
Format Specifier | Description | Example for the U.S (en-US) |
---|---|---|
"d" | Short date pattern | 3/1/2021 |
"D" | Long date pattern | Monday, March 1, 2021 |
"f" | Full date/time pattern (short time) | Monday, March 1, 2021 12:30 PM |
"F" | Full date/time pattern (long time) | Monday, March 1, 2021 12:30:40 PM |
"g" | General date/time pattern (short time) | 3/1/2021 12:30 PM |
"G" | General date/time pattern (long time) | 3/1/2021 12:30:45 PM |
"M", "m" | Month/day pattern | March 1 |
"t" | Short time pattern | 12:30 PM |
"T" | Long time pattern | 12:30:45 PM |
"O", "o" | Round-trip date/time pattern | 2021-03-01T12:45:30.0000000-07:00 |
"R", "r" | RFC1123 pattern | Monday, 1 Mar 2021 12:30:45 GMT |
"s" | Sortable date/time pattern | 2021-03-01T12:30:45 |
"u" | Universal sortable date/time pattern | 2021-03-01 12:30:45Z |
"U" | Universal full date/time pattern | Monday, March 1, 2021 12:30:45 PM |
"Y", "y" | Year month pattern | March 2021 |
My Preferred Approach
I think this is the easiest approach.
(1.) Declare a String variable for the Full date/time pattern (long time)
For example: Dim currentDateTime As String = Now
(2.) To get only the date; use the code: currentDateTime.ToLongDateString()
(3.) To get only the time; use the code: currentDateTime.ToLongTimeString()
Or if you really like writing short codes (short form):
(1.) Dim currentDate As String = Now.ToLongDateString()
(2.) Dim currentTime As String = Now.ToLongTimeString()
Alternatively:
(1.) Begin by using the Full date/time pattern (long time)
Declare a Date variable to store the current date and time using the Full date/time pattern (long time)
For example: Dim currentDateTime As Date = Now
(2.) To get only the date; use the code within a String Interpolation: currentDateTime.ToLongDateString()
(3.) To get only the time; use the code within a String Interpolation: currentDateTime.ToLongTimeString()
Please see the implementation of this approach in the screenshots for the Birthday Application.
There are several date/time format methods that you can use with that variable.
Just type the variable and press the dot access member operator (the decimal point button on your keyboard) and
start reviewing the list of methods you can use.
You can also press the dot access member operator and press "T" (ToString methods) so you can see more methods.
Have fun exploring 😊
There are several approaches to handling dates and times in VB
Let us discuss some of them.
As at today: 03/01/2021; Kent State University has 8 Ohio campuses, several other U.S campsuses, and four campuses outside
the United States otherwise known as Kent State Worldwide.
Kent State Worldwide consists of Kent State in Florence, Italy; Geneva, Switzerland; New Delhi, India; and Beijing, China.
Mr. C wants to greet all his students in the United States and Worldwide.
He wants to great them in their local dates and times.
He would kindly ask you, his student (please check out one of the Questions in the Assess tab) to teach him the greeting in your language.
But his work right now is to display the Full date/time pattern (long time) of each country: United States, Italy,
Switzerland, India, and China.
Because we shall be working with foreign countries, it is necessary to include: Imports System.Globalization namespace
To get the current local date and time (date and time according to the user's computer system), the syntax is:
Dim currentDateTime As Date = Now
To get the local date and time of the user (say in the United States), the syntax is:
Dim dateTimeUSA = currentDateTime.ToString("F", CultureInfo.CreateSpecificCulture("en-US"))
where:
USA is the country (you can replace with your country)
dateTimeUSA is the variable name (you can use any appropriate name you prefer)
"F" is the format specifier for the Full date/time pattern (long time) (you can use any format specifier you like)
CultureInfo.CreateSpecificCulture("en-US") is the System command/code for displaying the full date and time in United States English language.
The specific culture is en-US
en is English Language
US is the United States
Just as: CultureInfo.CreateSpecificCulture("es-MX") is the code to display the full date and time in Mexican Spanish Language.
The specific culture is es-MX
es is Spanish Language
MX is Mexico
So, the command follows the syntax:
CultureInfo.CreateSpecificCulture("specific culture")
This is the List of Countries, Languages, and Specific Culture for Displaying Date and Time
(https://www.samdomforpeace.com/References/ASCII.html#specificCulture)
But, there is an issue.
The issue is displaying the current times in other countries.
The specific culture works for displaying the dates and times in the languages (several languages) of different countries as
applicable
However, we still need to display the actual times (not the local user's time) for any country as applicable
Moreover, depending on the time of the day in each country, the dates might be incorrect as well.
In other words, we want to greet each Kent State University student according to his/her country's time/time zone (not according to my time/time zone)
We want to display the current date and time of each country that has Kent State University campus.
So, we need the time zone names and IDs of different countries
As at today: 03/05/2021 the time zone names and IDs of several countries in .NET are:
Names and IDs of Time Zones for Different Countries
Note that these time zone IDs should be entered as strings.
If a country is not listed, then we will need to find the UTC (Universal Time Coordinated) and the offset
as applicable.
Then, we look up any country with the same UTC and offset that is listed, and use that country.
How?
Bing or Google "time zone for country and look for the UTC time zone of the country that is mot listed.
If it is UTC+4, then find an applicable country that has UTC+04:00 and use that country.
Alternatively, contact Microsoft and ask them to include your country/city/county/province/region.
Say we want to display the current date and time in Mexico City, we look up the time zone name and ID:
Guadalajara, Mexico City, Monterrey => Central Standard Time (Mexico)
We convert the local user's date and time (local user is in the United State) using the code:
Dim dateTimeMEX = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(currentDateTime, destinationTimeZoneId:= "Central Standard Time (Mexico)")
Then, we use the specific culture to get the date and time in Mexican Spanish
Dim dateTimeMexico = dateTimeMEX.ToString("F", CultureInfo.CreateSpecificCulture("es-MX"))
Please review the screenshots and the comments.
Date and Time: Example 1: Current Date and Time in Different Countries
Student: What if we want to display the date and time in several states across the United States?
Our students come from all 50 states of the United States as well as the United States territories.
And you know there are different time zones in the United States.
How do we display the current date and time in those states in their respective time zones?
Teacher: Very good question.
In that case, we have to get the current date and time of the user
Dim currentDateTime As Date = Now
Then, we use the specific culture of each state to get the current date and time in that state.
For example; say we want the current date and time in the State of Ohio
The specific culture for the State of Ohio is en-OH
The code will then be:
Dim dateTimeOhio = currentDateTime.ToString("F", CultureInfo.CreateSpecificCulture("en-OH"))
This is the List of the States and Territories of the United States for Displaying Date and Time
(https://www.samdomforpeace.com/References/ASCII.html#specificCultureUS)
Student: So, we do not use the TimeZoneInfo class like we did for foreign countries?
Teacher: We do not.
Because it is the U.S.A 😊
But, we can if we want to. We just have to find the appropriate destination ID
But it is much simpler to just use the specific culture for the date and time for the states and territories of the
United States.
Let's develop another date and time function application.
What are some of your memorable events? dates for those events?
Student: Birthday, Christmas...I'm always looking forward to it
Teacher: Let's write a program in that regard.
I shall use my birthday as an example.
Let us calculate how many days there are until my birthday.
We shall begin with a console application.
Then we shall develop a desktop application and explore more toolbox controls.
An interesting toolbox control to explore is the Timer.
Have you noticed those websites where you see a timer that displays a countdown of the times: days:hours:minutes:seconds
to a particular event?
Student: Yes, I have.
Teacher: Cool. So, we shall explore that control and some other controls for the GUI.
As at today: 03/02/2021, my birthday is yet to occur. However, it is important to add a functionality to the program to display a
message to the user if the user's birthday has already occurred prior to today.
Student: I guess we shall ask the user to enter the birthday?
Teacher: Yes. Let's use an Input/Output feature to make it interactive.
The program will ask the user to enter the birth year, birth month, and birth day.
If the birthday has already occurred, inform the user accordingly. Then, display a positive message informing the user
that we look forward to his/her next "age" birthday.
If the birthday is yet to occur, display the number of days remaining until the birthday.
If the user's birthday is today, we shall greet the user with a HAPPY BIRTHDAY greeting.
This will require a conditional statement.
Student: You know Mr. C, we have been using Statements since Module 3 when we are supposed to cover it in
Module 5.
Teacher: That is correct. It goes to show how important they are in programming.
It is okay to introduce you to them so you get familiar with using them.
We shall cover them in detail in Module 5. It is a broad topic.
Please review the screenshots and the comments.
Date and Time: Example 2: Birthday Application
Let us develop a desktop application of the Birthday app.
We are gradually learning these toolbox controls as we make progress in the course.
We shall work with two additional controls in this section: the MonthCalendar control and the Timer control
The MonthCalendar Control allows us to select a date from a calendar.
(https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/monthcalendar-control-windows-forms?view=netframeworkdesktop-4.8)
According to Microsoft: the Windows Forms MonthCalendar control presents an intuitive graphical interface for users to view
and set date information.
The control displays a grid containing the numbered days of the month, arranged in columns underneath the days of the week.
You can select a different month by clicking the arrow buttons on either side of the month caption.
The additional control we shall use is the Timer control.
The Timer Control
is a control that determines how an application responds after a certain amount of time passes.
(https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-timer)
It is an object of the Timer Class
(https://docs.microsoft.com/en-us/dotnet/api/system.timers.timer?view=net-5.0)
Please review the desktop applications we developed in previous modules.
Form1.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Birthday App © 2021 SamDom4Peace Designs (Sample)
BackColor property: Web: Yellow
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
FormBorderStyle property: Fixed3D
MaximizeBox property: False
The MaximizeBox property is set to False if we do not want the user to maximize the application.
The reason is because we want the interface to have a consistent look.
Toolbox Controls | Property |
---|---|
MonthCalendar: Adjust and Align | (Name): BirthDateMonthCalendar |
Button: Adjust and Align |
Text: &Birthday Message BackColor: Web: White (Name): BirthdayButton Cursor: Hand |
Copy and Paste Button: Adjust and Align |
Text: E&xit (Name): ExitButton |
RichTextBox: Adjust and Align | (Name): MessageRichTextBox |
Label: Adjust and Align |
AutoSize: False Set this property first Text: Delete label1 and write Days, Hours:Minutes:Seconds (Name): TimerLabel TextAlign: MiddleCenter Font: Font: Times New Roman; Font Style: Regular; Size: 48 |
Timer: Adjust and Align |
Enabled: True Interval: 1000 The interval is the frequency of elapsed events in milliseconds We set it to 1000 because 1000 millisecond = 1 second (Name): BirthdayTimer |
Design Area
Access keys: B for the Birthday Mesage button and x for the Exit button
When the form loads, we do not want to see the label that has the timer
When the user's birthday is today, we do not want to see the label that has the timer.
When the user already had his/her birthday this year, we do not want to see the label that has the timer.
When the user is yet to have his/her birthday this year, we want to see how many days, how many hours, how many minutes,
and how many seconds until the user's birthday this year.
(1.) Double-click any empty space on the form in the Design window.
This leads to the Code window
Scroll a little bit to the top, write the comments, and begin to...
(2.) Write the code.
Let us use a top-down approach.
Double-click each button in the Design window to open the Code window.
Then write the code for the event: what should happen when the user clicks the button?
Please review the screenshots.
Review the comments.
Program Code
Run the Program
Student: I have several questions.
Teacher: Please go ahead.
Student: Line #148 in the code: Space(4), what is it?
Teacher: It represents four spaces.
To add a whitespace in VB, we use the Space function.
The Space function
has an argument that is an integer.
(https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.strings.space?view=net-5.0)
The integer represents the number of whitespaces that you want
to add.
In the Space(4), we added four spaces between the days and the time in hh:mm:ss
Student: The second result: which is correct: 109 days until your birthday versus 108 days, 6 hours,
34 minutes, and 51 seconds?
Teacher: What do you think?
Which one is more accurate?
Student: The second one I guess.
Teacher: Yes, the second one is more accurate.
The first one is rounded (an estimate)
If you do a quick seearch on Bing or Google for: how many days until Christmas, you will see the first one
The second one is accurate.
Those are the results from two different websites.
Student: My next question deals with the same Line #148 in the code
I guess that goes back to the second question.
Teacher: That is correct.
Using time.days (time from the Timespan data type) is more accurate that using daysBirthday
(days from the difference of the DateTime data type variables)
Student: The next question: You basically used the same code you wrote for the Button_click event for the
Timer_Tick event?
Is there not a way to reuse codes without having to copy and paste each time?
Teacher: Very good observation and very good question.
I did it because we are yet to cover Functions
Of course, one of the advantages of functions (both system-defined functions and user-defined functions) is for code reusability.
I would have used a user-defined function for the application had we covered Functions before now.
You may use strings not written in English language. However, if you use any language other than English language,
please make sure you translate it. Your colleagues and I need to understand any language you use.
Insensitive words or any word deemed inappropriate to any race, gender, religion, and national origin among others are
unacceptable. Any violation will not yield any point.
If you are not sure of the words/string to use, please contact me first.
Remember DB 3 Requirement. There are enough functions for everyone. If all the functions are done, please
attempt another question.
VB String Methods: Part 1 (Examples are written in VB) Less work
Please review the:
String Functions in Visual Basic
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/string-functions)
(1.) Pick any four methods besides the ones I discussed
Write the code examples for each method and implement each of them.
Run your codes.
Display the results.
.NET (VB and C#) String Methods: Part 2 (Examples are written in C#) A little extra work because you need to write in VB
Please review the:
System.String Class in .NET (VB and C#) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/system.string?view=net-5.0)
Scroll down till you see Methods
(2.) Pick any four methods besides the ones I discussed
Write the code examples for each method and implement each of them.
Run your codes.
Display the results.
DateTime Structure
Please review the:
DateTime Struct by Microsoft
(https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0)
Scroll down till you see Methods
(3.) Pick any four methods besides the ones I discussed
Write the code examples for each method and implement each of them.
Run your codes.
Display the results.
(4.) Please review the Date and Time example in this module.
Our students come from the entire 50 states of the United States and its territories.
However, the United States has different time zones.
Find out/browse/learn/discover the different time zones in the United States and its territories as seen in the
The Official U.S. Time (https://time.gov/) according to the
National Institute of Standards and Technology
Include those time zones in your comments.
Display the current date and time for each time zone.
Verify your answer with the times and time zones on that website.
For those who do not mind messing around with several languages at the same time
Student: Excuse me, Mr. C
This course is only for VB.NET
What do you mean?
Teacher: You are correct.
But, these subsequent questions are not for everyone.
That is the reason I am putting them at the end.
I have a question for you.
Have you ever seen any IT/Computer Science position that requires the knowledge of only one programming language?
Student: I have not checked, Sir.
Teacher: If you intend to be in the IT/Programming field for the long run, at least four (four or more)
languages are required.
If you look for IT positions at Indeed.com or other career/job websites, you will realize what I mean.
Search for visual basic programmer, you might be surprised that even for entry level positions
for a Visual Basic Programmer; they require you to have a working knowledge of several other programming languages.
Mr. C is preparing you for that...if you intend to work in the programming field for a long time.
Besides, this is a critical thinking approach.
I am required to develop and promote critical thinking questions for my students.
A programmer is basically a problem-solver irrespective of the programming language used to solve the problem.
Yes, we are working with Visual Basic.
However, if you find out that C# would be better in solving a particular problem in your workplace,
then you need to use C# unless your employer says otherwise.
The knowledge of several languages is a good asset. It makes you highly valuable.
Further, anyone who attempts any of the subsequent questions will still have to write the program in VB and get the same
result.
The questions and solutions are in another language.
But the student will have to write the program in VB and come up with the same solution. So, we are still on track.
It is critical thinking...multiple approaches to solving a question.
Be it as it may, these subsequent questions are not required.
It is okay even if you do not look at them. 😊
C# Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) C# Strings : Exercises, Practice, Solution
(B.) C# Date and Time: Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(5.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
Java Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) Java Strings: Exercises, Practice, Solution
(B.) Java Date and Time: Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(6.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
C++ Programming Exercises, Practice, Solution by W3Resource
Please review:
(A.) C++ Strings: Exercises, Practice, Solution
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(7.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
(1.) Review the post (Discuss Questions) done by your colleagues.
Use a different string method to work on the same string used by your colleague.
(2.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(3.) Other substantive responses.
You may use strings not written in English language. However, if you use any language other than English language,
please make sure you translate it. Your colleagues and I need to understand any language you use.
Insensitive words or any word deemed inappropriate to any race, gender, religion, and national origin among others are
unacceptable. Any violation will not yield any point.
If you are not sure of the words/string to use, please contact me first.
(1.) We are yet to do Statements (in the next Module), but you can give this question a try.
A string palindrome is a word, phrase, clause or sequence of characters that is
spelled and read the same way backward and forward.
In other words, when one reads it as is, reverses it and reads it again; the pronunciation is the same.
Examples include the:
Words: HANNAH, BOB, madam, level, civic, racecar, rotor
Phrase: never odd or even
Clause: nurses run
Sentence: Was it a car or a cat I saw?
Write a VB program that asks for user input.
Determine if the user input is a string.
If the user input is not a string, ask the user to enter only a string.
If the user input is a string, determine if it is a string palindrome.
Inform the user whether it a string palindrome or not.
Test at least one example of: Words, Phrase, Clause, and Sentence that was listed.
This implies that you should test at least four examples.
(2.) Please review the Date and Time: Example 1: Date and Time Formats for Different Countries
Extend my application by greeting your fellow colleagues in the langauge of their countries.
Because Visual Studio did not display the Hindi and Chinese alphabets, do not worry about India and China.
Write a VB application that:
(a.) Displays the date and time for the countries: United States, Italy, and Switzerland.
Because you are extending my application, you may use my code.
Find out/browse/learn/discover the greetings for Good Morning, Good Afternoon, and Good Evening for Italy and
Switzerland in Italian and German respectively.
(b.) Displays the greetings to each user (your fellow colleague) according to the current time.
If the time is between 12:00:01 AM to 12:00:00 PM (inclusive), greet Good Morning in each langauge.
If the time is between 12:00:01 PM to 04:00:00 PM (inclusive), greet Good Afternoon in each lanaguage.
If the time is between 04:00:01 PM to 12:00:00 PM (inclusive), greet Good Evening in each language.
You may use 12-hour or 24-hour time formats.
These are the minimum requirements. You are welcome to add more functionalities.
(3.) Please review the Date and Time example in this module.
Our students come from the entire 50 states of the United States and its territories.
However, the United States has different time zones.
Find out/browse/learn/discover the different time zones in the United States and its territories as seen in the
The Official U.S. Time (https://time.gov/) according to the
National Institute of Standards and Technology
Include those time zones in your comments.
Display the current date and time for each time zone.
Greet each user (your fellow colleague) according to their time zones (their own current times).
If the time is between 12:00:01 AM to 12:00:00 PM (inclusive), greet Good Morning.
If the time is between 12:00:01 PM to 04:00:00 PM (inclusive), greet Good Afternoon.
If the time is between 04:00:01 PM to 12:00:00 PM (inclusive), greet Good Evening.
You may use 12-hour or 24-hour time formats.
These are the minimum requirements. You are welcome to add more functionalities.
(4.) Please review the Date and Time: Example 2: Birthday Application
Modify my application or write your new application.
(a.) Ask the user to also enter the time (hh:mm:ss) in hours, minutes, and seconds that he/she was born.
(b.) If the user has not had birthday this year, inform the user about the number of days, hours, minutes, and seconds
until his/her birthday.
Do not stress about the calculations. Microsoft.NET methods handle most of these calculations.
(c.) If the user already had birthday this year, or if today is the user's birthday; display appropriate positive
messages to the user.
(d.) A user's birthday is 29th February. This implies that the user has to celebrate birthdays only on leap years
(years that are divisble by 4). Accommodate that user in your application. Display message(s) accordingly.
(e.) Include checks for user-input errors and display messages accordingly.
(5.) Write a VB program that solves Question (8.) on the
Applications of Numbers website.
(https://numbersandnotations.appspot.com/numbersApplications.html)
Use any actual date that is a Tuesday.
Ensure that the output of your program corresponds to the solution on the website.
Please display: the actual date, the actual day, the new date and the new day in your output.
In other words, I am looking for the input date, the input day that is a Tuesday, the output date, and the output day
that is a Friday.
Please check to ensure your program gives the correct output (result).
You may develop a console application or a desktop application for this program.
Submit screenshots of the question, your program, and the output of your program.
(6.) Please review the GUI Programming: Birthday Application
We developed the Birthday desktop application using the MonthCalendar control.
Another option is to use the DateTimePicker Control
(https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datetimepicker?view=net-5.0)
The DateTimePicker control allows the user to select a date and a time and to display the date and time with a specified format.
The advantage of the DateTimePicker control over the MonthCalendar control is the ability of the user to select only a date and a time.
The advantage of the MonthCalendar control over the DateTimePicker is that it allows the user to select only dates
(one date or a range of dates) without selecting time.
In the comments for that program: Lines #48 and #49, I ask that you extend the application.
Develop a desktop application that meets these requirements.
(a.) Ask the user to also enter the time (hh:mm:ss) in hours, minutes, and seconds that he/she was born.
You may use the DateTimePicker control or any other toolbox control you prefer.
(b.) If the user has not had birthday this year, inform the user about the number of days, hours, minutes, and seconds
until his/her birthday.
Do not stress about the calculations. Microsoft.NET methods handle most of these calculations.
(c.) If the user already had birthday this year, or if today is the user's birthday; display appropriate positive
messages to the user.
(d.) A user's birthday is 29th February. This implies that the user has to celebrate birthdays only on leap years
(years that are divisble by 4). Accommodate that user in your application. Display message(s) accordingly.
(e.) Include checks for user-input errors and display messages accordingly.
(7.) Develop a traffic light desktop application using VB
(a.) You may use the Panel toolbox control
(https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.panel?view=net-5.0) and/or your own appropriate pictures with
the PictureBox toolbox control
(https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.picturebox?view=net-5.0)
for the lights: Green, Yellow, and Red.
(b.) Set the timer for the duration of the yellow light to be at least two seconds (two seconds or more) before it turns to red.
(c.) Use any appropriate time durations for the green light and the yellow light.
(d.) You are welcome to add more functionalities.
(8.)
statement, keyword, operator, variable, constant, expression, declaration statements, executable statements, assignment statements, declared element characteristics, initial values, eligible programming elements, compound assignment statements, AddHandler statement, Call statement, Class statement, Const statement, Continue statement, Declare statement, Delegate statement, Dim statement, Do...Loop statement, Else statement, End statement, End <keyword> statement, Enum statement, Erase statement, Error statement, Event statement, Exit statement, For Each...Next statement, For...Next statement, Function statement, Get statement, GoTo statement, If...Then...Else statement, Implements statement, Imports statement (.NET Namespace and Type), Imports statement (XML Namespace), Inherits statement, Interface statement, Mid statement, Module statement, Namsepace statement, On Error statement, Operator statement, Option <keyword> statement, Option Compare statement, Option Explicit statement, Option Infer statement, Option Strict statement, Property statement, RaiseEvent statement, ReDim statement, REM statement, RemoveHandler statement, Resume statement, Return statement, Select...Case statement, Set statement, Stop statement, Structure statement, Sub statement, SyncLock statement, Then statement, Throw statement, Try...Catch...Finally statement, Using statement, While...End While statement, With...End With statement, Yield statement, ternary operator, conditional ternary operator,
Students will:
(1.) Discuss Statements in Visual Basic.NET programming language.
(2.) Write conditional statements.
(3.) Write iteration statements.
(4.) Write jump statements.
(5.) Write some error handling statements.
(6.) Write programs that solve real-world problems using statements.
(7.) Complete the Midterm Project on Piecewise Functions.
(1.) Textbook Chapter
(2.) Statements in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/statements)
(3.) Statements (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Visual Basic Statements in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Visual Basic Statements in the search bar and view/read the results.
A statement is an individual instruction of a program.
It forms a complete unit of execution.
It is equivalent to a sentence in a language.
It can consist of a single line of code (single-line statement).
It can also consist of multiple lines of code (multi-line statements) in a block, known as a statement block.
A statement block can contain nested blocks.
A block in VB is a group of zero or more statements that can be used where a single statement
is allowed.
In Example 3 (If-else statement) as seen in the screenshot below; the if statement is the
first block of code and the else statement is the second block of code.
The order in which statements are executed in a program is called the flow of control otherwise known as
flow of execution.
The flow of control varies every time a program is run.
It depends on how the program reacts to the instruction it receives at run-time.
There are several types of statements in VB
We have discussed some of them in previous modules.
We shall discuss some of them in this module.
We shall discuss some of them in subsequent modules.
As at today: 03/12/2021; the statements in VB are classified as:
(1.) Declaration Statements
A declaration statement declares a variable or constant.
To declare a variable, the data type must be specified as well. You have the option of assigning a value to it.
To declare a constant, the keyword must be specified. A value must be assigned to it.
' Declaration statement
' We started using this statement beginning from Module 2
Dim num1 As Integer = 7
and
(2.) Executable Statements
An executable statement is a statement that initiates and performs an action.
It can:
(A.) assign a value or expression to a variable or constant ...Assignment statement
(B.) evaluate an expression ...Expression statement
(C.) branch to another place in the code or loop through several statements ...Control Flow statement
(D.) call a method/procedure
Expression Statement or Expression
An expression statement or an expression is a construct made up of variables, operators, and method invocations,
which are constructed according to the syntax of the language, that evaluates to a single value.
Expression statements calculate a value must store the value in a variable.
' Expression statement
' We covered this statement in Module 3
Dim result as Double
result = 7 * (5 - 2);
Control Flow Statements
Generally, statements in Java are executed from top to bottom, in the order that they appear.
However, control flow statements control the order in which statements are executed.
In other words, they break up the flow of the execution of statements by using decision making, looping, and
branching; thereby allowing a program to execute particular blocks of code conditionally.
They include:
(I.) Conditional Statements or Selection statements or Decison-making Statements or Decisions
A conditional statement allows the user to branch to different code sections depending on one or more conditions.
They are the: If-Then-End If statement, If-Then-Else-End If statement,
If-Then-ElseIf-Then-Else-End If statement, Multiple If-Then-End Ifs statement,
and the Select...Case statement.
(II.) Iteration Statements or Looping Statements or Loops
An iteration statement allows the user to perform the same set of statements repeatedly until a specified condition is met.
It also allows the user to loop through collections such as arrays.
They are the: For...Next statement, For Each...Next statement, Do...While Loop statement,
Do...Until Loop statement, Do-Continue Do-Loop While statement, Do-Loop-Until statement,
While...End While statement
(III.) Jump Statements or Branching Statements or Branches
A jump statement allows the user to transfer control to another section of the code.
They are the: GoTo statements.
(IV.) With...End With statements
Let us discuss the Selection, Iteration, and Jump statements.
Then, we can discuss more statements.
(1.) If-Then-End If statement
This statement is used when there is only one condition.
If some condition is met, then execute a given task.
The If-Then-End If statement is written as:
If condition Then statement End IfVB ignores whitespaces so you can also write it this way:
If (condition) Then statement End If
If condition Then statement Else statement End IfVB ignores whitespaces so you can also write it this way:
if (condition) Then statement Else statement End IfWe can also write simple If-Then-Else-End If statement using the Ternary operator also known as the Conditional Ternary Operator
variable = If ((condition), statement if true, statement if false)(3.) If-Then-ElseIf-Then-Else-End If statement
If condition 1 Then statement ElseIf condition 2 Then statement ElseIf condition 3 Then statement Else statement End IfWhitespaces are ignored in VB. Therefore you can also write it this way:
If condition 1 Then statement ElseIf condition 2 Then statement ElseIf condition 3 Then statement Else statement End IfKeep in mind that we do not specify condition 4 in the code for the Else statement because we already know that the Else statement would only be executed if all the other prior conditions are not met.
If condition 1 Then statement If condition 2 Then statement If condition 3 Then statement If condition 4 Then statement End IfWhitespaces are ignored in VB. Therefore you can also write it this way:
If condition 1 Then statement If condition 2 Then statement If condition 3 Then statement If condition 4 Then statement End IfReview the Definitions of Numbers
A good application of VB Conditional Statements is seen in Piecewise functions.
Please review the
Story on Piecewise Functions
(www.piecewise-functions.appspot.com/#story)
Let us write several VB programs that will solve the Piecewise function problem in that story.
Piecewise Function: Conditional Statements using Multiple If-Then-End Ifs statements
Conditional Statements: Example 8 (Multiple conditions: Multiple If-Then-End Ifs)
Let us address user-input errors for the number of burritos that may be out of range in the Piecewise Function.
It is important to address user-input errors in any program you write.
In this case (for the Story on Piecewise Functions): the program will not display any output if the user enters a negative
number, a zero, or any positive number greater than the upper bound of the last piece.
The user may then be confused if he/she does not see any output.
We want to avoid that.
In the case of user-input error, we want the program to display a message that the user entered something out of range, and
then exit without interrupting the system.
We shall write the message for the user, then include the Environment.Exit(0) method to exit the program.
What if the user enters $2500$?
What if the user enters $-3$?
Student: Can we write the same Piecewise function using the If-Then-ElseIf-Then-Else-End If statements?
Teacher: Nice question.
What do you think?
Student: I think we can.
Teacher: Yes but we need to include the last Else statement
Student: Must we include it?
Teacher: Highly recommended...yes
The program will run even if we do not include it.
However, it is important we include it.
Whenever you use If-Then-ElseIf-Then statement, make sure you include the last Else statement. Also, do not
forget to End If
In this case (using the If-Then-ElseIf-Then-Else-End If statement), the last Elsestatement will have a statement
but not a condition.
It is executed when all prior conditions are not met.
So, let us write a statement that will display the message to the user if the user enters any value that is out of range.
using the If-Then-ElseIf-Then-Else-End If statements
Piecewise Function: Conditional Statements using If-else if-else statements
Conditional Statements: Example 9 (Multiple conditions: If-else if-else statements)
What if the user enters $0$?
What if the user enters $3000$?
What if the user enters $-12$?
Teacher: Did you notice the importance of that final Else statement?
We did not need to specify the range of numbers that are out of bounds as we did for the Multiple-If-Then-End Ifs statements.
Let us discuss the remaining Condtional Statement: the Select...Case statement.
The Select...Case statement can consist of simple Select...Case statements or multiple Select...Case statements.
It can also contain nested Select...Case statements.
These statements return one of several groups of statements depending on the value of a variable.
The variable is declared first.
It can be any of these data types: Boolean, Byte, Char, Date, Double, Decimal, Integer, Long, Object, SByte, Short, Single, String,
UInteger, ULong, and UShort.
Then, the statement compares each case for the value of the variable, and returns the command corresponding to that value.
If there is no case corresponding to the value of the variable, the command for the default case (Case Else) if declared, is returned.
Hence, it is important to declare the Case Else (the remaining statement when all prior cases are not met) in any Select...Case statement.
If the Case Else is not declared, the program will not return anything, leaving the user probably confused. We want to avoid it.
Let us review examples.
Simple Select...Case Statement
The syntax is:
Dim variable As dataType = value Select Case variable ' Begin Select Case value1 ' Compare value1 with value statement1 ' If value1 = value, print statement1 Case value2 ' Compare value2 with value statement2 ' If value2 = value, print statement2 Case Else ' value1 or value2 is not equal to value statement3 ' Print statement3 End Select ' End SelectTeacher: Have you noticed these Call Center greetings?
52 is not a String variable.
Besides, it is not one of those defined cases.
So, it falls in the Else case.
Therefore, the statement in the Else case is the output.
Question 2
(2.) The user entered "Africa" and expected to see the statement associated with that continent.
However, the user saw another output.
Explain.
Africa is not the same as AFRICA based on case-sensitivity.
Hence, the statement in the Else case is displayed.
Question 3
(3.) The user wants to see the statement associated with the continent of Africa.
However, he/she does not want to enter the input of "AFRICA"
The requirement is on you, the programmer to modify the program so that when the user inputs: "Africa" or "africa", the
output would be the statement associated with the case: "AFRICA".
Hint: There is a statement/command you need to put on Line #2
We reviewed that statement in Module 4
The statement to be inserted on Line #2 is the Option Compare Text statement
This is because the Text keyword in the Option Compare Text sets the string comparison method specified in the
Option Compare to a text sort order that is not case-sensitive.
These are the screenshots of the modified program and the results.
Recall the Piecewise Function program we wrote earlier.
We used Conditional statements to write it.
Let us develop the same program using the Select...Case statement.
Piecewise Function Application using Select...Case Statements
Nested If-Then Statements and Nested Select...Case Statements
We can write more challenging programs using Nested Conditional Statements
We can use Nested If-Then statements or Nested Select...Case statements
One of the syntax for Nested If-Then statement is:
Dim variable As dataType If condition 1 Then If condition 2 Then statement Else statement End If ElseIf condition 3 Then If condition 4 Then statement Else statement End If Else statement End IfNotice that each nested If is required to be closed with an End If
Dim variable As dataType = value Select Case variable Case value1 Case value1A statement Exit Select Case value2 Case value2A Case value2AA statement Case Else statement Exit Select Exit Select Case Else statement End SelectNotice that each nested Case is required to be closed with an Exit Select
Iteration Statements repeat a group of statements a specified number of times.
They are:
(1.) For...Next statement
The syntax for the simple For...Next statement is
For variable As dataType = begin To end Step someValue statements Nextwhere:
For
keyword begins the For loop. It is required. variable
is a numeric variable. It can also be an object. It is the control variable for the loop. It is required. dataType
is optional. It must be any of the numeric data types. begin
is the initial value of the variable. It is required. To
keyword is optional. It is used to specify the range for the variable.
end
is the final value of the variable. It is required. Step
keyword is optional. It is the command for the incremental or decremental value. someValue
is optional. It is the amount by which the variable increases or decreases
each time through the loop. (incremental or decremental value). Next
keyword terminates the For loop. It is required. For variable As dataType = begin To end Step someValue If condition Then Continue For End If statement If condition Then Exit For End If Nextwhere:
Continue For
transfers control to the next loop iteration. Exit For
exits the For...Next loop and transfers control out of the loop. It transfers control to any statment
after the Next statement. ' Begin the main For...Next loop For variable1 As dataType = begin To end Step someValue1 ' Begin the nested For...Next loop For variable2 as dataType = begin To end Step someValue2 statement ' End the nested For...Next loop Next variable2 statement ' End the main For...Next loop Next variable1Did you notice that in the case of nested For...Next loops, it is important to write the variable after each Next statement.
The midterm project is designed to assess your knowledge of Statements in solving real-world problems.
It is a Piecewise Function application.
Any other application will not considered.
Please:
(1.) Visit my website on: Piecewise Functions
(2.) Read the Story to understand the idea of Piecewise functions.
(3.) Read the Overview of Piecewise Functions for more understanding of Piecewise
functions.
(4.) Study the Applications of Piecewise Functions
(5.) Review the Project Examples. Ensure you follow all the instructions and directions.
(6.) Review the Midterm Project rubric for your course.
(7.) Complete the Midterm Project for your course.
(8.) Ask questions. I can help.
If you have any issue at any time and you have reviewed the resources I provided and you cannot fix the issue,
please attend the Office Hours/Live Sessions so I can help you.
(9.) Include all these: (documentation of all your Math work and the .exe file) in OneDrive, create a
shareable link, and post the link in the Midterm Project Drafts forum of the course on Blackboard or send to me via email.
You may also upload them directly if you prefer.
I shall review and provide feedback.
(10.) Make sure your executable file runs by itself outside the project folder
If it does run, include these three items: single executable file (that runs by itself outside the folder), the
Math documentation (Word document that has the Math part), and the entire project folder, into a folder,
zip the folder (.zip extension only) and submit it in the appropriate area of the Blackboard course.
If it does not run, please fix it.
If you cannot fix it, please attend the Office Hours/Live Sessions so I can help you.
NOTE: Any actual project submitted to me via email will not be graded.
If you wish to save some time for research:
Please review the Piecewise Function projects done by my previous students.
The direct link of the verifiable websites are included.
(I.) VB Projects
(II.) C# Projects
(III.) C++ Projects
(IV.) Java Projects
You may not do any same application done by any of my previous students for VB.NET
You may do any Piecewise Function application not done by any of my previous students for VB.NET
If you are not sure what project you may or may not do, please contact me via the school email.
procedure, function, method, calling code, main method, main procedure, sub procedure, event-handling procedure, function procedure, property procedure, operator procedure, generic procedure, generic method, parameter, argument, parameter list, argument list, parameter array, optional parameter, Return keyword, return value, return type (return data type), recursive procedure, procedure overloading, modifier, method name, function name, statement, passing mechanism, pass parameter by value (ByVal keyword), pass parameter by reference (ByRef keyword), pass argument by position, pass argument by name, Optional keyword,
Students will:
(1.) Discuss procedures.
(2.) Pass parameters to procedures (passing by value and passing by reference)
(3.) Pass arguments to procedures (passing by position and passing by name)
(4.) Overload procedures.
(5.) Write programs that solves real-world problems using procedures.
(1.) Textbook Chapter
(2.) Procedures in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/)
Please focus on:
Procedures in Visual Basic
How to: Create a Procedure
Sub Procedures (all)
Function Procedures (all)
(3.) Passing Arguments by Value and by Reference (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/passing-arguments-by-value-and-by-reference)
(4.) Passing Arguments by Position and by Name (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/passing-arguments-by-position-and-by-name)
(5.) Function Statement (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/function-statement)
(6.) Functions (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/)
(7.) Procedure Overloading (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/procedure-overloading)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(8.) Type Visual Basic Procedures or Visual Basic Methods or Visual Basic Functions in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(9.) Type Visual Basic Procedures or Visual Basic Methods or Visual Basic Functions in the search bar and view/read the results.
A procedure is a block of statements enclosed by a declaration statement.
The declaration statement used to enclose a procedure are the: Sub, Function, Operator, Get,
and Set statements.
Each declaration should have a matching end declaration.
For example: if we use the Sub statement, we must close it with the End Sub statement.
Let us review the first VB console program that we wrote in Module 1
Line #9: The beginning Sub statement: Sub that has the Main method
Line #13: The ending Sub statement: End Sub that ends it.
So, Line #9 through Line #13 (Lines #9 - #13) is known as the Main Procedure.
It is a Sub Procedure called Main
As we discussed in Module 1, every VB.NET program (console and desktop applications) must contain a Main procedure
Every statement written inside that main procedure will be executed.
This procedure serves as the starting point and overall control for the program.
The .NET Framework calls the Main procedure when it has loaded the program and is ready to pass control to it.
We can, however:
(1.) Write our own sub procedure.
But we cannot call it Main (because Main is a reserved keyword to denote the sub procedure that has the main method).
Recall what we did in Module 1:
Line #3: The beginning Sub statement: Sub
Line #9: The ending Sub statement: End Sub
Line #3 through Line #9 (Lines #3 - #9) is known as a Sub Procedure.
Let us discuss a type of Sub Procedure: Event-handling Procedure.
Event-handling Procedure is a Sub procedure that executes in response to an event raised by user action or by an
occurrence in a program.
Line #3 through Line #9 is also an event-handling procedure where the event is the form load
Line #11 through Line #33 (if you review that program in Module 1) is also an event-handling procedure where the event
is the clicking of the Message Button by the user
We can also:
(2.) Write a function procedure: block of statements enclosed within a beginning Function: Function and an ending
Function: End Function.
Recall what we did in Module 3:
Line #12: The beginning Function statement: Function
Line #18: The ending Function statement: End Function
Line #12 through Line #18 (Lines #12 - #18) is known as a Function Procedure.
Student: I do have some questions before you continue.
Teacher: Please go ahead.
Student: You said that every VB.NET program (console and desktop applications) must contain a Main procedure
Well, I just reviewed the code we did in Module 1...the code for the desktop application you posted
I did not see any sub procedure called Main
Am I missing something or am I just not getting it?
Teacher: You asked a very good question.
This is Microsoft notes on the:
Main Procedure
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/program-structure/main-procedure)
Based on the Number (2.) on the Requirements for the Main Procedure, the Visual Basic compiler
(which in our case, is the Visual Studio) automatically generates a Main procedure so we do not need to write one.
For console applications (Requirement Number 1.); we must write the Main procedure.
For desktop applications (Requirement Number 2.); we do not need to write the Main procedure because the compiler automatically generates
it.
This is because a file that runs on its own (usually with extension .exe) must contain a Main procedure.
Console applications and desktop applications contain executable (.exe) files.
For class libraries (windows control libraries and web control libraries) and web applications (Requirement Number 3.);
the Main procedure is not required.
This is because a library (for example with extension .dll) does not run on its own and does not require a Main
procedure.
Web applications are deployed as class libraries.
Student: Okay, makes sense.
My next question is: what is the difference between the Sub procedure and the Function procedure?
Teacher: Let us discuss it.
So far, we have mentioned the Sub Procedure and the Function Procedure.
Let us compare and contrast both of them.
Sub Procedure | Function Procedure |
---|---|
(1.) is a series of VB statements encolsed by the Sub and End Sub statements. | (1.) is a series of VB statements encolsed by the Function and End Function statements. |
(2.) performs a task and then returns control to the calling code, but does not return a value to the calling code. So, it does not use the Return keyword. In other words, it does not have any single return data type: Integer, Double, String, etc. However, it can return a statement that contains all those return types in a String interpolation. The Sub Procedure in VB is similar in functionality to the void type in C#, C++, Java |
(2.) performs a task, and then returns control to the calling code, and also returns a value to the calling code. So, it uses the Return keyword. It can return a value or an array of values of a specific return data type. The Function Procedure in VB is similar in functionality to the method data type in C#, C++, Java |
(3.) is defined in a module, class, or structure. is Public by default, so it can be called anywhere in the program that has access to the module, class, or structure in which it is defined. |
(3.) is defined in a module, class, or structure. is Public by default, so it can be called anywhere in the program that has access to the module, class, or structure in which it is defined. |
(4.) can take arguments such as constants, variables, or expressions; which as passed to it by the calling code. | (4.) can take arguments such as constants, variables, or expressions; which as passed to it by the calling code. |
(5.) can be assessed from outside its defining module, class, or structure; hence it is also known as a method and can also be referred to as a function | (5.) can be assessed from outside its defining module, class, or structure; hence it is also known as a method and can also be referred to as a function |
(6.) Declaration syntax: The syntax for declaring a Sub Procedure is:
[modifier] Sub SubName(parameterList) where: The modifier specify access level and information about overloading, overriding, sharing, and shadowing. The modifier can be Private, Public, and Protected among several others. The modifier is Public by default (if it is not specified). The parameterList is the list of parameters which can be a data type, several data types, an array, or an optional parameter (if there is no parameter) |
(6.) Declaration syntax: The syntax for declaring a Function Procedure is:
[modifier] Function FunctionName(parameterList) As ReturnType where: The modifier specify access level and information about overloading, overriding, sharing, and shadowing. The modifier can be Private, Public, and Protected among several others. The modifier is Public by default (if it is not specified). The parameterList is the list of parameters which can be a data type, several data types, an array, or an optional parameter (if there is no parameter) |
(7.) Parameter declaration: Each parameter in a procedure is declared by specifying the name of the parameter and the
data type. The syntax for declaring the parameters for a Sub Procedure (that has parameters) is: Optional [ByVal | ByRef] [parameterArray] parameterName As dataType The syntax for declaring the parameters for a Sub Procedure (that has optional parameters) is: Optional [ByVal | ByRef] parameterName As dataType = defaultValue As seen from these declarations: The parameterArray can be a single data type, several data types, or an array. If the parameter is optional, a default value must be provided in the declaration. Parameter can be passed by value (ByVal) or by reference (ByRef). This is optional. We shall discuss these terms later in this module. |
(7.) Parameter declaration: Each parameter in a procedure is declared by specifying the name of the parameter and the
data type. The syntax for declaring the parameters for a Function Procedure (that has parameters) is: Optional [ByVal | ByRef] [parameterArray] parameterName As dataType The syntax for declaring the parameters for a Function Procedure (that has optional parameter) is: Optional [ByVal | ByRef] parameterName As dataType = defaultValue As seen from these declarations: The parameterArray can be a single data type, several data types, or an array. If the parameter is optional, a default value must be provided in the declaration. Parameter can be passed by value (ByVal) or by reference (ByRef). This is optional. We shall discuss these terms later in this module. |
(8.) Calling syntax: The syntax for calling a Sub Procedure (that has parameters) is: SubName(argumentList) The syntax for calling a Sub Procedure (that has optional parameter) is: SubName() As you may probably notice, we use the term: parameter when we create the procedure We use the term: argument when we call the procedure |
(8.) Calling syntax: The syntax for calling a Function Procedure (that has parameters) is: FunctionName(argumentList) The syntax for calling a Function Procedure (that has optional parameter) is: FunctionName() As you may probably notice, we use the term: parameter when we create the procedure We use the term: argument when we call the procedure |
(1.) Program Requirement
Every line of executable code in any VB application must be inside some procedure.
(2.) Reusability: write one time, use several times
Procedures are useful for performing repeated or shared tasks such as frequently used calculations, text and control
manipulations, and database operations.
We can just define a procedure one time, and then reuse the statements inside the procedure as many times as we want
whenever we call that procedure.
(3.) Easier Code Readability and Faster Debugging
Imagine a "big" program (program with long lines of codes).
Procedures allow such programs to be broken into discrete logical units.
This helps for easier code readability and faster debugging.
(4.) Avoiding Code Duplication
After developing a procedure in one program, it can be reused in another program with little or no modifcation.
The types of procedures in Visual Basic.NET are:
(1.) Sub Procedures (discussed in this module)
(2.) Event-handling Procedures (type of Sub Procedure: mentioned in this module)
(3.) Function Procedures (discussed in this module)
(4.) Property Procedures (will be discussed in the Advanced VB.NET course)
(5.) Operator Procedures (will be discussed in the Advanced VB.NET course)
(6.) Generic Procedures (will be discussed in Module 7: Arrays)
A procedure cannot contain another procedure.
Therefore its beginning and ending keyword (statements) must be outside any other procedure.
All the procedure's code(statements) lies between the beginning and ending procedure keyword(statements).
Please note:
Visual Basic Naming Conventions require
Pascal casing for function and method names and that each
function and method name begin with a verb
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/program-structure/naming-conventions)
To create a procedure that does not return a value (Sub Procedure)
(A.) Outside any other procedure, use the Sub statement, followed by an End Sub statement.
(B.) In the Sub statement, follow the Sub keyword with the name of the procedure, then list the
parameter(s) in parenthesis.
(C.) Place the procedure's code statements between the Sub and End Sub statements.
To create a procedure that returns a value (Function Procedure)
(A.) Outside any other procedure, use the Function statement, followed by an End Function statement.
(B.) In the Function statement, follow the Function keyword with the name of the procedure,
list the parameter(s) in parentheses, and then an As clause specifying the data type of the return value.
(C.) Place the procedure's code statements between the Function and End Function statements.
(D.) Use a Return statement to return the value to the callin code.
We call the procedure (Sub Procedure and/or Function Procedure) in the Main Procedure.
We can write as many procedures as we want outside the Main procedure. But, we have to call them in the Main procedure.
It does not matter if we place the procedures before or after the Main procedure.
I do prefer writing them first before calling them in the Main procedure. This means that I prefer writing them before the
Main procedure.
What matters is the order in which they are executed.
They are executed based on a top-down approach according to the order by which they are called in the Main procedure.
Let us review some code examples of the Sub Procedure and the Function Procedure.
Sub Procedure Example
Input/Output Feature:
Celsius Temperature to Fahrenheit Temperature Conversion
Fahrenheit Temperature to Celsius Temperature Conversion
Demonstrate the use of local variables and member variables
Definitions:
A local variable is a variable declared within a procedure.
A member variable is a variable declared at the module level, inside a class, structure, or module,
but not within any procedure internal to that class, structure, or module.
Formulas:
$
fahrenheitTemp = \dfrac{9 * celsiusTemp}{5} + 32 \\[5ex]
celsiusTemp = \dfrac{5 * (fahrenheitTemp - 32)}{9} \\[5ex]
$
Function Procedure Example
Discriminant of a Quadratic Trinomial (no worries, we do not discriminate in Mathematics 😊)
Calculate the Discriminant of a Quadratic Trinomial in General Form
As we learned earlier:
When we declare the method (Sub Procedure or Function Procedure), we use parameters.
When we call the method (Sub Procedure or Function Procedure), we use arguments.
In other words:
A Parameter represents the value that the procedure expects you to provide when you call it.
The declaration of the procedure defines its parameters.
A procedure can be defined with no parameter, one parameter, or several parameters.
A Parameter List is the part of the procedure definition that specifies the parameters.
An Argument represents the value you provide to a procedure parameter when you call that procedure.
The calling code provides the arguments when it calls the procedure.
An Argument List is the part of the procedure call that specifies the arguments.
In Visual Basic, a parameter can be passed to a procedure by value or by reference.
Passing Mechanism is the passing of a parameter to a procedure by value or by reference.
It determines whether the procedure can modify the programming element underlying the argument in the calling code.
By specifying the ByVal or ByRef keyword in the procedure declaration, the passing mechanism is determined for each
parameter.
Please note that passing mechanism is optional in procedure declarations.
The default passing mechanism in Visual Basic (when the passing mechanism is not specified) is to pass parameters by value.
Passing Parameter By Value (ByVal) | Passing Parameter By Reference (ByRef) |
---|---|
(1.) Protection: Exposure of calling variables to change The advantage of passing an argument by value is that it protects a variable from being changed by the procedure. |
(1.) Protection: Exposure of calling variables to change The advantage of passing an argument by reference is that the procedure can return a value to the calling code through that argument. |
(2.) Performance: For a value data type, Visual Basic copies the entire data contents of the
argument. This implies that for a large value type such as a structure, it can be less efficient to pass it by value. For a reference data type, Visual Basic copies only the pointer to the data (which is four bytes on 32-bit platforms and eight bytes on 64-bit platforms). So, performance is not an issue when an argument is passed by value for a reference data type. |
(2.) Performance: For a value data type, Visual Basic copies the entire data contents of the
argument. This implies that for a large value type such as a structure, it can be more efficient to pass it by value. For a reference data type, Visual Basic copies only the pointer to the data (which is four bytes on 32-bit platforms and eight bytes on 64-bit platforms). So, performance is not an issue when an argument is passed by reference for a reference data type. |
(3.) If the calling code element underlying the argument is a nonmodifiable element, declare the corresponding parameter
by value. (ByVal) No code can chnage the value of a nonmodifiable element. |
(3.) If the procedure needs to change the underlying element in the calling code, declare the corresponding parameter by reference. (ByRef) |
(4.) If the underlying element is modifiable, but you do not want the procedure to be able to change its value;
declare the parameter by value. (ByVal) Only the calling code can change the value of a modifiable element passed by value. |
(4.) If the correct execution of the code depends on the procedure changing the underlying element in the calling code, declare the parameter by reference. (ByRef) |
Student: Mr. C, if I say I did not understand the passing mechanism you just explained, I mean it.
I want to learn and understand it, rather than just memorize.
Is there any way you can break it down?
Teacher: Yes, let's do some examples.
Student: Alright, but please use a simple example.
You have been using Mathematics examples.
Can you explain this time with English...say using Strings?
And use only local variables
Teacher: Okay. Not a problem. Let's do the examples.
Pass Parameters by Value: Example $1$
Pass Parameters by Reference: Example $1$
Student: So, when we pass parameters by value, the arguments are printed; and when we pass paramaters by
reference, the parameters (rather than the arguments) are printed.
Is that correct?
Teacher: That is correct.
When we pass parameters by value (which is the default passing mechanism when the passing mechanism is not specified),
the copies of the parameters (which is the arguments) are printed.
The actual parameters are not affected.
Only the arguments (which are the copies of the parameters) are printed.
When we pass parameters by reference, the actual parameters are affected because the actual parameters become associated
with the arguments passed to the function.
Would you like for us to do another example?
Student: Yes please.
But keep it simple.
Teacher: Okay. Let's do an example with numbers.
Pass Parameters by Value: Example $2$
Pass Parameters by Reference: Example $2$
Student: I get it now.
But, what if we decided to print the values in the Sub Procedure rather than the Main Procedure?
Teacher: Then the program will print the parameters in that Sub Procedure
Student: Regardless of the passing mechanism?
Teacher: Yes...
Provided you did not print anything in the Main Procedure
So, this is what happens
When the Sub Procedure is called in the Main Procedure, the program will head to the Sub Procedure and execute every
statement there.
So it will print whatever it sees there
And head back to the Main Procedure
And if it sees there is no print command in the Main Procedure, it will not print anything on the console.
We have seen the two ways we can pass parameters.
Let us discuss the two ways we can pass arguments.
When we call a Sub Procedure or a Function Procedure, we can pass the arguments by position or by name
In the examples we did so far, we passed the arguments by position.
Passing Arguments by Position is passing the arguments in the order in which they appear in the procedure's
declaration when we defined the parameters.
It is delimited (separated) by commas
You can omit an argument when you call the procedure if you used the Optional keyword with the corresponding parameter.
However, if you do; it's place must be held with a comma.
Passing Arguments by Name is passing the arguments without regard to position.
They can be passed in any order. However, we must specify the
name of the parameter followed by a colon and an equal sign followed by the value of the argument
(parameterName:=argumentValue)
You can omit an argument when you call the procedure if you used the Optional keyword with the corresponding parameter.
But the nice thing about this approach is that you do not have to
use commas to denote missing positional arguments.
Another nice feature about this approach is that you do not have to follow the order in which the parameters were defined
in the procedure.
Further, this approach makes it easier to note which arguments you are passing and which ones you are omitting.
Remember when we used this approach... in Module 4 when we covered Date and Time methods
Let us write some code examples.
Pass Arguments by Position Example
Pass Arguments by Name Example
Line $18$ in both programs indicates the main difference.
For all applicable questions, please:
(A.) Use the Sub Procedure and/or the Function Procedure as your method
(B.) Use appropriate method names in line with Visual Basic naming conventions.
(C.) Include an appropriate message with your result.
(D.) Use an Input/Output feature if you wish.
(1.) Using the Function Procedure Example, include a condition that asks the user if the quadratic trinomial is in
general form.
If the user says No, ask the user to arrange the quadratic trinomial in general form before proceeding.
Then, quit the program.
If the user says Yes, proceed to run the program.
Test both conditions.
Arithmetic: Questions (2.) through (5.)
Please review the Definitions of Numbers on Numbers website:
Numbers and Notations
(https://numbersandnotations.appspot.com/#definitions)
Please make sure you indicate the type of number in your comments.
(2.) Write a method that prints any of those types of numbers between one and thirty ($1$ and $30$ are included)
(3.) Write a method that prints the first thirty numbers of any of those types of numbers.
Focus on the first positive thirty numbers of those kind of numbers.
(4.) Write a method that asks the user to input two values (those values could be
positive, zero or negative)
The method should print all the numbers for any of those types of numbers between those two
values.
Those two values should be included if they are part of those type of numbers.
(5.) Write a method that asks the user to put in a value (that value could be positive, zero,
or negative)
The method should print thirty values of those types of numbers up to and including the
user-input value.
Geometry: Questions (6.) and (7.)
Please review the Mensuration Formulas on Mensuration website:
Mensuration
(https://www.samuelchukwuemeka.com/Mensuration/mensuration.html)
Please make sure you indicate the type of figure/shape in your comments.
(6.) Write a method that asks the user to input the required parameters for any
two-dimensional figure.
The method should return the area and perimeter of that figure.
(7.) Write a method that asks the user to input the required parameters for any three-dimensional figure.
The method should return the surface area and volume of that figure.
Strings/Quotes: Questions (8.) and (9.)
Find a quote from any of your favorite authors or your favorite quote.
If you do not have any favorite author or a favorite quote, make up a quote yourself, and
indicate that it is your own quote.
(8.) Write a method that prints all the vowels in that quote, and returns the count.
(9.) Write a method that prints all the consonants in that quote, and returns the count.
Textbook Questions
(10.) Question (2.) on Page 416
(11.) Question (4.) on Page 416
(12.) Question (10.) on Page 417
(13.) Question (16.) on Page 418
(14.) Question (18.) on Page 419
(15.) Question (2.) on Page 426
(16.) Question (4.) on Page 426
For those who do not mind messing around with several languages at the same time
Student: Excuse me, Mr. C
This course is only for VB.NET
What do you mean?
Teacher: You are correct.
But, these subsequent questions are not for everyone.
That is the reason I am putting them at the end.
I have a question for you.
Have you ever seen any IT/Computer Science position that requires the knowledge of only one programming language?
Student: I have not checked, Sir.
Teacher: If you intend to be in the IT/Programming field for the long run, at least four (four or more)
languages are required.
If you look for IT positions at Indeed.com or other career/job websites, you will realize what I mean.
Search for visual basic programmer, you might be surprised that even for entry level positions
for a Visual Basic Programmer; they require you to have a working knowledge of several other programming languages.
Mr. C is preparing you for that...if you intend to work in the programming field for a long time.
Besides, this is a critical thinking approach.
I am required to develop and promote critical thinking questions for my students.
A programmer is basically a problem-solver irrespective of the programming language used to solve the problem.
Yes, we are working with Visual Basic.
However, if you find out that C# would be better in solving a particular problem in your workplace,
then you need to use C# unless your employer says otherwise.
The knowledge of several languages is a good asset. It makes you highly valuable.
Further, anyone who attempts any of the subsequent questions will still have to write the program in VB and get the same
result.
The questions and solutions are in another language.
But the student will have to write the program in VB and come up with the same solution. So, we are still on track.
It is critical thinking...multiple approaches to solving a question.
Be it as it may, these subsequent questions are not required.
It is okay even if you do not look at them. 😊
C# Programming Exercises, Practice, Solution by W3Resource
Please review:
C# Function: Exercises, Practice, Solution
(https://www.w3resource.com/csharp-exercises/function/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(17.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program.
Please make sure your program output is the same solution
Java Programming Exercises, Practice, Solution by W3Resource
Please review:
Java Methods: Exercises, Practice, Solution
(https://www.w3resource.com/java-exercises/method/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(18.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program.
Please make sure your program output is the same solution
(1.) Review the post (Discuss Questions) done by your colleagues.
Use a different statement to work on the same function used by your colleague.
For example: if your colleague used an iteration statement in a function, you may use a conditional statement or a
jump statement or a different iteration statement to write the same procedure to give the same output.
(2.) Review the post (Discuss Questions) done by your colleagues.
Use a different procedure to display the same output of the program done by your colleague.
For example: if your colleague used the Function Procedure, use the Sub Procedure to write the program to
display the same output.
You may include an appropriate message along with the output.
(3.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(4.) Other substantive responses.
Algebra:
Please review the Roots of a Quadratic Equation on the Expressions and Equations website:
Quadratic Equations
(www.expressions-equations.appspot.com/#quadraticEquations)
There is a calculator I developed that calculates the roots of a quadratic equation and displays a message.
(I.) Write a method that requests the user to input the three values: (as seen on my calculator), and
display the same message that is displayed by my calculator.
In other words, the output and message from your calculator should be the same as the output and
message from my calculator when the user inputs those three values.
Test your program for each of the four cases of the discriminant regarding the nature of the roots
of a quadratic equation as seen in Numbers $1a.$, $1b.$, $2.$ and $3.$ on my website.
(II.) Submit clear screenshots of your program.
(III.) Submit clear screenshots of the output of your program for the four cases.
(IV.) Submit clear screenshots of the output of my calculator for the four cases.
(III.) and (IV.) should display the same messages.
(1.) Console Application
(2.) Desktop Application
(3.)
array, single-dimensional array, one-domensional array, dimension, rank, data structure, array type, array elements, parenthesis, index, array index, array length, sort array, System.Linq namepsace, arrays as parameters, arrays as arguments, array methods, New keyword, Object keyword, parallel arrays, ListBox, MultiLine TextBox,
Students will:
(1.) Discuss arrays.
(2.) Implement some array methods.
(3.) Pass arrays as function parameters.
(4.) Pass arrays as arguments.
(5.) Write programs that use arrays to solve real-world problems.
(1.) Textbook Chapter
(2.) Arrays in Visual Basic by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/arrays/)
(3.) Tuples (Visual Basic) by Microsoft
(https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/data-types/tuples)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Visual Basic Array and/or Visual Basic Tuple in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Visual Basic Array and/or Visual Basic Tuple in the search bar and view/read the results.
An Array is a list or data container that contains:
(1.) single or multiple values of the same data type or
(2.) multiple values of different data types
The dimension of an array is the direction in which one can specify the elements of the array.
Example:
Record the ages of the students in Mr C's class.
We have only one variable: age.
This is a one-dimensional array...array of integers
A one-dimensional array is also known as a single-dimensional array.
Each student in Mr. C's class takes at least one course this semester.
Record the number of courses taken by each student in Mr. C's class.
Some of the courses are one-credit, two-credit, three-credit, four-credit courses.
Assume the tuition for each course depends on the number of credit units.
Calculate the total cost of all the courses taken by all the students in Mr. C's class.
For us to do this, we need to list the number of courses taken by each student in Mr. C's class. We can represent this in
the column.
We also need to calculate the cost of the courses taken by each student. We can represent this in the row.
So, we have two variables: courses and cost.
This is a two-dimensional array.
The column is the array of integers ... the number of courses.
The row is the array of doubles ... the cost of the number of courses taken by each student.
We can then find the total cost...connect this explanation with Matrices in Algebra
In this module, we are only concerned with one-dimensional array.
The rank of an array is the number of dimensions in the array.
This implies that the rank of a one-dimensional array is 1
The rank of a two-dimensional array is 2
The rank of a three-dimensioanl array is 3 and so on and so forth.
Why Are We Learning Arrays?
Assume you want to work with five different integers; rather than declare five different
variables for the five integers, it is much better to declare a single integer array that will contain all five
integers.
When we declare an array in VB:
(1.) We must declare the data type of the array.
(2.) We may or may not not indicate the size of the array.
Notable Notes About Arrays
(1.) An array is declared by specifying the data type of its elements.
You may or may not write the elements when you declare the array.
If the elements are of the same data type, then the array is declared by specifying that data type.
If the elements are of different data types, the the array is declared by specifying Object as the data type.
When the elements are specified, they are enclosed in curly brackets or braces.
Let us review several ways of declaring arrays.
' elements are not specified ' elements are the same data type Dim arrayName() As dataType ' elements are not specified ' elements are the same data type ' array size is specified Dim arrayName(arraySize) As dataType ' elements are specified, separated by comma ' elements are the same data type Dim arrayName() As dataType = {array elements} ' elements are specified, separated by comma ' elements are the same data type ' array size is specified Dim arrayName = New dataType() {array elements} ' elements are specified, separated by comma ' elements are different data types Dim arrayName = {array elements} ' elements are not specified ' elements are of different data types Dim arrayName As Object ' elements are not specified ' elements are of different data types ' array size is specified Dim arrayName(arraySize) As Object ' elements are specified, separated by comma ' elements are of different data types Dim arrayName As Object = {array elements}(2.) When an array is created, the number of dimensions and the length of each dimension are established.
array(index) = element
Dim perfectCubes(9) As Integer
For Each...Next Loop | For...Next Loop, While...End While Loop, Do-While Loop, Do-Until Loop |
---|---|
(1.) Loops through each array element without using a counter. | (1.) Loops through each array element using a counter. |
(2.) The length of the array is not needed. | (2.) The length of the array is needed. |
Example 2: Create an array of strings of size 4
Print the array.
Print the fourth element of the array
Sort the array
Print the sorted array.
Print the fourth element of the sorted array.
Student: Mr. C
Just to be sure...
Because sometimes you declare several variables
And sometimes you use only variable
It can be confusing at times
So, the same variable that you used in the array and the sorted array: name
You used it because it was declared inside the loop?
So, it is only known within the loop? It is not known outside the loop...is that right?
Teacher: That is correct
Student: So, if I try to use that variable outside the loop, the program will not recognize it?
Teacher: That is correct
Student: But why did you not declare several variables like you did in the previous example?
Teacher: It is just a choice
You can declare several variables if you wish.
Let us do an input-output feature.
Let us also demonstrate the use of an array that stores values of different data types.
Example 3: Input-Output Feature for a Pizza Restaurant
Statistics comprises Data Analysis.
Data Analysis is part of Data Science.
Data Science is part of Computer Science/Programming.
As a programmer, it is very likely that you will deal with data.
In this course, we shall focus only on some of the Descriptive Statistics of Data Analysis.
The Descriptive Statistics that we shall discuss in this course are:
(1.) Measures of Center:
Also known as the Measures of Central Tendency
They are the: Mean, Median, Mode, and Midrange.
(2.) Measures of Spread:
Also known as the Measures of Dispersion or the Measures of Variability or the Measures of Variation
For this course, we shall focus on the: Range, Variance, and Standard Deviation.
(3.) Measures of Position:
Also known as the Measures of Location
For this course, we shall focus on the: Five Number Summary of Data
They are the: Minimum, First Quartile, Second Quartile, Third Quartile, and Maximum.
The First Quartile is also known as the Lower Quartile or the 25th Percentile
The Second Quartile is also known as the Median or the Middle Quartile or 50th Percentile
The Third Quartile is also known as the Upper Quartile or 75th Percentile
VB.NET has predefined methods used for calculating some of these measures.
We shall calculate the rest of the measures.
Let us write program examples of descriptive statistics using VB.NET
The formulas used are the formulas on the Descriptive Statistics website
(1.) Formulas for the Measures of Center
(2.) Formulas for the Measures of Variation
(3.) Formulas for the Measures of Location
Example 4: Data Analysis: Descriptive Statistics of Raw Ungrouped Data with VB.NET
Reviewing the code in Example 4: Data Analysis: Descriptive Statistics of Raw Ungrouped Data with VB.NET
Line #19: we used the system-defined Length method of the user-defined array: dataset
Line #22: we used the system-defined Array class method: Array.Sort which takes in the user-defined array:
dataset as the argument.
Let us begin with Line #19
Explore all the system-defined methods of the user-defined array as seen in this image
Scroll down and explore each method.
Then onto Line #22
Please review the methods of the Array class
Scroll down till you see Methods
Notice I implemented the Array.Sort method
Explore the implementation of the other methods of the Array class.
Please note that the examples were written in C#. So you will need to write similar ones in VB.
ListBox, Buttons, RichTextBox, Another VB Form
In previous modules, we explored the use of Button and RichTextBox
In this module, let us explore the use of the ListBox
The ListBox is a toolbox control that contains a list of selectable items.
The ListBox accepts only the string data type by default (in a String Collection Editor), just like the TextBox and
the ComboBox.
In this example, we shall:
(1.) Use a ListBox to include the elements of the array (populate the ListBox with elements)
(2.) Use Buttons to respond to user-event to calculate the descriptive statistics (each of the measures)
(3.) Write methods (user-defined methods only) to calculate the descriptive statistics.
(4.) Call each method under each button event accordingly.
(5.) Use a RichTextBox in another Form to display the results.
Items can be entered into the ListBox directly in the Design Form or from the Code window or from the Button
and another Toolbox Control.
We are going to enter the items directly.
Let us do Question (13.) on the Solved Examples on the Measures of Center website
We are not using Data Bound Items so we leave that box unchecked.
The first thing we need to do is to convert the ListBox into an Array.
As you can see, there are empty lines in the ListBox after we entered the last item.
We are only interested in the actual values/items.
We need to remove any extra lines so it is not included in the array.
The code to do this is as follows:
Convert a Populated ListBox into an Array of Strings
' The default array of Strings of a ListBox
Dim data As String()
data = (From item In DatasetListBox.Items Select data = item.ToString()).ToArray()
The second task is to convert the array of Strings to an array of Doubles
Even though the items are Integers, it is better to use Doubles.
(Please review the Teacher-Student scenario after this program to understand the reasons)
Convert an Array of Strings to an Array of Doubles
' Declare the array of Doubles
Dim dataset As Double()
' Convert the array of Strings to an array of Doubles
dataset = Array.ConvertAll(Of String, Double)(data, Function(member) Convert.ToDouble(member))
We shall now proceed to complete the program.
Form1.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Descriptive Statistics (Data Already Entered)
BackColor property: Web: Lavender
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
FormBorderStyle property: Sizable as is
MinimizeBox property: True as is
MaximizeBox property: True as is
We want the user to be able to adjust the application to accommodate the sample size of the data.
Toolbox Controls | Property |
---|---|
ListBox: Adjust and Align | (Name): DatasetListBox |
Button: Adjust and Align |
Text: Measures of &Center BackColor: Web: White (Name): CenterButton Cursor: Hand |
Copy and Paste Button: Adjust and Align |
Text: Measures of &Spread (Name): SpreadButton |
Copy and Paste Button: Adjust and Align |
Text: Measures of &Position (Name): PositionButton |
Copy and Paste Button: Adjust and Align |
Text: &Descriptive Statistics (Name): StatisticsButton |
RichTextBox: Adjust and Align | (Name): MessageRichTextBox |
Design Area
Access keys: C for the Measures of Center button, S for the Measures of Spread button,
P for the Measures of Position button, and D for the Descriptive Statistics button
(1.) Click the View menu and click the Code tab View → Code, or press the F7 function key on your Windows keyboard
or double-click any empty space on the form in the Design window.
This leads to the Code window
Scroll a little bit to the top, write the comments, and begin to...
(2.) Write the code.
We shall write methods for calculating the Measures of Center, Measures of Spread, and the Measures of Position.
Then, we call the method respectively when the user clicks the button for each of them.
For example:
When the user clicks the Measures of Center button, the method for calculating the measures of center is called, the measures
of center are calculated, and displayed in the RichTextBox.
When the user clicks the Measures of Spread button, the method for calculating the measures of spread is called, the measures
of spread are calculated, and displayed in the RichTextBox.
When the user clicks the Measures of Position button, the method for calculating the measures of position is called, the measures
of position are calculated, and displayed in the RichTextBox.
But:
When the user clicks the Descriptive Statistics button, the methods for calculating all the measures are called,
all the measures are calculated, and displayed in another form
Let us go ahead and add the second form.
Form2.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Descriptive Statistics (Results of Data Already Entered)
BackColor property: Web: Lavender
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
FormBorderStyle property: Sizable as is
MinimizeBox property: True as is
MaximizeBox property: True as is
We want the user to be able to adjust the application to accommodate the sample size of the data.
RichTextBox: Adjust and Align
(Name) property: StatisticsRichTextBox
ForeColor property: Web: DarkBlue
Modifiers property: Public This is very important
To access the RichTextBox in Form 2 from the Button in Form 1, the Modifiers property must be set to Public
Please review the screenshots.
Review the comments.
Program Code
Run the Program
Student: I have several questions.
Teacher: Okay, go ahead.
Student: First: why did you declare doubles when the dataset contains only integers?
Teacher: Doubles take care of integers....well if you do not declare Option Strict On
Here is what I like about C# and VB (something Java does not do...unfortunately)
If you declare the integers and the answer as doubles, and the answer ends up being an integer; C# and VB.NET will
display them as integers.
So, C# and VB will accept them as doubles (even though they are integers) and will also dsiplay the answer as an
integer if the answer is an integer (even though you declared the answer as a double)
On the other hand, Java will accept them as doubles and will also display the answer as a double. Java will also throw
a fit if you declare them as doubles and declare the answer as an integer. In that case, it will require you to convert
it (cast it) as an integer.
So, when working with VB and C#; it is very okay if you declare the data and the answer as doubles even if they are
integers.
Besides, what if you have a mixture of integers and doubles in the dataset?
It is much safer to declare them as doubles.
Student: It seems Java is unforgiving
Teacher: It is not just unforgiving of mistakes. It is very unforgiving of mistakes.
It is very particular about everything.
Student: VB seems to be the really nice one.
Teacher: VB is very nice.
However, it is lenient to a fault.
For example; you can declare numbers as integers enclosed in quotations marks, and add those numbers in VB.
Student: Really?
Teacher: Yes
VB will think you probably made a mistake by enclosing the numbers in quotation marks and will go ahead, treat them
as numbers, and add them.
That is definitely not good.
Student: I guess that makes C# the win-win
Teacher: Hmmmm... I might disagree
All programming langauges have their pros and cons.
For someone who wants to learn a friendly lanaguage, the person should begin with VB
However, if the person intends to learn other languages such as C, C++, C#, Java; the person should probably not begin with
VB
VB syntax is very different from C# and Java.
The person should begin with C#
This is because C# "falls in the middle" of VB and Java
C# has some similar methods with VB because of the .NET configuration. It also has similar syntax with Java.
Anyone who learns C# will easily learn VB and will not struggle with learning Java
Student: What if the person begins with Java?
Teacher: Then the person should be determined not to quit.
What is your next question?
Student: My next question...
What if the user decides to enter the data?
Teacher: You mean: a user-entered data rather than an already-entered (pre-defined) data?
Student: Yes Sir
Teacher: Let us do the example.
Would you like for us to begin with a console application or a desktop application for the example?
Student: Let us begin with a desktop application because we are already discussing it.
Teacher: Okay.
In that case, we shall need a MultiLine TextBox
It is actually the regular TextBox.
Remember, the TextBox enables the user to enter text.
Further, it provides multiline editing and password character masking.
In this case, we shall check the box that says MultiLine.
Let's do it.
MultiLine TextBox, Buttons, Another VB Form, RichTextBox
When the data needs to be entered by the user, rather than an-already entered data; then the MultiLine TextBox should be
used.
The MultiLine TextBox is a TextBox. We just have to check the MultiLine option.
By default, it accepts only the string data type...it is a TextBox after all
If you review the Properties window of the MultiLine TextBox, you will notice that the Lines property is a
String[] Array. It is an array of strings.
Say we want to work with an array of doubles:
We will need to convert that array of strings into an array of doubles.
The code used to convert an array of strings to the array of doubles is:
dataset = Array.ConvertAll(Of String, Double)(DataTextBox.Lines, Function(member) Convert.ToDouble(member))
In this example, we shall:
(1.) Use a MultiLine TextBox to allow the user to enter values of any type in new lines
(2.) Use Buttons to respond to user-event to calculate the descriptive statistics (each of the measures)
(3.) Write methods (user-defined methods only) to calculate the descriptive statistics.
(4.) Call each method under each button event accordingly.
(5.) Use a RichTextBox in another Form to display the results.
Form1.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Descriptive Statistics (User will enter data)
BackColor property: Web: PeachPuff
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
FormBorderStyle property: Sizable as is
MinimizeBox property: True as is
MaximizeBox property: True as is
We want the user to be able to adjust the application to accommodate the sample size of the data.
TextBox: Adjust and Align
(Name): DataTextBox
Button: Adjust and Align
Text: Measures of &Center
BackColor: Web: White
(Name): CenterButton
Cursor: Hand
Copy and Paste Button: Adjust and Align
Text: Measures of &Spread
(Name): SpreadButton
Copy and Paste Button: Adjust and Align
Text: Measures of &Position
(Name): PositionButton
Copy and Paste Button: Adjust and Align
Text: &Descriptive Statistics
(Name): StatisticsButton
Copy and Paste Button: Adjust and Align
Text: C&lear Dataset
(Name): ClearButton
Copy and Paste Button: Adjust and Align
Text: E&xit Application
(Name): ExitButton
Form2.vb: Adjust and Align
(Name) property: Leave as is. Do not change
Text property: Descriptive Statistics of Data Entered by User
BackColor property: Web: PeachPuff
Font: property: Font: Times New Roman; Font Style: Regular; Size: 18
RichTextBox: Adjust and Align
(Name) property: StatisticsRichTextBox
ForeColor property: Web: DarkBlue
Modifiers property: Public This is very important
Design Area
Access keys: C for the Measures of Center button, S for the Measures of Spread button,
P for the Measures of Position button, D for the Descriptive Statistics button,
l for the Clear Dataset button, and x for the Exit Application button.
(1.) Click the View menu and click the Code tab View → Code, or press the F7 function key on your Windows keyboard
or double-click any empty space on the form in the Design window.
This leads to the Code window
Scroll a little bit to the top, write the comments, and begin to...
(2.) Write the code.
We shall write methods for calculating the Measures of Center, Measures of Spread, and the Measures of Position.
Then, we call the method respectively when the user clicks the button for each of them.
For example:
When the user clicks the Measures of Center button, the method for calculating the measures of center is called, the measures
of center is calculated, and displayed in the RichTextBox on the second form.
When the user clicks the Measures of Spread button, the method for calculating the measures of spread is called, the measures
of spread is calculated, and displayed in the RichTextBox on the second form.
When the user clicks the Measures of Position button, the method for calculating the measures of position is called, the measures
of position is calculated, and displayed in the RichTextBox on the second form.
When the user clicks the Descriptive Statistics button, the methods for calculating all the measures are called, all the measures
are calculated, and displayed in the RichTextBox on the second form.
We shall insert tab spaces in the result displayed on the RichTextBox.
A tab space is eight spaces.
To insert a tab space in Visual Basic, we use the code:
Space(8)
Let us do Question (45.) on the Solved Examples on the Measures of Center website
Remember that this application with the MultiLine TextBox will allow the user to enter the data values directly.
Please review the screenshots.
Review the comments.
Program Code
Run the Program
For Questions (1.) and (2.);
Review these Sorting Techniques and Algorithms
(https://www.samdomforpeace.com/DataStructures/Sorting.html)
(1.) Write a method (user-defined method) that sorts an array in ascending order using any of the techniques.
Use an array size of at least 3 (array size $\ge 3$).
Specify the technique.
(2.) Write a method (user-defined method) that sorts an array in descending order using any of the techniques.
Use an array size of at least 3 (array size $\ge 3$).
Specify the technique.
(3.) Write a method (user-defined or system-defined method) that divides an even-sized unsorted array into two equal halves, sorts the
first half in ascending order, and sorts the second half in descending order.
Use any even size of at least 8 (array size $\ge 8$).
(4.) Write a method (user-defined or system-defined method) that divides an even-sized unsorted array into two equal halves, sorts the
first half in descending order, and sorts the second half in ascending order.
Use any even size of at least 8 (array size $\ge 8$).
(5.) Please review the Solved Examples on the Measures of Center
Find any question that has a dataset that can be entered into an array.
(a.) Write a program that computes the measures of center for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(6.) Please review the Solved Examples on the Measures of Spread
Find any question that has a dataset that can be entered into an array.
(a.) Write a program that computes the measures of dispersion for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(7.) Please review the Solved Examples on the Measures of Position
Find any question that has a dataset that can be entered into an array.
(a.) Write a program that computes the measures of location for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(8.) Please review the Solved Examples on Descriptive Statistics
Find any question that has a dataset that can be entered into an array.
(a.) Write a program that computes the measures of center and/or the measures of variability and/or the measures of position for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
Textbook Questions
(9.) Question $2$ on Page $521$
(10.) Please review the system-defined methods for a user-defined array.
Besides the one I implemented in Example 4: dataset.Length() on Line #19, implement any other two methods.
(11.) Please review the methods of the Array class
(https://docs.microsoft.com/en-us/dotnet/api/system.array?view=netcore-3.1)
Scroll down till you see Methods
Besides the one I implemented in Example 4: Array.Sort(dataset) on Line #22, implement any other two methods.
Please note that the examples were given in C#. So, you would need to write similar ones in VB.
For those who do not mind messing around with several languages at the same time
Student: Excuse me, Mr. C
This course is only for VB.NET
What do you mean?
Teacher: You are correct.
But, these subsequent questions are not for everyone.
That is the reason I am putting them at the end.
I have a question for you.
Have you ever seen any IT/Computer Science position that requires the knowledge of only one programming language?
Student: I have not checked, Sir.
Teacher: If you intend to be in the IT/Programming field for the long run, at least four (four or more)
languages are required.
If you look for IT positions at Indeed.com or other career/job websites, you will realize what I mean.
Search for visual basic programmer, you might be surprised that even for entry level positions
for a Visual Basic Programmer; they require you to have a working knowledge of several other programming languages.
Mr. C is preparing you for that...if you intend to work in the programming field for a long time.
Besides, this is a critical thinking approach.
I am required to develop and promote critical thinking questions for my students.
A programmer is basically a problem-solver irrespective of the programming language used to solve the problem.
Yes, we are working with Visual Basic.
However, if you find out that C# would be better in solving a particular problem in your workplace,
then you need to use C# unless your employer says otherwise.
The knowledge of several languages is a good asset. It makes you highly valuable.
Further, anyone who attempts any of the subsequent questions will still have to write the program in VB and get the same
result.
The questions and solutions are in another language.
But the student will have to write the program in VB and come up with the same solution. So, we are still on track.
It is critical thinking...multiple approaches to solving a question.
Be it as it may, these subsequent questions are not required.
It is okay even if you do not look at them. 😊
C# Programming Exercises, Practice, Solution by W3Resource
Please review:
C# Array: Exercises, Practice, Solution
(https://www.w3resource.com/csharp-exercises/array/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(12.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
Java Programming Exercises, Practice, Solution by W3Resource
Please review:
Java Array: Exercises, Practice, Solution
(https://www.w3resource.com/java-exercises/array/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(13.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
C++ Programming Exercises, Practice, Solution by W3Resource
Please review:
C++ Array: Exercises, Practice, Solution
(https://www.w3resource.com/cpp-exercises/array/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(14.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
JavaScript Programming Exercises, Practice, Solution by W3Resource
Please review:
JavaScript Array: Exercises, Practice, Solution
(https://www.w3resource.com/javascript-exercises/javascript-array-exercises.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(15.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
JavaScript Programming Exercises, Practice, Solution by W3Resource
Please review:
JavaScript Searching and Sorting Algorithm: Exercises, Practice, Solution
(https://www.w3resource.com/javascript-exercises/searching-and-sorting-algorithm/index.php)
You are provided with the Questions and the Solutions.
No more than one student may do any specific question.
(16.) Write the Question as a comment in your program. Include the Title and the Question Number.
Write the program in VB
Run the program. Please make sure your program output is the same solution
(1.) Review the post (Discuss Questions) done by your colleagues.
Use a different statement to work on the same Array or the same Tuple used by your colleague.
For example: if your colleague used an iteration statement in an array, you may use a conditional statement or a
jump statement or a different iteration statement to write the same Array or the same Tuple to give the
same output.
(2.) Review the post (Discuss Questions) done by your colleagues.
Use a different data structure to display the same output of the program done by your colleague.
For example: if your colleague used an Array, use a Tuple to write the program to display the same output.
(3.) Review the post (Discuss Questions and Assess Questions) done by your colleagues.
If your colleague developed a console application for a program, develop a desktop application for the same program.
If your colleague developed a desktop application for a program, develop a console application for the same program.
(4.) Review the post (Discuss Questions) done by your colleagues.
Use a different user-defined array method and/or system-defined array class method to work on the same program
done by your colleague.
(5.) Other substantive responses.
Textbook Questions
(1.) Question $10$ on Page $543$
(2.) Please review Example 3: Input-Output Feature for a Pizza Restaurant
Please do these tasks.
(a.) Modify the application to include the name and slogan of the restaurant in the customer's receipt.
In other words, Lines #9 - 16 should be included in the customer's receipt on the condition that those lines should be written
only one time in the project but called twice. Do you understand what I mean? We did that concept in Module 6
Submit the screenshots for the code and the output.
(b.) Samuel entered an order for a customer.
He noticed that the total cost for that customer was less than similar orders he gave past customers.
So, he reviewed his entries and noticed that he mistakenly entered "Extra cheese" rather than "extra cheese".
He did not realize that the application was data entry case-sensitive.
He met with his manager and asked her to reconsider the application.
The manager contacted you, the programmer; and informed you about the concern.
Using at least five different sentences, address this issue.
Consider the fact that the manager is not a programmer.
Inform the manager of several options/applications and suggest the best option.
Asking the manager to ensure that all her employees are properly trained on case-sensitive data entry is not considered
an option in this case.
Write your responses on the Blackboard Editor.
Cite your source(s) as applicable.
For Questions (3.) through (6.):
Please review the GUI Programming Examples.
(I.) User-defined methods are required.
(II.) Parallel arrays are required. One array should be for the data variable and the other array should be for the
frequency.
(III.) You may use a pre-defined array (ListBox) or you may allow the user to enter the values (MultiLine TextBox)
(IV.) Desktop application is optional. You may develop a console application.
(V.) Multiple forms are optional.
(3.) Please review the Solved Examples on the Measures of Center
Find any question that has Ungrouped Data with frequency.
(a.) Write a program that computes the measures of center for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(4.) Please review the Solved Examples on the Measures of Spread
Find any question that has Ungrouped Data with frequency.
(a.) Write a program that computes the measures of dispersion for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(5.) Please review the Solved Examples on the Measures of Position
Find any question that has Ungrouped Data with frequency.
(a.) Write a program that computes the measures of location for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
(6.) Please review the Solved Examples on Descriptive Statistics
Find any question that has Ungrouped Data with frequency.
(a.) Write a program that computes the measures of center and/or the measures of variability and/or the measures of position for that question.
Test the program output with the results on the
Descriptive Statistics Calculators
(b.) Solve the question.
Check your answer with the solution on the website.
Students will:
(1.)
(2.)
(1.) Textbook Chapter
(2.)
(3.)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Visual Basic Multidimensional Array and/or Visual Basic Jagged Arrays in the search bar
and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Visual Basic Multidimensional Array and/or Visual Basic Jagged Arrays in the search bar
and view/read the results.
(1.)
(1.)
There are three options for your Final Exam
Please choose only one option.
This option is based on your textbook (MindTap course).
This implies that it is not free.
However, you have only one-week free access.
So, it is free if you can complete all the graded assessments in one week.
Access the MindTap Course
Please review the gradebook in the MindTap course to see the assessments that count for the Final Exam and the assessments
that count for the Final Project.
I shall manually grade those assessments that count for the Final Project.
The Quizzes (automatically graded) count for the Final Exam
The Exercises (manually graded) count for the Final Project
This exam is designed to assess your understanding of the beginning VB.NET concepts.
You have reviewed several topics and several concepts in each topic for eight modules.
Pick at least $1$ concept in at least $1$ topic in each of the $8$ modules.
That gives at least $8$ concepts in $8$ different topics in $8$ modules.
Find two more concepts in any topic in any module.
That gives $10$ concepts.
For each concept, please:
(1.) Write at least three sentences about that concept.
(2.) Develop a program about that concept.
In other words, write at least one code example about the concept.
Run the code.
Display the output.
Submit clear screenshots of your program (code and output)
Deliverables:
(1.) 10 concepts in 10 different topics for 8 modules
Please write the: Module number, the Topic, and the Concept
(2.) Three sentences for each concept.
(3.) Code for each concept.
(4.) Output for each concept.
Please submit all these information as a zipped folder (.zip only) in the Final Exam folder of the Blackboard course.
Candidates for this exam are seeking to prove core software development skills. It is recommended that candidates be
familiar with the concepts of and have hands-on experience with the technologies described here either by taking
relevant training courses or by working with tutorials and samples available on MSDN and in Microsoft Visual Studio.
Candidates are expected to have some experience with C# or Microsoft Visual Basic.NET
Please review some of the questions and answers of the
Microsoft Software Development Fundamentals Exam
(https://www.itexams.com/exam/98-361)
This is Free But Requires Patience
Focus on what we covered (Beginning VB.NET).
However, you are welcome to review all of them and attempt only the VB.NET topics.
Student: Mr. C, you are giving us a final exam with the answers?
How nice of you?
Teacher: Yes of course, I am nice. 😊
But, please read on.
Please:
(1.) Review Past Questions and Answers
You may not do any of those questions because they have been done already.
(2.) Do not attempt any question already indicated by your colleague.
If your colleague indicates by writing that he/she is working on a question, then you need to find another question.
No two or more students are permitted to do the same question.
(3.) Pick any five questions.
(4.) Go to the Final Exam Questions forum of the Blackboard course.
(5.) Write the question numbers in that forum only if it has not been written by any other student.
In other words, you need to review any questions posted by your colleagues and make sure that you do not attempt
the same question.
(6.) Explain the solutions of those five questions using your own explanations
and your code examples.
(7.) Number the questions, the solutions, your code examples and output, and your
explanations based on the actual question numbers.
(8.) Submit the actual questions, the corresponding numbered solutions, your
corresponding numbered explanations and your corresponding code examples and output and any other relevant
information in the Final Exam folder of the Blackboard course.
(9.) Make your work easy for me to grade.
In other words, write detailed clear specific explanations.
Do not give me any avenue to deduct points.
There are three options for your Final Project.
Please choose only one option.
This option is based on your textbook (MindTap course).
This implies that it is not free.
However, you have only one-week free access.
So, it is free if you can complete all the graded assessments in one week.
Access the MindTap Course
Please review the gradebook in the MindTap course to see the assessments that count for the Final Exam and the assessments
that count for the Final Project.
I shall manually grade those assessments that count for the Final Project.
The Quizzes (automatically graded) count for the Final Exam
The Exercises (manually graded) count for the Final Project
It is important you communicate with me for approval prior to doing this project.
Because the course deals with only desktop applications and console applications,
(rather than web applications and mobile applications), you may not do any project that requires a web server
such as contact forms and registration forms among others.
The final project is designed to assess problem-solving skills using the knowledge you have acquired in the
course.
In that regard, solving at least a real-world problem using the knowledge gained in the course is expected.
(1.) Think about any of these companies: our Institution: Kent State University; your local campus; your work place; public and
private schools (excluding home schools); organizations, firms, and businesses
(excluding controversial firms and the like).
Any company you choose should have a verifiable website.
The direct link of the company's website is required.
(2.) Identify a problem on the website that you want to solve.
The problem must be solved by programming using the knowledge acquired from any of the course
topics/concepts/description/learning objectives.
Think about your Midterm Project. You solved a problem: calculating bills, federal taxes, etc.
(3.) Develop the computer program to solve the problem.
Test the program to ensure that it works.
Write detailed comments as applicable.
(4.) Prepare a Documentation Manual/Reflection for the project.
Please cite your sources accordingly.
What is the company?
What is their website?
What problem did you identify?
Did you solve the entire problem or part of the problem?
What course topics/concepts/description/learning objectives did you apply in solving the problem?
How did you solve the problem?
Did you encounter any issues while trying to solve the problem?
Are there any limitations to the project?
Are there any recommendations to the company?
Deliverables:
(1.) Program (all files)
(2.) Clear screenshots of your program (code and output)
(3.) Project Reflection/Documentation Manual
Please submit all these information as a zipped folder (.zip only) in the Final Project folder of the Blackboard course.
The final project is designed to assess your understanding and analysis of data using the knowledge you have
acquired in the course.
Please:
(1.) Visit my website on: Descriptive Statistics
(2.) Review the information for a good understanding of Descriptive Statistics.
It is highly likely that you have a prior knowledge of this topic. Is that right?
(3.) Click the Project link.
(4.) Review the Project Examples. Ensure you follow all the instructions and directions.
(5.) Complete the Final Project for your course.
(6.) Ask questions. I can help.
If you have any issue at any time and you have reviewed the resources I provided and you cannot fix the issue,
please attend the Office Hours/Live Sessions so I can help you.
(7.) Include all these: (documentation of all your Math work and the .exe file) in OneDrive, create a
shareable link, and post the link in the Final Project Drafts forum of the course on Blackboard or send to me via email.
You may also upload them directly if you prefer.
I shall review and provide feedback.
(8.) Make sure your executable file runs by itself outside the project folder
If it does run, include these three items: single executable file (that runs by itself outside the folder), the
Math documentation (Word document that has the Math part), and the entire project folder, into a folder,
zip the folder (.zip extension only) and submit it in the appropriate area of the Blackboard course.
If it does not run, please fix it.
If you cannot fix it, please attend the Office Hours/Live Sessions so I can help you.
NOTE: Any actual project submitted to me via email will not be graded.
Advanced concepts of Visual Basic: Classes and Objects, Inheritance, Polymorphism, Arrays, Exception Handling, Files and Streams, DLLs. Prerequisite: IT 11002 or CS 13001 or EMAT 15310 or CIS 24065.
By the end of this course, you should be able to do the following:
(1.) Develop multiuser LAN-based Windows applications.
(2.) Create and handle events.
(3.) Create and use class modules and assemblies.
(4.) Design, creation, instantiation, and use of components.
(5.) Deploy an application.
Students will:
(1.) Textbook Chapter
(2.)
(3.)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type Object-oriented Programming in Visual Basic and/or OOP in VB in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type Object-oriented Programming in Visual Basic and/or OOP in VB in the search bar and view/read the results.
(1.) Textbook Chapter
(2.)
(3.)
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
The midterm project is designed to assess your knowledge of Object-oriented Programming in solving real-world problems.
It is a Piecewise Function application.
Any other application will not considered.
Please:
(1.) Visit my website on: Piecewise Functions
(2.) Read the Story to understand the idea of Piecewise functions.
(3.) Read the Overview of Piecewise Functions for more understanding of Piecewise
functions.
(4.) Study the Applications of Piecewise Functions
(5.) Review the Project Examples. Ensure you follow all the instructions and directions.
(6.) Review the Midterm Project rubric for your course.
(7.) Complete the Midterm Project for your course.
(8.) Ask questions. I can help.
If you have any issue at any time and you have reviewed the resources I provided and you cannot fix the issue,
please attend the Office Hours/Live Sessions so I can help you.
(9.) Include all these: (documentation of all your Math work and the .exe file) in OneDrive, create a
shareable link, and post the link in the Midterm Project Drafts forum of the course on Blackboard or send to me via email.
You may also upload them directly if you prefer.
I shall review and provide feedback.
(10.) Make sure your executable file runs by itself outside the project folder
If it does run, include these three items: single executable file (that runs by itself outside the folder), the
Math documentation (Word document that has the Math part), and the entire project folder, into a folder,
zip the folder (.zip extension only) and submit it in the appropriate area of the Blackboard course.
If it does not run, please fix it.
If you cannot fix it, please attend the Office Hours/Live Sessions so I can help you.
NOTE: Any actual project submitted to me via email will not be graded.
If you wish to save some time for research:
Please review the Piecewise Function projects done by my previous students.
The direct link of the verifiable websites are included.
(I.) VB.NET Projects
(II.) C# Projects
(III.) C++ Projects
(IV.) Java Projects
You may not do any same application done by any of my previous students for VB.NET
You may do any Piecewise Function application not done by any of my previous students for VB.NET
If you are not sure what project you may or may not do, please contact me via the school email.
Students will:
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic> in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
Each question in this tab is to be done by only one student.
You do not need to respond to the initial post of another student.
(1.)
Students will:
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic> in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
Each question in this tab is to be done by only one student.
You do not need to respond to the initial post of another student.
(1.)
Students will:
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic> in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
Each question in this tab is to be done by only one student.
You do not need to respond to the initial post of another student.
(1.)
Students will:
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic> in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
Each question in this tab is to be done by only one student.
You do not need to respond to the initial post of another student.
(1.)
Students will:
(1.) Textbook Chapter
Videos:
Please click the RESOURCES tab of this website
Click the LinkedIn Learning (Kent State University) link
Follow the directions to access the website.
(4.) Type to be given later or type the topic> in the search bar and view the results.
Videos and Textbooks:
Please click the RESOURCES tab of this website
Click the O'Reilly Online Learning link
Follow the directions to access the website.
(5.) Type to be given later or type the topic in the search bar and view/read the results.
Each question in this tab is to be done by only one student.
You do not need to respond to the initial post of another student.
(1.)
There are two options for your Final Exam
Please choose only one option.
This exam is designed to assess your understanding of the advanced VB.NET concepts.
You have reviewed several topics and several concepts in each topic for eight modules.
Pick at least $1$ concept in at least $1$ topic in each of the $8$ modules.
That gives at least $8$ concepts in $8$ different topics in $8$ modules.
Find two more concepts in any topic in any module.
That gives $10$ concepts.
For each concept, please:
(1.) Write at least three sentences about that concept.
(2.) Develop a program about that concept.
In other words, write at least one code example about the concept.
Run the code.
Display the output.
Submit clear screenshots of your program (code and output)
Deliverables:
(1.) $10$ concepts in $10$ different topics for $8$ modules
Please write the: Module number, the Topic, and the Concept
(2.) Three sentences for each concept.
(3.) Code for each concept.
(4.) Output for each concept.
Please submit all these information as a zipped folder (.zip only) in the Final Exam folder of the Blackboard course.
Candidates for this exam are seeking to prove core software development skills. It is recommended that candidates be
familiar with the concepts of and have hands-on experience with the technologies described here either by taking
relevant training courses or by working with tutorials and samples available on MSDN and in Microsoft Visual Studio.
Candidates are expected to have some experience with C# or Microsoft Visual Basic.NET
Please review some of the questions and answers of the
Microsoft Software Development Fundamentals Exam
(https://www.itexams.com/exam/98-361)
This is Free But Requires Patience
Focus on what we covered (Advanced VB.NET).
However, you are welcome to review all of them and attempt only the advanced VB.NET topics.
Student: Mr. C, you are giving us a final exam with the answers?
How nice of you?
Teacher: Yes of course, I am nice. 😊
But, please read on.
First-come, first-served basis
A particular question may NOT be done by more than one student.
In other words, no two or more students are permitted to do the same question.
Please:
(1.) Pick any five questions.
(2.) Go to the Final Exam Questions forum of the Blackboard course.
(3.) Write the question numbers in that forum only if it has not been written by any other student.
In other words, you need to review any questions posted by your colleagues and make sure that you do not attempt
the same question.
(4.) Explain the solutions of those five questions using your own explanations
and your code examples.
(5.) Number the questions, the solutions, your code examples, and your
explanations based on the actual question numbers.
(6.) Submit the actual questions, the corresponding numbered solutions, your
corresponding numbered explanations and your corresponding code examples and any other relevant
information in the Final Exam folder of the Blackboard course.
(7.) Make your work easy for me to grade.
In other words, write detailed clear specific explanations.
Do not give me any avenue to deduct points.
There are two options for your Final Project.
Please choose only one option.
It is important you communicate with me for approval prior to doing this project.
The final project is designed to assess problem-solving skills using the knowledge you have acquired in the
course.
In that regard, solving at least a real-world problem using the knowledge gained in the course is expected.
(1.) Think about any of these companies: our Institution: Kent State University; your local campus; your work place; public and
private schools (excluding home schools); organizations, firms, and businesses
(excluding controversial firms and the like).
Any company you choose should have a verifiable website.
The direct link of the company's website is required.
(2.) Identify a problem on the website that you want to solve.
The problem must be solved by programming using the knowledge acquired from any of the course
topics/concepts/description/learning objectives.
Think about your Midterm Project. You solved a problem: calculating bills, federal taxes, etc.
(3.) Develop the computer program to solve the problem.
Test the program to ensure that it works.
Write detailed comments as applicable.
(4.) Prepare a Documentation Manual/Reflection for the project.
Please cite your sources accordingly.
What is the company?
What is their website?
What problem did you identify?
Did you solve the entire problem or part of the problem?
What course topics/concepts/description/learning objectives did you apply in solving the problem?
How did you solve the problem?
Did you encounter any issues while trying to solve the problem?
Are there any limitations to the project?
Are there any recommendations to the company?
Deliverables:
(1.) Program (all files)
(2.) Clear screenshots of your program (code and output)
(3.) Project Reflection/Documentation Manual
Please submit all these information as a zipped folder (.zip only) in the Final Project folder of the Blackboard course.
The final project is designed to assess your understanding and analysis of data using the knowledge you have
acquired in the course.
Please:
(1.) Visit my website on: Descriptive Statistics
(2.) Review the information for a good understanding of Descriptive Statistics.
It is highly likely that you have a prior knowledge of this topic. Is that right?
(3.) Click the Project link.
(4.) Review the Project Examples. Ensure you follow all the instructions and directions.
(5.) Complete the Final Project for your course.
(6.) Ask questions. I can help.
If you have any issue at any time and you have reviewed the resources I provided and you cannot fix the issue,
please attend the Office Hours/Live Sessions so I can help you.
(7.) Include all these: (documentation of all your Math work and the .exe file) in OneDrive, create a
shareable link, and post the link in the Final Project Drafts forum of the course on Blackboard or send to me via email.
You may also upload them directly if you prefer.
I shall review and provide feedback.
(8.) Make sure your executable file runs by itself outside the project folder
If it does run, include these three items: single executable file (that runs by itself outside the folder), the
Math documentation (Word document that has the Math part), and the entire project folder, into a folder,
zip the folder (.zip extension only) and submit it in the appropriate area of the Blackboard course.
If it does not run, please fix it.
If you cannot fix it, please attend the Office Hours/Live Sessions so I can help you.
NOTE: Any actual project submitted to me via email will not be graded.
Dear Students,
Greetings to you.
As you evaluate me and my teaching style on the Blackboard course, I ask that you consider these questions
in addition to the survey questions.
Thank you for giving me the opportunity to teach the course.
It was nice working with you.
I wish you the best in your academic profession.
Thank you!
Samuel Dominic Chukwuemeka (SamDom For Peace)
B.Eng., A.A.T, M.Ed., M.S
Working together for success
Grading Method: Grading Method
Classroom/Learning Environment: Blackboard course management system.
Course Assessments: Discussion Board (DB) assignments, Midterm Project, Final Project and the Final Exam
Direct forms of communication: live office hours/tutoring sessions, emails, comments to your DB posts and responses and
phone calls.
Indirect forms of communication: course announcements, websites (notes, videos, etc).
Course Contents
Please review the Course Description and Student Learning Outcomes
It is the first link in your course.
Those are the basic topics that KSU require that I teach.
(1.) Did I cover those topics: teaching and/or providing resources for those topics?
(2.) Did I cover other necessary topics that is relevant for you to succeed in your profession?
(3.) Did the assessments demonstrate the application of the topics?
(4.) Did the contents and assessments demonstrate important skills such as critical thinking, use of technology,
creativity, and organization among others?
Teaching and Learning
(5.) Did you acquire any knowledge from me?
(6.) Did you acquire sufficient knowledge, or more than sufficient knowledge from me?
(7.) Did you acquire any knowledge from any of your colleagues because of how the course was set up?
(8.) Did you acquire sufficient knowledge, or more than sufficient knowledge from any of your colleagues because of
the way the course was set up?
(9.) Did I provide multiple ways of completing each assessment?
In other words, were you given several options of completing each assessment?
(10.) Did I provide effective feedback for any of your assessments?
(11.) Did you acquire any knowledge based on that feedback?
(12.) Did the feedback help you improve in any way?
(13.) Did you have enough support to ensure the successful completion of the course?
Were your questions answered?
Did you have enough resources/learning aids?
(14.) Did I provide a safe and conducive environment for learning?
(15.) Was the Grading Method fair?
Pacing Guide
(16.) Were you given enough time to learn the contents?
(17.) Were you given enough time to complete the assessments?
Consider the fact that you were given two due dates for your Midterm Project, Final Project, and Final Exam; and that there
was no penalty for late work after the first due date.
Professionalism
(18.) In all our communication (both direct and indirect), did I act professionally?
(19.) In all our communication (both direct and indirect), did I use a respectful tone?
(20.) What do you like or dislike about our communication?
Personality
(21.) Based on your experience with me (taking the course with me and communicating with me among others), how
would you describe my person?
Do I give a lot of work?
Do I give a lot of explanations?
Do I have a lot of expectations for my students?
Do I really want you to learn?
Do I really want you to succeed?
Do I ask a lot of questions?
Do I answer questions with questions sometimes?
In those times, please note that it is a teaching technique.
It is never meant to disrespect you. I do not disrespect my students. I respect them.
It is a technique to guide you to review directions/concepts, and explain what you do not understand.
Would you take another course with me? Why or why not?
Did your views/perception about me affect you in completing this course successfully or unsuccessfully?
Need a programmer for personal/professional/commercial projects?
Look no further. Any of my available students (not just the ones listed here) can help.
Just head on to the Division of Student Affairs, Kent State University
or contact me here or via my school email address.
These are nice projects done by my students.
Some of them are Midterm Projects while some are Final Projects.
Because of FERPA (Federal Educational Rights and Privacy Act) laws, only the first names of my students are
written.
(1.) GPA Calculator for Kent State University by Connor
As at today: 05/06/2021, the verifiable website for this application is: GRADE POINT AVERAGE (GPA) | Kent State University
(http://catalog.kent.edu/academic-policies/grade-point-average/)
(2.) City of Dover, Ohio: Dover Light and Power: Residential Rates by Dino
As at today: 04/28/2021, the verifiable website for this application is: Welcome to the City of Dover, Ohio - Compare Rates
(https://www.doverohio.com/compare-rates)
(3.) Current Water Rates (Billed Monthly) by Andrew
As at today: 04/28/2021, the verifiable website for this application is: Current Water Rates (Billed Monthly) | Stark County Government
(https://www.starkcountyohio.gov/sanitary-engineers/departments/billing-department/water-billing/current-water-rates-billed-monthly)
(4.) City of Akron Current Water Rates by Michael
As at today: 04/08/2021, the verifiable website for this application is: Water and Sewer Rates: City of Akron
(https://www.akronohio.gov/cms/site/dced0363af40e9b7/index.html)
(5.)
Georgia Public Service Commission: Winter Rate (October - May)
by Gabriel
As at today: 04/03/2021, the verifiable website for this application is:
Georgia Power Bill Calculator: Winter Rate (October - May)
(http://www.psc.state.ga.us/calc/electric/GPcalc.asp)
(6.) Holmes-Wayne Electric Cooperative, Inc. Rate class: farm/residential: Power Rates
by Jason
As at today: 04/08/2021, the verifiable website for this application is:
Holmes-Wayne Electric Cooperative, Inc., Adjusted Rates and Charges
(https://www.hwecoop.com/sites/holmeswayne/files/2020Rate%20List.pdf)
(7.) Tuition Rates - Tuscarawas Central Catholic Junior/Senior High School
by Jason
As at today: 05/10/2021, the verifiable website for this application is: Tuscarawas Central Catholic JSHS - New Philadelphia, OH
(https://www.tccsaints.com/tuition-rates)
(8.) $2020-2021$ Federal Tax: Head of Household Filing Option
by Joel
As at today: 05/10/2021, the verifiable website for this application is: IRS.com (This is NOT IRS.gov)
(https://www.irs.com/articles/2020-federal-tax-rates-brackets-standard-deductions/)
(9.) $2020-2021$ Federal Tax: Married Filing Jointly or Qualifying Widow(er) Filing Option
by Brandon
As at today: 04/19/2021, the verifiable website for this application is: IRS.com (This is NOT IRS.gov)
(https://www.irs.com/articles/2020-federal-tax-rates-brackets-standard-deductions/)
(10.) $2020-2021$ Federal Tax: Single Filing Option
by Connor
As at today: 04/03/2021, the verifiable website for this application is: IRS.com (This is NOT IRS.gov)
(https://www.irs.com/articles/2020-federal-tax-rates-brackets-standard-deductions/)
(11.) Panera Bread Dietary Sandwich Builder
by Gabriel
As at today: 05/10/2021, the verifiable website for this application is: Panera Bread: Clean Food for Breakfast, Lunch & Dinner
(https://www.panerabread.com/en-us/home.html)
(1.)
Visual Basic Tutorials by Microsoft (Free)
Visual Basic Documentation
Visual Basic Developer Community
American Standard Code for Information Exchange (ASCII) Characters
Sorting Techniques and Algorithms
LinkedIn Learning (Kent State University)
O'Reilly Online Learning
For Kent State University students, Select your Institution > Choose “Not Listed?
Click here.”
Enter your Kent State University email address and click Let’s Go
Visual Basic Notes for Professionals: Stack Overflow Documentation (Free)
Wikibooks: Visual Basic (Free)
Stack Overflow: Question and Answer Forum for Computer Science
Lynda.com/LinkedIn Learning (Start for Free. Then, not free)
Chukwuemeka, S.D (2016, April 30). Samuel Chukwuemeka Tutorials - Math, Science, and Technology.
Retrieved from https://www.samuelchukwuemeka.com
Free Visual Basic .NET Book. (n.d.). Books.Goalkicker.com. Retrieved January 16, 2021, from https://books.goalkicker.com/VisualBasic_NETBook/
KathleenDollard. (2018, March 28). Visual Basic. Microsoft.com. https://docs.microsoft.com/en-us/dotnet/visual-basic/
Zak, D. (2016). Programming with Microsoft Visual Basic 2015. Cengage Learning.