Tuesday, 29 September 2015

Class 7 - Ch 7

Formatting tags
 
 
 
The formatting tags are used to give a stylish appearance to the text in the web page.
 
 
Bold
 
The text appears darker.
 
<b> ..... </b>
 
Italics
 
The text appears different(slanting).
 
<I>....</I>
 
Underline
 
There is a line below the text.
 
<U>.....</U>
 
Strikethrough
 
A line is drawn across the text.
 
<Strike>....</Strike>
 
Superscript
 
Text appears above the text.
 
<Sup>....</Sup>
 
Subscript
 
Text appears below the text
 
<Sub>.....</Sub>
 
Center
 
Text appears in the middle of the screen.
 
<Center>....</Center>
 

<html>
<head>
<title>
Friends
</title>
</head>
<body bgcolor=olive text =white>
<center><h1>FRIENDS</h1></center>

Written with a pen, sealed with a kiss,<br>
 If you are my <b>friend </b>, please answer me this:<br>
 Are we friends, or are we not?<br>
 You told me once, but I <I> forgot</I>.<br>
 So tell me now, and tell me <u>true</u>,<br>
 So I can say I'm here for you.<p>
 Of all the friends I've ever met,<br>
 You're the one I won't forget.<br>
 And if I die before you do,<br>
 I'll go to <b><I> Heaven </I></b>and wait for you,<br>
 I'll give the <font color=red><h2>angels</h2></font> back their wings<br>
 And risk the loss of everything.<br>
 There isn't a thing I wouldn't do,<br>
 To have a friend just like you!

<p align =right>The true author is unknown

</body>
</html>
 

OUTPUT
 
 
 
 


Monday, 28 September 2015

Class 8 - Program(sum)






Class 9 - Scanner

Input Method:

 We are going to use Scanner for accepting values from the user . Its a simple one.

First include the package util.

import java.util.*;

Only small letters and * indicates all the files from the package and there is a semi colon in the end.

Then comes the main function

public static void main( )
{
Scanner S=new Scanner(System.in);

Remember S in red colour are capital letters. Here S is a variable can be in small or capital letter or any other variable name.

There are different statements for accepting different data type values.



int a= S.nextInt( );

float f= S.nextFloat( );

double x=S.nextDouble( );

But  accepting character and string are different.

char ch=(char)System.in.read( );

String st=S.next( );

String st1=S.nextLine( );

next( ) accepts a word till a space and keeps the cursor in the same line.

nextLine( ) accepts words and moves the cursor to the next line after accepting the value.

Let us accept two numbers.

import java.util.*; ------------------------------------ 1

class ex1
{
public static void main( )
{
  Scanner s=new Scanner(System.in); --------------- 2
int a, b,sum; --------------------------------------------- 3
System.out.println("Enter the first number"); ------ 4
a=s.nextInt( ); ------------------------------------------- 5
System.out.println("Enter the second number");----- 4
b=s.nextInt( );-------------------------------------------- 5
sum=a+b; -------------------------------------------------6
System.out.print("Total = " +sum);------------------- 7
}
}

 1  is the first line in the program.

 2  Write any variable instead of s , if you want.

 3  is variable declaration.

 4 is just a prompt message. A remainder to the user to enter a number.

5 Since I am accepting integer values, it should be nextInt. Remember no space  after next and I in Int is capital.

6 is the calculation

7 is the output.


 For other programs step 3 and step 5 will be different according to the data type you use.



Sunday, 27 September 2015

Class 7 - Links


Class 7 -List

List

  Lists are used when we want to display the information in points. 

There are three types of lists.
  • Ordered List

  • Unordered List

  • Description List

Ordered List :

  • <ol >       - Default list. It gives the numbers.
  • <ol type=A>
  • <ol type=a>
  • <ol type=I>
  • <ol type=i> 


Output :

Unordered List

  • Disc - Default list
  • Circle
  • Square
 Output :

Description List



Output :

 Nested List




Output :



Wednesday, 16 September 2015

Class 7 - Line

The above output has 5 lines. The first one is a thin line, because there is no size tag.

<html>
<head>
<title> Example 3</title>
</head>
<body>
<hr > <p>
<hr size=3 color=red> <p>
<hr size=8 color=green></p>
<hr size=3 align=right color=blue><p>
<hr size=3 noshade ></p>
</body>
</html>
2.
<html>
<head>
<title> Example 4</title>
</head>
<body>
<font size=1 color=crimson>
We the Cottonians <br></font>
<font size=2 color=blue>
We are all here<br></font>
<font size=3 color=gold>
We want to do YES <br></font>
<font size=5 color=green>
Always our best<br></font>
<font size=4 color=purple>
Our motto is <br></font>
<font size=5 color=olive>
NEC DEXTRORSUM NEC SINSITRORSUM<p>
<font size=6 color=crimson>
Hip Hip Hurrah.......
</body>
</html>



 

Class 7 - Heading Tag

Heading tag:
There are 6 heading tags. <h1> is the biggest tag and <h6> is the smallest.
Since the text attribute is used to change the colour, the entire document will have the same colour. Whereas if you use <font color> then you can have different colours.
 <html>
<head>
<title> Worksheet 4 </title>
</head>
<body bgcolor=purple text=white>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>


Class 8 - Inputbox




There are 4 steps in a program.
1. Declaration (dim)
2. Assign / Input the value
3. Calculation(if any)
4.Output(Msgbox/Print)


Class 8 - Activity(Pg 86)


1. Declare the integer variables x,y and z

Dim x,y,z as Integer

2. Assign values 5 to x, 10 to y and 15 to z

x=5
y=10
z=15

3. What are the values of C, N1, N2, N3 :

A=5
B=10
C=A+B
N1=A+10
N2=B
N3=5+N2

C=15( since A is 5 and B is 10)
N1=15 ( A is 5 and add 10 to it)
N2=10(B is 10)
N3=15 (N2 is 10 and add 5 to it)

3. Declare a string variable Friend, a numeric variable Num1 to store a decimal value. Assign the value 'Vedika' to the string variable created above.

dim Friend as String
dim Num1 as double

Friend = Vedika

Class 8 - Declaring a variable

Declaring a variable is used to reserve space in memory.  There are 2 types of variable declaration:
  • Implicit declaration
  • Explicit declaration
Implicit Declaration :

Whenever VB comes across a variable, it is assigned a default data type. 

Explicit Declaration :

When the user wants to specify the data type of the variable, then it is called declaring explicitly.

Dim statement is used to declare a variable.

Syntax :

dim variable name as data type

Example :

dim a,b,c as Integer
 dim m as single, i,j as Integer

String variable declaration :

String declaration is little different from other data type declaration.
There are two types of string declaration.

  • Variable Length
  • Fixed Length
If  we want to enter a data of any length then it is variable length.

dim name as string

If we want to enter a data with a particular length, then it is called fixed length.

dim name as string * 3

In the above example we can enter a string with 3 characters only.


Assigning a value :

Once the variable is assigned a data type, the value should be given to it.
To declare and assign  one variable :
dim a as integer  
a=100  

or
dim a as integer = 100

To declare more than one variable :

dim a,b,c as integer
a=10
b=20
c=30


Tuesday, 15 September 2015

Class 8 - Date Function








Class 8 - Introduction

Visual Basic

Visual basic was derived from the language BASIC. 

BASIC has its own limitations., it is a simple programming language but used only in a text based environment. But visual basic is

  • User friendly

  • Supports Graphical User Interface(GUI)VB

VB is an Event- driven programming, which means the flow of the program is determined by an Event.

An Event is an action performed either by mouse click, double click or pressing keys on the keyboard.

 Integrated Development Environment describes the interface and the environment we use to create our own applications.

 1. Form design window
 2. Tool box

 3. Menu bar

 4. Project explorer

 5. Properties window

 6. Form layout


Project Explorer Window
             
              It lists all the forms in the project. The components of the window are:
  • View code
  • View object
  • Toggle folders
  • Project name
  • Forms folder
  • form module


Properties Window

              It displays the properties like font name, caption, background colour etc of the selected object on the form.

A form is saved with an extension  .frm .
A project is saved with an extension .vbp .

        To execute the visual basic program :
  •         Click Run from Start option
  •         Click start on the Toolbar
  •         Press F5 key
                      

Class 8 - Data Type in VB

A data type determines what type of values a variable can hold.
In numbers we have different types like 5(whole number), 6.9(decimal number).

The computer memory is made up of storage areas which will hold the values. 

When we give a value to a variable, the computer will allocate space in the memory to hold the variable. The storage space will be different for different values, based on the type of value.

Data types   :

Natural Numbers 

  • byte
  • integer
  • long
Byte : Number ranges from 0 to 255.
Integer : Larger than byte. Ranges from -32,768 to 32,767
Long : It can hold more than integer. To store very large number.

Decimal Numbers 

  • Single
  • Double

Single : To store decimal values. Less Precision.
Double :  Large decimal numbers. Very precise values.

String  :
It is also called alphanumeric (i.e) alphabets and numbers. It can be a word, group of words, numbers .

Boolean :
This value can be either true or false.

Variant :
It can represent any value.

Date :
It stores vales from 1/1/100 to 12/3/9999.