Wednesday, October 7, 2015

Chapter 4 - Basic Programming in Java



Image result for programming
      
   Programming helps you understand the computers.
A set of rules that provides a way of telling a computer what operations to perform is called a programming language.

program is a set of step-by-step instructions that directs the computer to do the tasks you want it to do and produce the results you want. Programmer’s job is to convert problem solutions into instructions for thecomputer.
Programmer prepares instructions of a computer program.
The programming Process
}Defining the problem
}Planning the solution
}Coding the program
}Testing the program
}Documenting the program
Symbol    Meaning
}==     Equals
}!=     Not Equal
}<     Less than
}<=     Less than or equal to
} >    Greater than
}>=     Greater than or equal to
Programming as a Career
The Joys of the Field
What It Takes  
Open Doors 
Levels of Language 
}Machine language
}Assembly languages
}High-level languages
}Very high-level languages
}Natural languages
Flowchart
is a type of diagram that represents an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.
a picture of the separate steps of a process in sequential order.
Flowchart Basic Procedure
}Define the process to be diagrammed. Write its title at the top of the work surface.
}Discuss and decide on the boundaries of your process: Where or when does the process start? Where or when does it end? Discuss and decide on the level of detail to be included in the diagram.
}Brainstorm the activities that take place. Write each on a card or sticky note. Sequence is not important at this point, although thinking in sequence may help people remember all the steps.
Algorithm
-procedure or formula for solving aproblem.
-a step-by-step procedure for solving aproblem.
How does it work?
Start with input  > Do complex calculations > Stop when we find the answer 
Flowchart and Pseudocode
Write a program that reads two numbers and displays the numbers in decreasing order.


Variables and Data types


          Create a program that will let the user input its name and password, if input name and password is correct end the program. If Name and password is wrong end the program.
Variables in Java have a type.
The type defines what kinds of values a variable is allowed to store.
Integer Types:
int: Most numbers you’ll deal with.
long: Big integers; science, finance, computing.
short: Small integers. Legacy. Not very useful.
byte: Very small integers, useful for generic data.Floating Point (Decimal) Types:
float: Single-precision decimal numbers
double: Double-precision decimal numbers.
Other Types:
String: Text strings.
boolean: True or false.
char: Latin Alphanumeric Characters
Variable names (or identifiers) may be any length, but must start with:
A letter (a – z),
A dollar sign ($),
Or, an underscore ( _ ).
Identifiers cannot contain special operation symbols like +, -, *, /, &, %, ^, etc.
Certain reserved keywords in the Java language are illegal.
For example, “class”, “static”, “int”, etc.
Java is a case-sensitive - capitalization matters.
“Camel Case”: Start variable names with lower case and capitalize each word: “camelsHaveHumps”.
Data Type
Description
byte
Variables of this kind can have a value from:
-128 to +127 and occupy 8 bits in memory
short
Variables of this kind can have a value from:
-32768 to +32767 and occupy 16 bits in memory
int
Variables of this kind can have a value from:
-2147483648 to +2147483647 and occupy 32 bits in memory
long
Variables of this kind can have a value from:
-9223372036854775808 to +9223372036854775807 and occupy
 64 bits in memory

Chapter 5 - Introduction to Web Development


   The INTERNET is a network of computers, which links many different types of computers all over the world. 
Image result for internet

Basic Services 
OThe INTERNET
§ Electronic Mail (E-Mail) –
Allow user to send a mail (message ) to another internet user in any part of the world in a near-real-time manner .
§ File Transfer Protocol (FTP) –
Allow user to move a file from one computer to another on the internet.
§ Telnet –
Allow a user to log into another computer somewhere on the internet . 
The World Wide Web (WWW)
Image result for internet
§
 World Wide Web or W3 is the most popular and promising method of organizing and accessing information on the INTERNET.
§ Hypertext is a new way of information storage and retrieval that enables authors to structure information in novel ways.
Image result for internet§ A properly designed hypertext document can help users to locate desired type of information rapidly.
§ Hypertext documents enable this by using a series of link.
§ A link is a special type of item in a hypertext document connecting the document to another document.
§ Hypertext documents on internet are known as Web Pages. 
Some important current strategic of the INTERNET are :  
q On-line communication
q Software sharing
q Exchange of views on topics of common interest
q Posting of information of general interest
q Organization promotion
q Product promotion and feedback about products
q Customer support service
q On-line journals, magazines, Encyclopedia, and dictionary
q On-line shopping

q World-wide conferencing


Programming with Java statements



 Understanding Assignment Statements
An assignment statement sets a value within a variable

All assignment are considered to be expression statements
Image result for java statementExpressions in Java are anything that has a value

Typically, expressions evaluate to primitive types
Commonly known simply as assignment statements, are designed to assign values to variables and must be terminated with a semicolon
Variable = value;
On the left is the variable that will be associated with the memory and type necessary to store the value. On the right is a literal value.
The if conditional Statement
The if statement is designed to conditionally execute a statement or conditionally decide between a choice of statements.will execute only one statement upon the condition, unless braces are supplied. Braces allow for multiple enclosed statements to be executed. This group of statements is also known as a block,evaluate to a boolean value,The elseclause is optional and may be omitted
The if-then conditional Statement
The if-then statement is used when multiple conditions need to flow through a decision-based scenario
The if-then-else conditional Statement
The main difference is that the code will fall through to the final stand-alone else when the expression fails to return true for any condition
The switch conditional Statement
It is used to match the value from a switch statement expression against a value associated with a case keyword. Once matched, the enclosed statements associated with the matching case value are executed, unless a break statement is encountered
. Understanding Iteration Statements
Iteration statements are used when there is a need to iterate through pieces of code
Iteration statements include for loop, enhanced for loop, and the while and do-while statements.
The for loop Iteration Statement
The expression within the for loop must be evaluated to aboolean value
The iteration, also known as the update part, provides the mechanism that will allow the iteration to occur
The enhanced for loop Iteration Statement
Image result for java
It is used to iterate through an array, a collection, o
r an object that implements the interface iterable.
It is also commonly known as the for each loop
The while Iteration Statement
This loop evaluates an expression and executes the loop body only if the expression evaluates to true
The do-while Iteration Statement
It is very similar to the while loop, except that it always executes the body at least once
4. Understanding Transfer of Control Statements
Transfer of control statements include the breakcontinueand return statements





HTML

Image result for html


To create a bulleted list you need to add a <ul> and a </ul> tag at the beginning and the end of the list. 
Numbered lists have <ol> tags instead of <ul> tags.

To separate single list items use <li> and </li> tags.

There are special settings that you can use to customize the lists on your page.

On the following two pages you can learn in detail about bulleted and numbered lists.
žWeb pages are text files containing HTML

žHTML – Hyper Text Markup Language
A notation for describing
document structure (semantic markup)
formatting (presentation markup)
Looks (looked?) like:
  A Microsoft Word document
žThe markup tags provide information about the page content structure
žAn HTML file must have an .htm or .html file extension
žHTML files can be created with text editors:
NotePad, NotePad ++, PSPad
Or HTML editors (WYSIWYG Editors):
Image result for html
Microsoft FrontPage
Macromedia Dreamweaver

Netscape Composer
Expression Web
žHTML is comprised of “elements” and “tags
Begins with <html> and ends with</html>
When writing XHTML, must define a namespace

žElements (tags) are nested one inside another:
žTags have attributes:
HTML describes structure using two main sections
       <head> and <body>
Now we are able to start learning about HTML tags. An HTML tag will always begin with a "less than" sign, like this: <. The tags will end with a "greater than" sign, like this: >. An example would be the tag used to underline text, <u>. You would place this before the text you want to underline. This is called an opening tag, which begins the operation you wish to perform. In order to end the underlining, you must use a closing tag. A closing tag will be the same as the opening tag, but will have a forward slash before the command, like this: </u>. So, if you would like to underline the phrase "HTML Rules!", you would write the following in your text editor:
<u>HTML Rules!</u>
The result of this would be:
HTML Rules!
In the past, not all tags would require a closing tag. An example would be the image tag, which places an image on the page. It looks like this: