Monday, 10 July 2017

Class 7 : HTML

HTML (Hyper Text MarkUp Language) is used to create web pages. The codes are called tags. The tags are given within < and >.
There are two types of tags ,
i.                   Container Tag : It has both opening and closing tags.
ii.                 Empty Tag     : It has only an opening tag.
The basic structure of a HTML document is
<html>
<head>
<title>
</title>
</head>
<body>
………
……..
</body>
</html>
 Whatever is typed between <title> and </title>  will be displayed on the title bar not in the web page.
<html>


<head><title> My Page BCBS</title>
</head>

<body>
Your text goes here.
</body>
</html>

The data entered between <body> and </body> only  will be displayed in the web page.

Line Break Tag:
The cursor moves to the next line.
Paragraph Tag :
It gives a blank line.
Heading Tag : Heading tags are used to display the text slightly bigger and bolder. There are six levels. Level 1 is the largest.
The output will  be:
      
    Formatting Tags :

1.     Bold :  <b>  …</b>
2.     Italics  : <I> …. </I>
3.     Underline  : <U> ….</U>
4.     Superscript : <SUP>….. </SUP>
5.     Subscript : <SUB> ….</SUB>
6.     Center Tag: The spelling is important. It positions the text in the center of the screen. <center>....</center>
7. Strikethrough : <strike> ..... </strike> : It draws a line through
the middle of the text.
The output will be:

Thursday, 12 January 2017

Class 9 - switch

Points to remember:
1.  switch,case and default  in small letters
2. After switch , the  constant must be either  integer or character constant.
3. If the input doesnot match any given choices , the default will be executed.
4.break statement is compulsory, otherwise all the cases will be executed.
5. After case and the constant , there is a colon(:)
6. After switch there is no semi colon.
7. No two cases can have the same value.

Section A
1. What is the function of default in switch statement?
                                                                                      [ICSE 2005]
2. Write down the syntax of switch case.                [ICSE 2007]
3. What is the purpose of break statement?
4. Re write the following using switch case
int n=0,ch;
if(ch==1)
{
n++;
System.out.println(n);
}
if(ch==2)
{
n+=2;
System.out.println(n);
}
if(ch==3)
{
n+=3;
System.out.println(n);
}

Section B
1. Write a menu driven program to find the area of an equlateral triangle(ET) , a right angled triangle (RT), a scalene triangle (ST)respectively.
2. Write a menu driven program to calculate the area of
circle =p*r*r
square = side * side
rectangle = length * breadth                                 [ICSE 2005]
Display the menu to output the area as per the user's choice. For an incorrect input, appropriate message should be displayed.

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.



Tuesday, 30 August 2016

Class 8 : Operators in VB

Ch : 5 Operators and Functions

In this chapter we are going to learn about the basic steps such as variable, data type, operator in Visual Basic
1. Variable :
The value is going to change every time.
x=3 , here x is a variable.
Rules for naming a variable :
1. First character should be a letter.
2. Other characters may be letter,digit.
3. No special characters except underscore( _ ).
4. Maximum limit is 255 characters.
5. Keywords are not allowed.
Examples :
1. a   -  Valid variable
2. s1  - Valid variable
3. Computer_Science - Valid variable
Identify the valid and invalid variables :
1.  _123              - Invalid variable(Should start with an alphabet)
2.  Bond007        - Valid variable
3.  Cotton  Boys  - Invalid variable(Special character space)
4. Middle      - Valid variable
5. ProgRam   - Valid variable
6. A * b         - Invalid variable(Special character *)