Sunday, 31 December 2017

Program of Counting Vowels and Consonants in Javascript

Solution:- 

<html>
<head><title>Count vowels and consonants</title>
<script language="Javascript">

function counting()
{
 data=document.f1.txt.value;
 var a=0,e=0,i=0,o=0,u=0;
 var vow=0,cons=0;
for(j=0;j<document.f1.txt.value.length;j++)
{
cal=data.charAt(j);
            switch(cal)
            {
            case 'a':
case 'A': a++;
  break;
                case 'e': 
case 'E': e++;
  break;
                case 'i': 
case 'I': i++;
          break;
                case 'o':
case 'O': o++;
          break;  
                case 'u':
case 'U': u++;
          break; 
                default: cons++;
break;
            }
         }
vow=a+e+i+o+u;
            alert("\n a : "+a+"\n e : "+e+"\n i : "+i+"\n o : "+o+"\n u : "+u+"\n total vowels : "+vow+"\n consonants : "+cons);
}
</script>
</head>
<body>
<form name="f1">
<input type="text" name="txt" value="" >
<input type="button" name="btn" value="count" onClick="counting()">
</form>
</body>
</html>

Output:-


Sunday, 3 December 2017

Computer Graphics and Virtual Reality Program implemented in C

Circle with Radius 50mm, centre A(10,10) is to be Converted into
the Ellipse with Major axis 90mm and Minor axis 60mm. Find the total transformation.

Note:-

This a computer graphics  2D transformation program, in this program you have to find:-

1) Translation Matrix
2) Scaling Matrix 
3) Resultant Matrix (Product of translation and scaling matrix).

Program:-

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int trans[3][3]={{1,0,0},{0,1,0},{0,0,1}};
float scaling[3][3]={{1,0,0},{0,1,0},{0,0,1}};
float result[3][3],sx,sy;
int tx,ty,i,j,rad,x,y;

int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");

printf("\nEnter the translation factors:");
scanf("%d%d",&tx,&ty);

printf("\nEnter the scaling factors:");
scanf("%f%f",&sx,&sy);

printf("\nEnter the co-ordinates of circle:");
scanf("%d%d",&x,&y);

printf("\nEnter the radius:");
scanf("%d",&rad);

ellipse(x,y,0,360,rad,rad);

trans[2][0]=tx;
trans[2][1]=ty;

sx=sx/100;
sy=sy/100;

scaling[0][0]=sx;
scaling[1][1]=sy;

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
result[i][j]=trans[i][j]*scaling[i][j];
}
}

ellipse(x+150,y+150,0,360,result[0][0]*100,result[1][1]*100);
getch();
closegraph();
}

Output:-



Saturday, 2 December 2017

FloodFill and BoundaryFill Program implemented in C using switch case

FLOODFILL AND BOUNDARYFILL PROGRAM IN C USING SWITCH CASE.

#include<stdio.h>
#include<conio.h>
#include<graphics.h>

void floodFill();
void boundaryfill();
int x,y;
void main()
{
       int gm,gd=DETECT,radius;
       int ch;
       clrscr();
       initgraph(&gd,&gm,"c:\\turboc3\\bgi");
      
       do
       {
printf("\n Enter your choice:");
printf("\n1.Floodfill\n2.Boundaryfill\n3.exit:");
scanf("%d",&ch);

switch(ch)
{
case 1:  printf("Enter x and y positions for circle\n");
                                         scanf("%d%d",&x,&y);
                                         printf("Enter radius of circle\n");
 scanf("%d",&radius);
                                         circle(x,y,radius);
  floodFill(x,y,0,15);
  delay(5000);
  getch();
                                         closegraph();
  break;


  case 2:  printf("Enter x and y positions for circle\n");
 scanf("%d%d",&x,&y);
printf("Enter radius of circle\n");
 scanf("%d",&radius);
                                         circle(x,y,radius);
boundaryfill(x,y,4,15);
                                         delay(5000);
                                         getch();
                                         closegraph();
                                          break;

case 3:  exit(0);
  break;

default: printf("\n Please enter valid choice:");
}

     }while(ch!=3);
}


void floodFill(int x,int y, int oldcolor,int newcolor)
{

    if(getpixel(x,y) == oldcolor)
    {
putpixel(x,y,newcolor);
floodFill(x+1,y,oldcolor,newcolor);
floodFill(x,y+1,oldcolor,newcolor);
floodFill(x-1,y,oldcolor,newcolor);
floodFill(x,y-1,oldcolor,newcolor);
    }

}

void boundaryfill(int x,int y,int f_color,int b_color)
{

     if(getpixel(x,y)!=b_color && getpixel(x,y)!=f_color)
    {
putpixel(x,y,f_color);
boundaryfill(x+1,y,f_color,b_color);
boundaryfill(x,y+1,f_color,b_color);
boundaryfill(x-1,y,f_color,b_color);
boundaryfill(x,y-1,f_color,b_color);
    }

}

OUTPUT:-

1} FLOODFILL 



2} BOUNDARYFILL


Friday, 21 April 2017

How to create a database using PHP for Library Management System.


How to create a database using PHP for Library Management System.


step 1:- Open xampp server and Press start on Apache server and also start MySQL.


Step 2:- Open your Browser and type http://localhost.


Step 3:- Now click on phpMyAdmin at right corner of your browser.


Step 4:- Now Click on Databases.



Step 5:- Now Enter the database name and click on create button.



Step 6:- Now Enter the table name and click on Go.


Step 7:- Now Enter the feilds name, their datatypes and length.



Step 8:- Once you entered all the feilds correctly then click on save.


Step 9:- After clicking on save your database is created successfully and you can see your database in right side panel.


You Have successfully created the Database for Library Management System.

Thursday, 20 April 2017

Installation of Xampp Server in your PC.

Steps to install xampp server in your PC.

Step 1:- Download the .exe file from this link https://www.apachefriends.org/download.html
and then right click on .exe file of xampp and click open.



Step 2:- You  will Get This Installation window on your PC now click next to continue installation setup.



Step 3:-  Now Select folder were you want to install xampp and then click on next.



Step 4:-  Now your setup is ready to install click on next to proceed the installation setup.



Step 5:-   After Clicking next your setup will start installing all the required files which are needed for xampp installation once it is completed click on Next.



Step 6:-  Now Your installation js completed it will ask you do you want to start control panel, leave the checkbox as it is and click on Finish.



Step 7:-  Now a Small Popup will be displayed, choose  your Language and click on save.


Step 8:- Now This Window will be displayed on your PC screen. 



Step 9:-  If you get any security/firewall warnings while installing or using XAMPP (such as the prompt pictured below), make sure you check “Private networks, such as my home or work network” and click “Allow access.” This is very important. If you don’t allow access, XAMPP won’t work.



Step 10:-  Now Click on start To check whether it is running on apache server or not Press Start.



Step 11:-   Open your Browser and type http://localhost then Press Enter if the below window is displayed that means your xampp is installed successfully.



Step 12:- If you want to change your port no. for apache server then click config button.



Step 13:- Now Click on Apache(httpd.conf).



Step 14:-  Notepad file will be opened in that near Listen word change your port no. from 80 to 8081.



Step 15:-  Now Open your browser and type http://localhost:8081.



Step 16:-   But if you click on phpMyAdmin it will say Access denied that means you  have to start your MySql Application.



Step 17:-  Now again Open your Browser and type http://localhost and in that at right corner click on phpMyAdmin if the below window is displayed on your PC screen that means the MySql application is running successfully.






You have Successfully installed xampp server on 

your PC.

Javascript Program for Registration Form with Validations

Registration Form with Validations.

<html>
<head>
<title>Registration Form</title>
</head>
<script language="JavaScript">
function disp()
{
var abc="[a-z,A-Z]";
var no="[0-9]";
var f_name=document.f1.txt_Fname.value;
var m_name=document.f1.txt_Mname.value;
var l_name=document.f1.txt_Lname.value;
var mo=document.f1.txt_pno.value;
var mail=document.f1.txt_email.value;
var str=mo.substring(0,1);
if(f_name=="" || m_name=="" || l_name==""|| mo=="" || mail=="")
{
alert("Fields with * are mandatory");
}
else if(f_name.match(no) || m_name.match(no) || l_name.match(no))
{
alert("invalid input");
}
else if(mo.match(abc))
{
alert("number entered is invalid");
}

else if(mo.match(length!=10))
{
alert("10 digit number is required");
}

else if(str<7 || str>9)
{
alert("Mobile number must begin with 7 or 8 or 9 ");
}
else if(mail.indexOf("@")==-1 || mail.indexOf(".com")==-1)
{
alert("email Id is invalid");
}

else
{
document.write("<html><head><title></title></head><body><center><h1>Registration successful</h1></center></body></html>");
document.write("<center><b>Entered Details</b><table border='5' align='center'><tr><th>First Name:</th><th>"+f_name+"</th></tr></center>");
document.write("<tr><th>Middle Name:</th><th>"+m_name+"</th></tr>");
document.write("<tr><th>Last Name:</th><th>"+l_name+"</th></tr>");
document.write("<tr><th>Phone No:</th><th>"+mo+"</th></tr>");
document.write("<tr><th>Email:</th><th>"+mail+"</th></tr>");

}
}
</script>
<form name="f1">
<body>
<center>
<h1 style="color:red">Registration Form</h1>
<table align ='center' border='collapse' borderColorDark="blue">
<tr><th>First Name</th><th><input type="text" name="txt_Fname" placeholder="First name"><b>*</b><br>
</tr>

<tr><th>Middle Name</th><th><input type="text" name="txt_Mname" placeholder="Middle name"><b>*</b></tr>

<tr><th>Last Name</th><th><input type="text" name="txt_Lname" placeholder="Last name"><b>*</b></tr>

<tr><th>Address</th><th height=5><textArea name="txt_Addr" value="" cols=15 rows=4 ></textArea></tr>

<tr><th>Phone Number</th><th><input type="text" name="txt_pno" value=""><b>*</b></tr>

<tr><th>Email Id</th><th><input type="text" name="txt_email" value=""><b>*</b></tr>

<tr><th>Date of Birth</th><th><input type="date" name="txt_dob" value=""></tr>


<tr><th>Gender</th><th>&nbsp;<input type="radio" name="group1" value="Male" checked> Male<br>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="group1" value="Female">Female</th></tr>


<tr><th>Hobbies</th><th>&nbsp;<input type="checkBox" name="cbox1" value="">Football<br><input type="checkBox" name="cbox2" value="">Cricket<br>

<tr><th>Country</th><th><Select name = "country">
<option name="India">India</option>
<option name="Iran">Iran</option>
<option name="Germany">Germany</option>
<option name="USA">USA</option></Select></tr>

<tr><th>States</th><th><Select name = "State">
<option name="Maharashtra">Maharashtra</option>
<option name="AndraPradesh">AndraPradesh</option>
<option name="Gujrat">Gujrat</option>
<option name="Rajasthan">Rajasthan</option></Select></tr>

<tr><th>City</th><th><Select name = "City">
<option name="Mumbai">Mumbai</option>
<option name="Pune">Pune</option>
<option name="Delhi">Delhi</option>
<option name="Ambernath">Ambernath</option></Select></tr>

<tr><th colspan='4'><input type="Button" name="btn_submit" value="Submit" onClick="disp()">
<input type="RESET" name="btn_reset" value="Reset"></tr>
</table>
</center>
</form>
</body>
</html>

Output:-

1.


2.


3.


4.


5. Final output:-


Wednesday, 19 April 2017

Javascript program to see even numbers using dropdown options.

Even Numbers using dropdown options.

<html>
<head>
<title> Even Numbers </title>
<script language="javascript">

function check()
{
var a=document.f1.low.value;
var b=document.f1.high.value;

if(a>b || a==b)
{
alert("Wrong Selection");
}
else
for(i=a;i<=b;i++)
{
if(i%2==0)
{
document.f1.ta1.value+=i+" ";
}
}
}

</script>
</head>

<body>
<form name="f1">

<b><font size=10>Even Numbers</font> </b>
 
<br><br><select name="low">
<option value="1">1</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option value="10000">10000</option>
</select>

<select name="high">
<option value="1">1</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option value="10000">10000</option>
</select><br>
<br><textArea name="ta1"rows=7 col=7 value=""></textArea><br>
<br><input type="Button" name="btn1"value="Check" onClick="check()">

</form>
</center>
</body>
</html>

Output:-





Popular Posts

Program of Counting Vowels and Consonants in Javascript

Solution:-  <html> <head><title>Count vowels and consonants</title> <script language="Javascript"...