Bite-Code™

Home

Prime Numbers

May 5, 2010

<html>
<body bgcolor=”pink”>
<center><font color=”white”>
<h2>The Prime Numbers inside the textboxes are:</h2>
<form name=form1>
<input type=text name=text1 size=2>
<input type=text name=text2 size=2>
<input type=text name=text3 size=2>
<input type=text name=text4 size=2>
<input type=text name=text5 size=2>
<input type=text name=text6 size=2>
<input type=text name=text7 size=2>
<input type=text name=text8 size=2>
<input type=text name=text9 size=2>
</form>
<br>
<script language=”vbscript”>
Dim TheForm
Set TheForm = document.form1
 
Dim aPrime(9)  
document.writeln(”")
x = 1
i = 3
   While i <= 30
      Prime = True
      j = 2
      While j <= i\2 And Prime
         Prime = i Mod j > 0
         j = j + 1
      Wend 
      If Prime Then
    aPrime(x) = i
TheForm.text1.Value = aPrime(1) 
TheForm.text2.Value = aPrime(2)
TheForm.text3.Value = aPrime(3)   
TheForm.text4.Value = aPrime(4)   
TheForm.text5.Value = aPrime(5)   
TheForm.text6.Value = aPrime(6)   
TheForm.text7.Value = aPrime(7)   
TheForm.text8.Value = aPrime(8)
TheForm.text9.Value = aPrime(9)       
    x = x+1
      End If
      i = i + 2
   Wend
</script>

</html>

Posted by mowllen at 9:25 am | permalink | Add comment

Zodiac Sign

<html>
<head>
<title>Zodiac Sign</title>
<script language=”vbscript”>
Sub chkSign_OnClick

        
        If show.month.value = “march” then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Aries”
    ElseIf show.date.value >= 21 And show.date.value <= 31 Then
               show.Sign.value = “Pisces”   
    Else
        show.Sign.value = ” invalid sign”

    End If
    End If

        If show.month.value = “april” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Aries”
    ElseIf show.date.value >= 21 And show.date.value <= 30 Then
               show.Sign.value = “Taurus”
    else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “may” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.sign.value = “Taurus”
    ElseIf show.date.value >= 21 And show.date.value <= 31 Then
               show.sign.value = “Gemini”
    Else
        show. invalid sign.value = “sign”
    End If
    End If

        If show.month.value = “june” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Gemini”
    ElseIf show.date.value >= 21 And show.date.value <= 30 Then
               show.Sign.value = “Cancer”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “july” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Cancer”
    ElseIf show.date.value >= 21 And show.date.value <= 31 Then
               show.Sign.value = “Leo”
    Else
        show.Sign.value = “invalid sign”
    End If
    End If

        If show.month.value = “august” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Leo”
    ElseIf show.date.value >= 21 And show.date.value <= 31 Then
               show.Sign.value = “Virgo”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “september” Then

    If show.date.value >= 1 And show.date.value <= 22 Then
        show.Sign.value = “Virgo”
    ElseIf show.date.value >= 23 And show.date.value <= 30 Then
               show.Sign.value = “Libra”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “october” Then

    If show.date.value >= 1 And show.date.value <= 22 Then
        show.Sign.value = “Libra”
    ElseIf show.date.value >= 23 And show.date.value <= 31 Then
               show.Sign.value = “Scorpio”
    Else
        show.Sign.value = “invalid sign”
    End If
    End If

        If show.month.value = “november” Then

    If show.date.value >= 1 And show.date.value <= 22 Then
        show.Sign.value = “Scorpio”
    ElseIf show.date.value >= 23 And show.date.value <= 30 Then
               show.Sign.value = “Saguittarius”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “december” Then

    If show.date.value >= 1 And show.date.value <= 20 Then
        show.Sign.value = “Saguittarius”
    ElseIf show.date.value >= 21 And show.date.value <= 31 Then
               show.Sign.value = “Capricorn”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “january” Then

    If show.date.value >= 1 And show.date.value <= 19 Then
        show.Sign.value = “Capricorn”
    ElseIf show.date.value >= 20 And show.date.value <= 31 Then
               show.Sign.value = “Aquarius”
    Else
        show.Sign.value = ” invalid sign”
    End If
    End If

        If show.month.value = “febuary” Then

    If show.date.value >= 1 And show.date.value <= 18 Then
        show.Sign.value = “Aquarius”
    ElseIf show.date.value >= 19 And show.date.value <= 28 Then
               show.Sign.value = “Pisces”
    Else
        show.Sign.value = “invalid sign”
   
    End If
    End If

        show.Age.value = ( 2009 - show.BirthYear.value)

End Sub

</script>
</head>
<body>
 
<form name=”show”>

<center>

<font color = “maroon”>
Enter your name <br><input type=”text” name=”pname” value = ” “size = “25″><br>

Enter your month of birth <br><input type=”text” name=”month”><br>

Enter the date you were born <br><input type=”text” name=”date”><br>

Enter the year you were born <br><input type=”text” name=”BirthYear”  value =” “><br>
<br>
<input type =”button” name = “chkSign” value = “Click me!”><br>
<br>
        <p><b>Result</b><br>
Your age is <br><input type=”text” name=”Age” ><br>

Your sign is<br><input type=”text” name=”Sign”><br>
<br></center></font>

<marquee behavior = “alternate”><font color = “red”>Find out your fortune for today!</font></marquee>

Note: Update the Date.

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

Posted by mowllen at 9:19 am | permalink | Add comment

Menu

March 10, 2010

CLS

PRINT “MENU”
PRINT
MENU:
PRINT “1 - COUNT”
PRINT “2 - ADD”
PRINT “3 - GET INFO”
PRINT “4 - EXIT”
PRINT
PRINT “ENTER CHOICE”
INPUT CHOICE
       
        IF CHOICE = 1 THEN
                GOTO 1
        END IF

        IF CHOICE = 2 THEN
                GOTO 2
        END IF
      
        IF CHOICE = 3 THEN
                GOTO 3
        END IF
4 : END


1 : PRINT “COUNT FROM 1 TO THE LAST NUMBER”
PRINT
PRINT “ENTER A NUMBER”
        INPUT NUM
FOR NUM = 1 TO 5 STEP 1
PRINT NUM
NEXT
GOTO MENU

CLS
2 : PRINT “ADD A RANGE OF NUMBERS”
PRINT
PRINT “ENTER 1ST:”
INPUT N1
PRINT
PRINT “ENTER 2ND:”
INPUT N2
FOR TOTAL = N1 TO N2
 SUM = SUM + TOTAL

REM PRINT “THE SUM IS “; SUM
NEXT
PRINT “THE SUM IS”; SUM
GOTO MENU

CLS
3 : PRINT “ENTER USER INFORMATION”
PRINT
PRINT “NAME”
        INPUT NAME$
PRINT
PRINT “AGE”
        INPUT AGE
PRINT
PRINT “COURSE”
        INPUT COURSE$
CLS
PRINT NAME$
PRINT AGE
PRINT COURSE$
GOTO MENU

 

Posted by mowllen at 8:30 am | permalink | Add comment

Slide

March 1, 2010

Posted by mowllen at 2:30 pm | permalink | Add comment

Cash Register

{Use PascalIDE to execute this program}
{Cash Register}

program CustomerOrder;
uses crt;


var fname,lname:string;
i:integer;
order:array[1..5] of real;

cash:integer;
total:real;
change:real;

begin
i:=0;
cash:=0;

clrscr;


writeln(’>>> Name of your store <<<’);
writeln(’>>> Your Address here <<<’);
writeln(’>>> 123-45-67 <<<’);
writeln(’>>> email_me@yahoo.com <<<’);
writeln(’ Press “c” to continue : ‘);
readln;

writeln(’Customer’);
writeln(’First name: ‘);
readln(fname);


writeln(’Last name: ‘);
readln(lname);


writeln(’Menu’);

writeln(’1.apple ……… 5.00′);
writeln(’2.orange……… 10.00′);
writeln(’3.grapes……… 15.00′);
writeln(’4.banana……… 10.00′);
writeln(’5.coconut…….. 15.00′);

 

{price}
for i:= 1 to 5 do begin
writeln(’Order ‘,i,’:');
readln(order[i]);
end;
{price}

writeln(’—————-’);
writeln(’Official Receipt’);
writeln(’—————-’);
writeln(’Customer: ‘,fname,’ ‘,lname);

total:= 0.00;
for i:= 1 to 5 do begin
writeln(’Price ‘,i,’:',order[i]:7:2);
total:=total + order[i];
end;

writeln(’—————’);
writeln(’Total: ‘,total:7:2);
writeln(’—————’);

write(’Cash: ‘);
readln(cash);

change:=0.00;
change:=cash - total;
writeln(’—————’);
writeln(’Change: ‘,change:7:2);
writeln(’—————’);
readln;

end.

 

Posted by mowllen at 10:47 am | permalink | Add comment

Encryption: A character(alphabets) converts into numeric.

//Use JCreator version 2.5.
//Acknowledgement to Mr. Alivn James Bellero, he help me to do this program. 

public class encryption{
public static void main(String args[])throws Exception{
  java.io.BufferedReader in;
  in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
  
  String line=”";
  int num[] = new int[500];
  char letter[] = new char[500];
  int limit;
  int ctr=1;
  String arr[] = new String[500];  
System.out.print(”Enter limit: “);
line = in.readLine();
limit = Integer.parseInt(line);  

for(int i=1;i<=limit;i++){
  System.out.print(”Enter letter[” + (i) + “]: “);
  arr[i] = in.readLine();

  for(int x=1;x<=26;x++){
   num[x] = x;
  }
  for(char y=’a';y<=’z';y++){
   letter[ctr] = y;
   ctr++;
  } 
 for(int inp=1;inp<=limit;inp++){ 
  for(int traverse=1;traverse<=26;traverse++){
   if(arr[inp].charAt(0) == letter[traverse]){
    System.out.print(num[traverse] + ” “);
    }
   }
  }  
 }
}

Posted by mowllen at 10:30 am | permalink | Add comment

Payroll System

//Use CodeBlocks Studio version 1.0.
#include <iostream>
#include <string>
using namespace std;

class person{       //class:person

    string first;
    string last;
    char middle;
    int age;
    string gender;
    string position;
    int salary;

    public:void setfirst(string myfirst){
        first=myfirst;
    }
    public:void setmiddle(char mymiddle){
        middle=mymiddle;
    }
    public:void setlast(string mylast){
        last=mylast;
    }
    public:void setage(int myage){
        age=myage;
    }
    public:void setgender(string mygender){
        gender=mygender;
    }
     public:void setposition(string myposition){
        position=myposition;
    }
    public:void setsalary(int mysalary){
        salary=mysalary;
    }


    public:string getfirst(){
    return first;
    }
    public:char getmiddle(){
    return middle;
    }
    public:string getlast(){
    return last;
    }
     public:int getage(){
    return age;
    }
    public:string getgender(){
    return gender;
    }
    public:string getposition(){
    return position;
    }
    public:int getsalary(){
    return salary;
    }
};

    int main()
{
                              //object:you

    string fname;
    char mname;
    string lname;
    int age;
    string gender;
    string position;
    int salary;
    char con;
    person you[5];

    cout<<endl;
    cout<<”\t\t\t\17 Simple Payroll System \17 \n”;
    cout<<endl;
    for(int i=0; i<5; i++)
    {
    cout<<”Enter first name [”<<i<<”] :”;
    cin>>fname;
    cout<<”Enter middle initial: “;
    cin>>mname;
    cout<<”Enter last name: “;
    cin>>lname;
    cout<<”Enter age: “;
    cin>>  age;
    cout<<”Enter gender: “;
    cin>>gender;
    cout<<”Enter position: “;
    cin>> position;
    cout<<”Enter Annual salary: “;
    cin>> salary;
    salary = salary*12;
    cout<<”\n”;

    you[i].setfirst(fname);
    you[i].setmiddle(mname);
    you[i].setlast(lname);
    you[i].setage(age);
    you[i].setgender(gender);
    you[i].setposition(position);
    you[i].setsalary(salary);

    }
    system(”cls”);
    cout<<endl;
    cout << “\n\t\t\t Do you want to continue?[Y/N] : “;
         cin >> con;
         if ((con == ‘y’)|| (con == ‘Y’))
         {
            cout<<endl;
             }

    for(int i=0; i<5; i++)
    {
    cout<<”Name “<<i<<” :”<<you[i].getlast()<<”, “<<you[i].getfirst()<<” “<<you[i].getmiddle()<<”.”<<endl;
    cout<<”Age: “<<you[i].getage()<<endl;
    cout<<”Gender: “<<you[i].getgender()<<endl;
    cout<<”Position: “<<you[i].getposition()<<endl;
    cout<<”Annual salary: “<<you[i].getsalary()<<endl;
    cout<<”\n”;
    cout<<”\n”;
    }
    return 0;
}


 

Posted by mowllen at 10:22 am | permalink | Add comment

Find out the square.

#include<iostream>
using namespace std;

int i,x;
int num[10][2]={
    {1,1},
    {2,4},
    {3,9},
    {4,16},
    {5,25},
    {6,36},
    {7,49},
    {8,64},
    {9,81},
    {10,100}
    };

int main()
    {
        cout<<”Enter a number between 1 and 10: “;
        cin>>i;
            for(x=0; x<10; x++)
                if(num[x][0]==i) break;
         cout<<”The square of “<<i<<” is “<<num[x][1]<<endl;
     return 0;

 

    }

 

 

Posted by mowllen at 10:14 am | permalink | Add comment

Recursion: Find the Base and Exponenet

//Use CodeBlocks Studio version 1.0. 

#include <iostream>
using namespace std;


int power(int base, int exponent) {

      if ( exponent < -1)
          return (1/base) * power(base, exponent+1);

     else if (exponent == -1 )
          return (1/base);

     else if (exponent == 0 )
          return 1;
     else if (exponent == 1 )
           return base;
     else
          return base * power(base, exponent-1);
     int result = base;

}
    int main(){
        int number = 0;
        int number2 = 0;
        cout<<”enter number(base): “;
        cin>>number;
        cout<<”enter number(exponent): “;
        cin>>number2;
    for(int x = 1;x<=number2; x++){
    cout<<endl;
    cout<<number<<” raised to the power of “<<x<<” : “<<power(number,x)<<”\n”;
    }
    return 0;
    }

Posted by mowllen at 10:03 am | permalink | Add comment

Hello

February 27, 2010

#include<iostream>

using namespace std;

int main(){

cout>>”Hello People!”;     

return 0;

}

//Output: Hello People!

Posted by mowllen at 5:03 pm | permalink | Add comment