Sunday, January 20, 2019

PHP program of Slip 19 practical of User Information in bill


<?
// This is Slip19_a.php
// It takes User Information And Send it to slip19_b.php
?>
<html>
<body bgcolor=#AAAAAA>
<center> <font color="red" font size=6>U</font>ser Information</center>
<br><br><br>
<form action="slip19_b.php" method="GET">
<p>
<table border=0>
<tr><td>Name:<td> <input type="text" name="u_name">

<tr><td>Address:<td> <input type="text" name="u_address">

<tr><td>Phone No:<td> <input type="text" name="u_no">
<tr><td><td><input type="submit" value="SUBMIT">
</form>
</table>
</form>
</body>
</html>





















<?
// This is Slip19_b.php
// It Takes The Product Information....
//and Passes to Slip19_c.php

?>
<html>
<body bgcolor=#AAAAAAA>
<center><font color="red" font size=6>P</font>roduct Information</center>
<br><br><br>
<form action="slip19_c.php" method="POST">
<p>
<table border=0>
<tr><td>Prod.Name:<td> <input type="text" name="p_name">

<tr><td>Quantity:<td> <input type="text" name="p_qty">

<tr><td>Rate:<td> <input type="text" name="prize">

<tr><td><?
$var1=$_GET['u_name'];
$var2=$_GET['u_address'];
$var3=$_GET['u_no'];
printf("<br><br>Customer Information is:");
printf("<br><br><input type='text' name='user' value='$var1'><br>");
printf("<input type='text' name='add' value='$var2'><br>");
printf("<input type='text' name='phone' value='$var3'><br>");
?>

<tr><td><td><input type="submit" value="Display">

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
















<?
// This is Slip19_c.php
//It Genrates the Tabular format bill of the Customer
?>

<html>
<body bgcolor=#AAAAAAA>
<center><font color="red" font size=6>B</font>ill Information</center>
<br><br><br>
<center>
<table border=1 cellspacing=2 cellpadding=2>
<?
$usr_name=$_POST['user'];
$usr_address=$_POST['add'];
$usr_phone=$_POST['phone'];
$prod_name=$_POST['p_name'];
$prod_quantity=$_POST['p_qty'];
$prod_price=$_POST['prize'];
$bill=$prod_quantity*$prod_price;
printf("<br><br><br>");
printf("<th bgcolor=#ABCDEF>Customer Bill<td bgcolor=#ABCDEF>");
printf("<tr><td>Name<td>$usr_name");
printf("<tr><td>Address<td>$usr_address");
printf("<tr><td>Phone No<td>$usr_phone");
printf("<tr><td>Product Name<td>$prod_name");
printf("<tr><td>Product Quantity<td>$prod_quantity");
printf("<tr><td>Product Price<td>$prod_price / Unit");
printf("<tr><td>Total<td>$bill Rs.");
?>
</table>
</form>
</body>
</html>




Friday, January 18, 2019

Conversion of string program java



Conversion of string java program UPPER lower BOLD ITALIC 

import javax.swing .* ;
import java.awt . * ;
import java.awt.event .* ;

class Convt extends JFrame implements ActionListener
{
       JLabel l1;
       JButton b1,b2,b3,b4;
       JTextField t1,t2,t3,t4,t5;
     Convt( )
  {
         setVisible(true);
         setSize(400,400);
         setTitle("Conversion of Text");

         l1=new JLabel("ENTER   THE   STRING :=");
         b1=new JButton("LOWER");
         b2=new JButton("UPPER");
         b3=new JButton("BOLD");
         b4=new JButton("ITALIC");
         b1.addActionListener(this);
         b2.addActionListener(this);
         b3.addActionListener(this);
         b4.addActionListener(this);

         t1=new JTextField(10);
         t2=new JTextField(10);
         t3=new JTextField(10);
         t4=new JTextField(10);
         t5=new JTextField(10);

     JPanel p1=new JPanel( );
      p1.setLayout(new GridLayout(5,2));
      p1.add(l1);
      p1.add(t1);
      p1.add(b1);
      p1.add(t2);
      p1.add(b2);
      p1.add(t3);
      p1.add(b3);
      p1.add(t4);
      p1.add(b4);
      p1.add(t5);

     Container cn=getContentPane( );
     cn.setLayout(new FlowLayout( ));
     cn.add(p1);
   }
    public void actionPerformed(ActionEvent ae)
    {
             String s=t1.getText( );
            if(ae.getSource( )==b1)
        {
             t2.setText(s.toLowerCase( ));
           }
       else
           if(ae.getSource( )==b2)
           {
                 t3.setText(s.toUpperCase( ));
                }
       else
          if(ae.getSource( )==b3)
          {
                 t4.setFont(new Font("Dialog",Font.BOLD,20));
                 t4.setText(s);
               }

        else
             if(ae.getSource( )==b4)
            {
                   t5.setFont(new Font("Dialog",Font.ITALIC,20));
                   t5.setText(s);
                 }
        }
      public static void main(String args[])
      {
             Convt cv=new Convt( );
             cv.validate( );
           }
    }


Write a command line program for line editor of practcal slip



/*
    slip-7
1. Write a command line program for line editor. The file to be edited is taken
 as command line argument, an empty  file is opened for editing if no argument
 is supplied.  It should display '$' prompt to accept the line editing commands.
Implement the following commands.
i)    a                 - to append
ii)    i  n                 - to insert after nth line
iii)    c    n1   n2              - to copy line n1 at  n2 position
iv)    c    n1, n2    n3   - to copy range of line at n3        [30 marks]

*/




#include<stdio.h>
#include<conio.h>
#include<string.h>
#define newnode (struct node *)malloc(sizeof(struct node))

struct node
{
    char line[80];
    struct node *next,*prev;
}*head=NULL;

int  length();
void print();
void append(char *line);
void load(char *);
void add();
void insert(char *,int);
void copy(int,int,int,int);





void load(char *fname)
{
    FILE *fp;
    char line[80];
    fp=fopen(fname,"r");
    if(fp==NULL)
    {
        printf("\nFile cannot boe opened..");
        getch();
        exit(0);
    }
    while(!feof(fp))
    {
        fgets(line,80,fp);
        append(line);
    }

}

void append(char *line)
{
    struct node *f,*s;
    f=newnode;
    strcpy(f->line,line);
    f->next=NULL;
    f->prev=NULL;
    if(head==NULL)
        head=f;
    else
    {
        for(s=head;s->next!=NULL;s=s->next);
        s->next=f;
        f->prev=s;
        s=s->next;
    }
}

void print()
{
    struct node *f;
    int i=1;
    for(f=head;f!=NULL;f=f->next)
        printf("%d %s",i++,f->line);
}

int length()
{
    int cnt=0;
    struct node *s;
    for(s=head;s!=NULL;s=s->next)
        cnt++;
    return cnt;
}

void insert(char *line,int from)
{
    struct node *f,*s;
    int len,i;
    if(from-1>length())
    {
        printf("\nError..");
        return;
    }

    f=newnode;
    f->next=NULL;
    f->prev=NULL;
    strcpy(f->line,line);

    if(from==1)
    {
        f->next=head;
        head->prev=f;
        head=head->prev;
        return;
    }
    else
    {
        s=head;
        for(i=1;i<(from-1);i++)
            s=s->next;
        f->next=s->next;
        s->next->prev=f;
        s->next=f;
        f->prev=s;
    }
}






main(int argc,char *argv[])
{
    int ch;
    int i,notok,from,to,range;
    char cmd[80],tok[4],line[80];
    clrscr();
    for(i=0;i<4;i++)
        tok[i]=(char )malloc(20);

    if(argc==2)
    {
        head=NULL;
        load(argv[1]);
    }
    while(1)
    {
        printf("\n?");
        flushall();
        gets(cmd);
        notok=sscanf(cmd,"%s%s%s%s",tok[0],tok[1],tok[2],tok[3]);
        switch(cmd[0])
        {
            case 'q':exit(1);

            case 'p':print();
                   break;
            case 'i':from=atoi(tok[1]);
                    printf("Input Line:");
                    flushall();
                    fgets(line,80,stdin);
                    insert(line,from);
                    break;

            case 'c':from=atoi(tok[1]);
                   to=atoi(tok[2]);
                   range=atoi(tok[3]);
                   copy(notok,from,to,range);
                   break;



        }
    }
}

void copy(int notok,int from,int to,int range)
{
    int len,i;
    struct node *s,*f,*temp;
    char line[80];
    len=length();
    if(from>len)
    {
        printf("\nError...");
        return;
    }

    if(notok==3)
    {
        s=head;
        for(i=0;i<(from-1);i++)
            s=s->next;
        insert(s->line,to);
    }

    if(notok==4)
    {
        if(to>len || range-1>len)
        {
            printf("\nError,,,");
            return;
        }
        s=head;
        for(i=0;i<(from-1);i++)
            s=s->next;
        for(i=from;i<=to && s!=NULL;i++)
        {
            insert(s->line,range++);
            s=s->next;
        }
    }
}

Program to develop for cost saving in hotel industry

 To develop a program for cost-saving in a hotel, you can consider the following features: Key Features 1. *Room Management*: Optimize room ...