0% found this document useful (0 votes)
5 views

comprog

The document covers various programming concepts including C language, VB.NET, and Human-Computer Interaction (HCI). It discusses the importance of user interface design, principles of HCI, and provides an overview of Visual Basic and the .NET framework. Additionally, it includes examples of code outputs and variable declarations in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

comprog

The document covers various programming concepts including C language, VB.NET, and Human-Computer Interaction (HCI). It discusses the importance of user interface design, principles of HCI, and provides an overview of Visual Basic and the .NET framework. Additionally, it includes examples of code outputs and variable declarations in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

C langugae - for logic (ibibigay kung ano yung results ng code)

vb.net
Conditional statements
Looping statements
Looping derive to C language or java
syntax

HCI LECTURE 1:
Lecture Human-Computer Interaction
-​ A key design activity is to design the user interface
Human-computer interaction (HCI)
-​ the study of end users and their interaction with computers.
-​ For every input and output, the developer must consider the interaction between the
user and the computer
-​ user-interface design is often referred to as dialog design
The field of human-computer interaction investigates how people use computer systems so
that better systems can be designed.
-​ One aspect is concerned with technological innovation (e.g., better input devices, like
electronic pens, touch screens, etc.)
-​ The other aspect concerns the element human (e.g., how people reason, solve
problems, and interact with computers) – the most challenging aspect of HCI!
The User Interface
-​ Many people think of the user interface as a component added to the system near
the end of the development process.
-​ This view changes as user interfaces become more important and systems become
more interactive.
To the end user, the user interface is the system.
-​ The user interface is everything the end user comes into contact with while using the
system –
-​ Physically
-​ perceptually, and
-​ conceptually.
-​ Therefore, consideration of the user interface should come early in the development
process.

Physical Perceptual Conceptual

Desk, chair, light, keyboard, Windows, menus, dialog Customers, products,


mouse, touch screen, boxes, buttons, lines, orders, catalogs, adding,
keypad, manuals, printed shapes, textures, colors, deleting, updating, printing,
documents, paper forms. fonts, sounds, speech. select-click-drag-drop,
double-click-escape-click-cli
ck
HCI LECTURE 2:
Human-computer interface design
These are all examples of advances in human-computer interface design, which were
designed to make it easier to accomplish things with a computer.
●​ A Computer Mouse
●​ A Touch Screen
●​ A program on your Mac or Windows machine that includes a trashcan, icons of disk
drives, and folders
●​ Pull-down menus
Human-Computer Interface Design
-​ Human-Computer Interface Design seeks to discover the most efficient way to design
understandable electronic messages.
Shneiderman's Principles of Human-Computer Interface Design:
1. Recognize Diversity
-​ take into account the type of user frequenting your system, ranging from novice user,
knowledgeable but intermittent (irregular) user, and expert frequent user
Each type of user expects the screen layout to accommodate their desires
●​ novices needing extensive help
●​ experts wanting to get where they want to go as quickly as possible
●​ Accommodating both styles on the same page can be quite challenging
●​ You can address the differences in users by including both menu or icon choices as
well as commands (ie. Command or Control P for Print as well as an icon or menu
entry) or providing an option for both full descriptive menus and single letter
commands.
2. Prevent Errors
-​ The second principle is to prevent errors whenever possible.
-​ Steps can be taken to design so that errors are less likely to occur, using the 8
golden rules.
-​ Expect users to make errors, try to anticipate where they will go wrong, and design
with those actions in mind.
Norman's Research
-​ "make it easy to determine what actions are possible at any moment” for example:
-​ well-designed things can only be put together in certain ways (USB port - I can only
plug it in one way)
Eight Golden Rules of Interface Design:
1. Strive for consistency
-​ consistent sequences of actions should be required in similar situations
-​ identical terminology should be used in prompts, menus, and help screens
-​ consistent color, layout, capitalization, fonts, and so on should be employed
throughout.
2. Enable frequent users to use shortcuts
-​ to increase the pace of interaction using abbreviations, special keys, hidden
commands, and macros .– Ex. ALT+F or CTRL+C or F1 or SHIFT+A
3. Offer informative feedback
-​ for every user action, the system should respond in some way (in web design, this
can be accomplished by DHTML - for example, a button will make a clicking sound or
change color when clicked to show the user something has happened)
4. Design dialogs to yield closure
-​ Sequences of actions should be organized into groups with a beginning, middle, and
end. The informative feedback at the completion of a group of actions shows the user
their activity has been completed successfully
5. Offer error prevention and simple error handling
-​ design the form so that users cannot make serious errors; for example, prefer menu
selection to form fill-in and do not allow alphabetic characters in numeric entry fields
-​ if users make an error, instructions should be written to detect the error and offer
simple, constructive, and specific instructions for recovery
6. Permit easy reversal of actions
7. Support internal locus of control
-​ Experienced users want to be in charge. Surprising system actions, tedious
sequences of data entries, inability or difficulty in obtaining necessary information,
and inability to produce the action desired all build anxiety and dissatisfaction.
8. Reduce short-term memory load
-​ A famous study suggests that humans can store only 7 (plus or minus 2) pieces of
information in their short-term memory.
-​ You can reduce short-term memory load by designing screens where options are
clearly visible, or using pull-down menus and icons menus only display the actions
that can be carried out at that time (other options are dimmed).
-​ "Make things visible, including the conceptual model of the system, the alternative
actions, and the results of actions". You can provide an overview map of your site so
that your user can design their own mental map of how things work.
Introduction to reports
-​ When you use a database, you typically use reports to view, format, and summarize
data.
-​ A report is a database object that you use to display and summarize data.
-​ Reports provide a way to distribute or archive snapshots of your data, either by being
printed out, converted to PDF or XPS files, or exported to other file formats.
Types of Report
Columnar
-​ Simplest type
-​ list all the fields from the data source vertically down the page, one record at a time
-​ Columnar (one record at a time
Tabular
-​ Display selected fields in a row
-​ One record per row

Anatomy of a Report

Report header & footer


-​ This section is printed just once, at the beginning of the report.
Page header & footer
-​ This section is printed at the top of every page.
Group header & footer
-​ This section is printed at the end of each group of records.
Detail section
-​ This section is printed once for every row in the record source
Report header & footer
-​ Use the report header for information that might normally appear on a cover page,
such as a logo, a title, or a date once.
Page header & footer
-​ For example, use a page header to repeat the report title on every page.
Group header & footer
-​ Use a group footer to print summary information for a group.
Detail section
-​ This section is printed once for every row in the record source.
UNIT 1: GETTING STARTED WITH VISUAL BASIC .NET
HISTORY
-​ JAVA vs Microsoft
-​ C++ and VB
-​ .NET Technology
-​ secret project called Next Generation Windows Services (NGWS)., under the direct
supervision of Mr. Bill Gates
-​ Web and Windows desktop application
-​ Microsoft announced .NET to the world in June 2000 and released version 1.0 of the
.NET framework in January 200
WHAT IS VISUAL BASIC?
-​ It is visual
-​ It uses GUI (Graphical User Interface)
-​ BASIC (Beginners All Purpose Symbolic Instruction Code)
-​ VB is used to develop Windows applications
-​ Easy to learn
WHY IS VISUAL BASIC POPULAR?
Three most important reasons:
-​ GUI development
-​ RAD (Rapid Application Development)
-​ OOP (Object-Oriented Programming)
WHAT IS OOP AND DESIGN?
The major construct of OOP:
●​ Objects
●​ Abstraction
●​ Inheritance
●​ polymorphism
●​ Encapsulation
• Data (properties)
• Function (method)
• Information hiding
VB is ideal for applications that run on Windows Operating System
●​ 3 step approach:
●​ 1. Design the appearance/interface of the application
●​ 2. Assign property settings to the objects of the program
●​ 3. Write the code to direct specific tasks at runtime

-​ BASIC, in computer science, is an acronym for. Beginner's All-purpose Symbolic


Instruction Code
-​ A high-level programming language developed by John Kemeny and Thomas Kurtz
at Dartmouth College in the mid-1960s.
-​ BASIC gained enormous popularity mostly because of two implementations, Tiny
BASIC and Microsoft BASIC, which made BASIC the first lingua franca of
microcomputers.
-​ The goal of BASIC is to make programming simple and easy.
Visual Is a method used to create the Graphical User Interface (GUI).
❑ Graphical User Interface (GUI), in computer science,
-​ ❑a display format
-​ ❑by pointing to pictorial representations (icons) and lists of menu items on the
screen. Choices can generally be activated either with the keyboard or with a mouse.
-​ ❑ In computer science, it means Windows communicates with the user through
icons and pictures.
-​ It all began in the year 1991 in the brainchild of Allan Cooper.
-​ Knowing him he is considered the “Father of Visual Basic”.
-​ Visual Basic was first named “Thunder” before it was under Microsoft.
Visual BASIC
-​ Is an event-driven language used to create application programs that run under a
Windows-based operating system environment.

WHAT IS MICROSOFT .NET FRAMEWORK?


-​ The Microsoft .Net Framework is a platform that provides the tools and technologies
you need to build Networked Applications as well as Distributed Web Services and
Web Applications.
BUILDING BLOCKS OF .NET
●​ CLR (Common Language Runtime)
-​ To locate, load, and manage .NET types •
-​ Automatic memory management, language integration, and type safety
●​ CTS (Common Type System)
-​ Describes all possible data types and programming constructs supported by
the runtime
●​ CLS (Common Language Specification)
-​ A set of rules that defines a subset of types and specifications
BASE CLASS LIBRARIES
-​ Encapsulates various primitives like: threads, file IO, graphical rendering, and other
interactions with HW devices
-​ It also provides: database manipulation, XML integration, and Web-enabled
front-end.
.NET NAMESPACE
-​ C# uses the namespace concept
-​ Any language targeting the .NET runtime makes use of the same namespaces and
the same types as C#
-​ The system is the root namespace
Chapter 3: Using Variables and Constant
Using Variables and Constant
-​ Variables-temporary storage of data
-​ Data type determines the type of data the variable can store.
Selecting a name for a variable
Data type ID Example

Boolean bln blnInsured


Decimal dec decGrossPay
Double dbl dblSales
Integer int intNumSold
String str strFirstName

Rules for Naming Variables


1. The name must begin with a letter or an underscore.
2. The name can contain only letters, numbers, and the underscore character. No
punctuation characters, special characters, or spaces are allowed in the name.
3. Although the name can contain thousands of characters, 32 characters is the
recommended maximum number of characters to use.
4. The name cannot be a reserved word, such as Sub or Double.
Valid names
intFeb_Income, decSales2014, dblEastRegion, strName, blnIsValid

Invalid names Problem


4thQuarter the name must begin with a letter or an underscore
dblWest Region the name cannot contain a space
strFirst.Name the name cannot contain punctuation
decSales$East the name cannot contain a special character
Declaring a variable
Variable Declaration Statement
Syntax
(Dim | Private | Static) variableName As dataType [= initialValue]

Example 1
Dim intNumSold As Integer
Dim dblTaxRate As Double
declares an Integer variable named intNumSold and a Double variable named db1TaxRate;
the variables are automatically initialized to 0

Example 2
Dim decPay As Decimal
declares a Decimal variable named decPay; the variable is automatically initialized to 0

Example 3
Dim blnInsured As Boolean = True
declares a Boolean variable named blnInsured and initializes it using the keyword True
Example 4
Dim strMsg As String = "Good Night"
declares a String variable named strMsg and initializes it using the string "Good Night"

Assigning Data to an Existing Variable


words, the comr

Syntax

Assigning a Value to a Variable during Run Time

variableName = expression
Note: In each of the following examples, the data type of the expression assigned to the
variable is the same as the data type of the variable itself.

Example 1
intNumber = 25
assigns the integer 25 to the intNumber variable

Example 2
strName = "Karen"
assigns the string "Karen" to the strName variable

Example 3
strCity = txtCity.Text
assigns the string contained in the txtCity control's Text property to the strCity variable

Example 4
dblInterestRate = .09
assigns the Double number .09 to the dblInterestRate variable

Example 5
decTaxRate = .06D
converts the Double number .06 to Decimal and then assigns the result to the decTaxRate
variable

Example 6
dblBonus = dblSales * .05
multiplies the contents of the db1Sales variable by the Double number .05 and then assigns
the result to the db1Bonus variable

The TryParse Method


The Convert Class Method
Quiz

Code: Output:

#include <stdio.h> c is greater than

int a = 4, b = 3, c = 10;

int main() {
if (c > (a - b * 5))
printf("c is greater than\n");
else
printf("c is less than\n");

return 0;
}

Code: Output:

#include <stdio.h> 22
46
int x=0, y=0; 612
int main() 820
{ 1030
while (x!=10)
{
x=x+2;
y=y+x;
printf("%d%d\n", x,y);
}
return 0;
}

Code: Output:

#include <stdio.h> 12
34
int main() { 56
int x; 78
9 10
for (x = 1; x <= 10; x = x + 2) {
printf("%d %d\n", x, x + 1);
}
return 0;
}
Code: Output:

#include <stdio.h> 1
2
int x, sum; 3
int main() 4
{ 5
x = 1; 6
sum = 0; 7
do 8
{ 9
sum=sum+x; 10
printf("%d\n",x); The sum is 55
x++;
} while (x <= 10);
printf("The sum is %d",sum);
return 0;
}

Which of the for loop that counts from 0 to 5

a.​ for (int c = 0; c <= 6; c++)


b.​ for (c = 0; c < 5; c++)
c.​ for (c = 0; c < 5; c++);
d.​ for (c = 0; c <= 5; c++)
e.​ for (c = 0; c < 6; c++);

Which of the for loop that counts from 5 to 0

a.​ for (int c = 5; c >= 0; c--)


b.​ for (c = 5; c > 0; c--)
c.​ for (c = 5; c > 0; c--);
d.​ for (c = 5; c >= 0; c--)
e.​ for (c = 5; c < 0; c--);

Which of the following is the right syntax for (for loop)


for (initialization; condition; increment/decrement) {
// Code to be executed repeatedly
}
What is the output of the program segment below:

Code: Output:

#include <stdio.h> 2
2
int main() 2
2
{
2
int a; 2
for (a = 0; a < 5; a++) 2
{ 2
a = 2; 2
printf("%d\n", a); 2
} 2
2
return 0;
2
} 2

a.​ Will print a number from 0 to 5


b.​ Will print a number from 0 to 4
c.​ Will generate an Infinite loop of 2 in the screen
d.​ None of the above

Binary Decimals

1.​ 1 1.​ 1
2.​ 10 2.​ 10
3.​ 11 3.​ 11
4.​ 100 4.​ 100
5.​ 101 5.​ 101
6.​ 110 6.​ 110
7.​ 111 7.​ 111
8.​ 1000 8.​ 1000
9.​ 1001 9.​ 1001
10.​1010 10.​1010
11.​1011 11.​1011
12.​1100 12.​1100
13.​1101 13.​1101
14.​1110 14.​1110
15.​1111 15.​1111
16.​10000 16.​10000
17.​10001 17.​10001
18.​10010 18.​10010
19.​10011 19.​10011
20.​10100 20.​10100
21.​10101 21.​10101
22.​10110 22.​10110
23.​10111 23.​10111
24.​11000 24.​11000
25.​11001 25.​11001
26.​11010 26.​11010
27.​11011 27.​11011
28.​11100 28.​11100
29.​11101 29.​11101
30.​11110 30.​11110
31.​11111

Name Syntax

-​ For Loop for (initialization; condition; increment/decrement) {


// Code to execute repeatedly
}

-​ While Loop​ ​ while (condition) {


​ // Code to execute repeatedly
}

-​ Do-while​ ​ do {
​ // Code to execute repeatedly
} while (condition);

-​ Nested Loops​ for (initialization1; condition1; increment1) {


for (initialization2; condition2; increment2) {
// Code to execute repeatedly
}
}

-​ Infinite Loops​ while (1) {


// Code to execute indefinitely
}

-​ Goto Loops goto label;


...
label:
// Code to execute

-​ Break and Continue for (int i = 0; i < 10; i++) {


if (i == 5) {
break; // Exit the loop
}
if (i % 2 == 0) {
continue; // Skip even numbers
}
printf("%d\n", i);
}
-​ If Statement if (condition) {
// Code to execute if the condition is true
}

-​ If-else​ ​ if (condition) {
// Code to execute if the condition is true
} else {
// Code to execute if the condition is false
}

-​ Else-if if (condition1) {
// Code to execute if condition1 is true
} else if (condition2) {
// Code to execute if condition2 is true
} else {
// Code to execute if none of the conditions are true
}

-​ Nested if statements if (condition1) {


if (condition2) {
// Code to execute if both condition1 and condition2 are
true
}
}

-​ Switch Case switch (expression) {


statements case constant1:
// Code to execute if expression == constant1
break;
case constant2:
// Code to execute if expression == constant2
break;
default:
// Code to execute if expression doesn't match any case
}

-​ Ternary Operator condition ? expression1 : expression2;

-​ Arithmetic Operator​ +​ Addition


-​ Subtraction
* Multiplication
/ Division
% Modulus (Remainder)

-​ Relational Operators​ == Equal to


!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

-​ Logical Operators​ AND && needs both operands to be true


OR || any of the two are true, the results are true
NOT ! reverse the logical state
-​ Assignment Operators = Simple assignment a=b

+= Add and assignment a += b

-= Subtract and assignment a -= b

*- Multiply and assignment a *= b


/= Divide and assignment a /= b

%= Modulus and assignment a %= b

Pre-increment ++a a = 5; b = ++a a=6b=6


Post-increment a++ a = 5; b = a++ a=6b=5
Pre-decrement --a a = 5; b = -- a a=4b=4
Post-decrement a-- a = 5; b = a-- a=4b=5

https://quizizz.com/join?gc=39 39928296
928296

You might also like