Wednesday 10 August 2022

Javascript Program3 Check whether the entered string begins and ends with X or not (X is any character of your choice)

Check whether the entered string begins and ends with X or not (X is any character of your choice) 


<!DOCTYPE html>

<html>

<body>


<p>Click the button to check where if the string starts with the specified value.</p>


Enter Name: <input type="text" name="txt_name" id="name"/> <br/>

//<input type="text" name="txt_name1" id="name1" size="1" maxlength="1"/>


<button onclick="myFunction()">Try it</button>


<p id="demo"></p>


<p><strong>Note:</strong> The startsWith() method is not supported in IE 11 (and earlier versions).</p>


<script>

function myFunction() {

  var str = document.getElementById("name").value;

  //var test = document.getElementById("name1").value;

  var n = str.startsWith

  //document.getElementById("demo").innerHTML = n + n1;

  

  if(n == true) {

document.getElementById("demo").innerHTML = "Valid String";

  }

  else {

document.getElementById("demo").innerHTML = "Invalid String";

  }

}

</script>


</body>

</html>

Javascript Program2 :Read 2 numbers and perform the Arithmetic operations (+, -, *, /) on them, and show the output of the operations.

 <html>

<head>

<title>math</title>

   <script type= "text/javascript ">

  <!--

    function oper()

    {

        var ch=parseInt(prompt( "Enter your choice 1.Addition 2.Subtraction 3.Multiplication 4.Division "));

                switch(ch)

    {

        case 1:var v1=parseInt(prompt( "Enter the first value "));

                   var v2=parseInt(prompt( "Enter the second value "));

                   var v3=v1+v2;

                   document.writeln( "<br> "+ "Addition: "+v3);

                   break;

        case 2:var v4=parseInt(prompt( "Enter the first value "));

                   var v5=parseInt(prompt( "Enter the second value "));

                   var v6=v4-v5;

                   document.writeln( "<br> "+ "Subtraction: "+v6);

                   break;

        case 3:var v7=parseInt(prompt( "Enter the first value "));

                   var v8=parseInt(prompt( "Enter the second value "));

                   var v9=v7*v8;

                   document.writeln( "<br> "+ "Multiplication:  "+v9);

                   break;

        case 4:var v10=parseInt(prompt( "Enter the first value "));

                   var v11=parseInt(prompt( "Enter the second value "));

                   var v12=v10/v11;

                   document.writeln( "<br> "+ "Divison: "+v12);

                   break;

        case 5:var v13=parseInt(prompt( "Enter the first value "));

                   var v14=parseInt(prompt( "Enter the second value "));

                   var v15=v13%v14;

                   document.writeln( "<br> "+ "Modulus: "+v15);

                   break;

        default: document.writeln( "Enter choice correctly ");

    }

 

}

</script>

</head>

<body onLoad= "oper()"></body>

</html>

Javascript Program1 Check whether the number is Positive, Negative, Zero

Javascript Program1 Check whether the number is Positive, Negative, Zero 


<html>

<style>


</style> 

<body>

<h3> Positive and Negative Number Checker </h3>

<br/>Enter a Number 

<input type="text" id="num_value" name="num_value" size="5">

<br><br>

<input type="submit" onclick="check_number()" value="Check Number"/>

<br><br>


<script>

 function check_number() {

var num_value= document.getElementById("num_value").value;

if (num_value >0 ) {

document.write("Number is Positive");

}

else if(num_value < 0){

document.write("Number is Negative");

}

else {

document.write("Number is zero");

}




 }

</script>

</body>

</html>

Monday 16 May 2022

Home Automation

 Project Name: home automation. 

Through the home automation system we can control the different household appliances by means of a phone using DTMF and/or GSM technology. We can switch them ON and OFF even when we are away from home.

 It works on the basis of AVR microcontroller. The signals are sent through the mobile phone which would be further forwarded to the microcontroller. These signals contain the instructions based on which the microcontroller will work. And thus, it will control the respective device connected to the microcontroller via relays or driver circuits etc.

 Similarly, various sensors are also used for the security purposes which will notify the person via SMS in case of an unauthorized human entry in our absence or in case of fire etc, which would be received as a notification on android phone. 

Thus through home automation system we can control different household appliances by means of a phone or switch them ON/OFF even while staying away from home as well as keep a high-tech security for our house.

Speech Recognition System

 

Project Name : Speech Recognition System

The title of our project is (Intuitive Speech Recognition System). Intuitive means easy to understand;

 Interactive means responding to or communicating with the user and Integrated means Summation of all the features we are going to include here and an inspiring concept of speech recognition system. Our system is inspired from the movie “Iron Man” who has JARVIS (Just A Rather Very Intelligent System) as his accompany. 

Speech recognition applications are becoming more and more useful nowadays. The exclusive feature in our project will be that it will be able to take commands in three languages : English, Hindi, Gujarati.

Centralized File Tracking System


Project Name : Centralized File Tracking System 

It is an online system in which all the important documents of a particular organization can be managed online and also can be tracked respectively accordingly. 

For instance, if any document is intended for the use of a particular type of employees, it can be uploaded directly over the website and then respected employees can download it in the required format like pdf, doc or excel. Also any employee has any query regarding any file then he/she asks a question to admin and admin gives a feedback to that particular employee. 

Also there is access privilege according to particular employee given by admin so by that access authority that particular employee does their work. The limitations to upload or download to a particular employee can also be applied. 

So each employee has limited number of download/upload space that are given by admin. So that employee has only that much space for does their work.

RFID based access control system


PROJECT NAME : RFID based access control system


This objective of this project is to design a “RFID based access control system”. The aim of this project is to avoid the entry of any unwanted person to some restricted area. 

In this project a RFID and reader will read the RFID card from the user. It will send the RFID card number to the microcontroller. Previously, some of the card number will be stored in memory of microcontroller.

 If the card number send by the RFID reader matches with the ID-number store in microcontroller, then gate will open automatically.

Friday 4 March 2022

Python Program to find Area of Rectangle

 CODE

def main() : 

    print ("This program computes the area of Rectangle") 

    length = float (input ("Enter length: ") )

    width = float (input ("Enter width: ") ) 

    ans = length * width

    print ("Area of Rectangle: ", ans) 

main()

save above file as areaofrectangle.py

SCREENSHOT



Python Program to Find Area of Cylinder

 CODE

def main() : 

    print ("This program computes the area of Cylinder") 

    rd = float (input ("Enter Radius of Cylinder: ") )

    h = float (input ("Enter Height of Cylinder: ") ) 

    ans = 2 * 3.14 * rd * h + 2 * 3.14 * rd *rd

    print ("Area of Cyclinder: ", ans) 

main()

save file as areaofcylinder.py


SCREENSHOT



Python program to find Area of Circle

 CODE

def main() : 

    print ("This program computes the area of circle") 

    rd = float (input ("Enter Radius of Circle: ") ) 

    ans = 3.14 * rd *rd

    print ("Area of Circle: ", ans) 

main()

save above file as : areaofcircle.py

SCREENSHOT




Wednesday 2 March 2022

Python Program To Draw a Line segment using Line Object

 SCREENSHOT



CODE

#Draw a line Segment using a Line object 


from graphics import *

def main():

    win = GraphWin('Draw Square',300,300)

    

    center = Point(100,100) 

    line=Line(Point(20,30),Point(180,165))

    line.draw(win)


main()

Python Program to Draw Square using Rectangle Object

 SCREENSHOT

CODE

#Draw a square using a Rectangle object 

from graphics import *

def main():

    win = GraphWin('Draw Square',300,300)

    center = Point(100,100) 

    rect = Rectangle(Point(30,30), Point(150,150))

    rect.setFill("yellow")

    rect.draw(win) 

main()



Python Program Put a Textual Label inside red circle

SCREENSHOT



CODE

 #Draw a red circle centered at point (100,100) with radius 50 and with text Red Circle

from graphics import *

def main():

    win = GraphWin('Draw Circle',300,300)

    

    center = Point(100,100) 

    circ = Circle(center, 50) 

    circ.setFill('red') 

    circ.draw(win)


    label = Text(center, "Red Circle") 

    label.draw(win)

main()


Python Program Draw a red circle centered at point (100,100) with radius 30

SCREENSHOT



CODE

 #Draw a red circle centered at point (100,100) with radius 30

from graphics import *

def main():

    win = GraphWin('Draw Circle',300,300)

    center = Point(100,100) 

    circ = Circle(center, 30) 

    circ.setFill('red') 

    circ.draw(win)

main()

An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue, black and white

 CODE :

An archery target consists of a central circle of yellow surrounded by concentric rings of red, blue, black and white. Each ring has the same width, which is the same as the radius of the yellow circle. Write a program called target.py that draws this target.

o Use a list of colors and a for loop to draw the target

o Hint: objects drawn later will appear on top of objects drawn earlier

o The output of the program should look like this:

SCREENSHOT



SAVE this file as target.py

from graphics import *

def main():

    win = GraphWin('Archery Target',300,300)

    center = Point(150,150)


    w = Circle(center, 100)

    w.setFill('white')

    w.draw(win)


    bl = Circle(center, 80)

    bl.setFill('black')

    bl.draw(win)


    b = Circle(center, 60)

    b.setFill('blue')

    b.draw(win)


    r = Circle(center, 40)

    r.setFill('red')

    r.draw(win)


    y = Circle(center, 20)

    y.setFill('yellow')

    y.draw(win)


    win.getMouse() # pause for click in window

    win.close()


main()

Monday 21 February 2022

Write a program that finds the average of a series of numbers entered by the user.

 Write a program that finds the average of a series of numbers entered by the user. As in the previous problem, the program will first ask the user how many numbers there are. Note: The average should always be a float, even if the user inputs are all ints.

CODE :

# sumnn.py 

def main() :

    n = int (input ("How many numbers are to be summed: ") ) 

    sum=0

    for i in range(n) :

        a = int (input ("Please enter number  : ") ) 

        sum=sum+a

    print ("Average of a series of numbers :",sum/n) 

main()

SCREENSHOT





Write a program to sum a series of numbers entered by the user.

 Write a program to sum a series of numbers entered by the user. The program should first prompt the user for how many numbers are to be summed. The program should then prompt the user for each of the numbers in turn and print out a total sum after all the numbers have been entered. Hint: Use an input statement in the body of the loop.

CODE

# sumnn.py 

def main() :

    n = int (input ("How many numbers are to be summed: ") ) 

    sum=0

    for i in range(n) :

        n = int (input ("Please enter number  : ") ) 

        sum=sum+n

    print ("Total Sum  :",sum) 

main()

SCREENSHOT




Write a program to find the sum of the cubes of the first n natural numbers where the value of n is provided by the user.

 SCREENSHOT




Write a python program to print table where table number inputed by user

 CODE

# tablen.py 


def main() :    

    n = int (input ("Please enter number: ") ) 

    for i in range(1,11) : 

        sum=n*i

        print (n,"*",i,"=",sum) 

main()


Note :save above file as : tablen.py

SCREENSHOT




Write a program to find the sum of the first n natural numbers, where the value of n is provided by the user.

 CODE :

# sumn.py 

# Write a program to find the sum of the first n natural numbers,

#where the value of n is provided by the user.

def main() : 

    sum=0

    n = int (input ("Please enter number: ") ) 

    for i in range(n+1) : 

        sum=sum+i

    print ("Sum of n Natural number is :",sum) 

main()

NOte : save this file as sumn.py

SCREENSHOT :



Saturday 19 February 2022

Program to compute the factorial of a number

CODE 

# factorial. py 

# Program to compute the factorial of a number 

# Illustrates for loop with an accumulator 

def main() : 

    n = int (input ("Please enter a whole number: ") ) 

    fact = 1 

    for factor in range(n,1,-1) : 

        fact = fact * factor 

    print ("The factorial of", n, "is", fact) 

main ()


NOTE : save above program as factorial.py

SCREENSHOT



Write a program that converts distances measured in kilometers to miles. One kilometer is approximately 0.62 miles.

 CODE

#kmtomiles.py

#Python program :It coverts kilometer to miles 


def main():

    print("This program convert Kilometers to miles")

    km=eval(input("Enter Kilometers ?"))

    miles = 0.62 * km 

    print("Aha , I know Miles are ",miles)

main()


NOTE : save above file as kmtomiles.py

SCREENSHOT



It Executes 5 times before quitting to convert Celsius temps into Fahrenhit

 Modify the convert.py program (Section 2.2) with a loop so that it executes 5 times before quitting. Each time through the loop, the program  should get another temperature from the user and print the converted value.


CODE :

#convert.py
#Python program :It Executes 5 times before quitting to convert Celsius temps into Fahrenhit

def main():
    print("This program convert Celsius temps into Fahrenhit")
    for i in range(5):
        celsius=eval(input("What is the Celsius temprarure outside now ?"))
        fahrenhit = 9/5 * celsius + 32
        print("Aha , I know temprature is ", fahrenhit , "degrees fahrenhit.")

main()

NOTE : save above file as convert_v1.py

SCREENSHOT :



Python Program to find the average of three exam scores.

 CODE

def main() : 

    print ("This program computes the average of two exam scores. ") 

    score1, score2,score3 = eval (input ("Enter three scores separated by a comma: ") ) 

    average = (score1 + score2  + score3) / 3

    print ("The average of the scores is: ", average) 

main()

SCREENSHOT





Python Program A simple program to average two exam scores

 

CODE

def main() : 

    print ("This program computes the average of two exam scores. ") 

    score1, score2 = eval (input ("Enter two scores separated by a comma: ") ) 

    average = (score1 + score2) / 2 

    print ("The average of the scores is: ", average) 

main()


SCREENSHOT



Future Value Python Program

 CODE :We want to develop a program to determine the future value of an investment.

def main () : 

    print ("This program calculates the future value") 

    print ("of a 10-year investment.") 

    principal = eval (input ("Enter the initial principal: $") ) 

    apr = eval (input ("Enter the annual interest rate: ") ) 

    for i in range (10) : 

        principal = principal * (1 + apr) 

        print ("The value in 10 years is: $", principal) 

main ()

save above program as futval.py


SCREENSHOT



Friday 18 February 2022

Python program to convert Celsius temps into Fahrenhit

 

CODE

#convert.py
#Python program to convert Celsius temps into Fahrenhit

def main():
    print("This program convert Celsius temps into Fahrenhit")
    celsius=eval(input("What is the Celsius temprarure outside now ?"))
    fahrenhit = 9/5 * celsius + 32
    print("Aha , I know temprature is ", fahrenhit , "degrees fahrenhit.")

main()


NOTE : save above file as convert.py


SCREENSHOT

Modify the chaos program so that the number of values to print is determined by the user. You will have to add a line near the top of the program to get another value from the user:

 Modify the chaos program so that the number of values to print is determined by the user. You will have to add a line near the top of the program to get another value from the user:

n = eval(input("How many numbers should I print? ") ) Then you will need to change the loop to use n instead of a specific number.

CODE

def main():

    print("This program illustrates a chaotic function")

    n = eval(input("How many numbers should I Print ?"))

    x = eval(input("Enter a number between 0 and 1: "))

    for i in range(n):

        x = 3.9 * x * (1 - x)

        print(x)


main()

Note : Save above file as chaos_v2.py

SCREENSHOT



Modify the chaos program so that it prints out 20 values instead of 10.

 

CODE

def main():

    print("This program illustrates a chaotic function")

    x = eval(input("Enter a number between 0 and 1: "))

    for i in range(20):

        x = 3.9 * x * (1 - x)

        print(x)


main()

Note : Save above code as chaos_v3.py

SCREENSHOT




Modify the chaos program using 2.0 in place of 3.9 as the multiplier in the logistic function.

 Modify the chaos program using 2.0 in place of 3.9 as the multiplier in the logistic function.

Your modified line of code should look like this: X = 2. 0 * X * (1 - X)

CODE

def main():

    print("This program illustrates a chaotic function")

    x = eval(input("Enter a number between 0 and 1: "))

    for i in range(10):

        x = 2.0 * x * (1 - x)

        print(x)


main()

Note : Save above code as chaos_v1.py  

SCREENSHOT



Enter and run the chaos program

 

CODE

def main():

    print("This program illustrates a chaotic function")

    x = eval(input("Enter a number between 0 and 1: "))

    for i in range(10):

        x = 3.9 * x * (1 - x)

        print(x)


main()

Note : Save above code as chaos.py

SCREENSHOT



Friday 4 February 2022

Python Program : 2 Write a Python Program to find summation of two numbers

 

CODE

def main():

    x=10

    y=20

    sum = x + y

    print("X's Value=",x)

    print("Y's Value=",y)

    print("Summation of X + Y =",sum)

main()

Note : Save above code as prog2.py

SCREENSHOT



Python Program : 1 Write a Python Program to print Hello World

CODE

 def main():

    print("Hello World")

main()


Note : Save above code as prog1.py

SCREENSHOT