This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Monday, January 7, 2013

Software development lab programming

 

 

                                   

 

SOFTWARE GAME

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. One actor is created.  Actor name is called user.

            Step2:             Then include use case by secondary click on use case view -> new->use case. Similarly create use case for five modules gam, stone gold, liquid gold, air gold and score.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram the creation includes create user and reservation use case.

           

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the five modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor “user”, and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the gam and the other classes select object message button (->).

            Step5:             Draw the line between the users and stone gold class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s name, score, id_no, etc.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as gamdata->ok. Create another table as gamtable in similar way and give its field name.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical views. Select new -> package and name it.

        Step2:   To draw the component diagram double click on component view, a component diagram window opens.

            Step3:             Secondary click on component view-> data modeler->    new-> database.

             Step4:   Secondary click on the component view select new-> package and name it.

            Step5:             Drag and drop the package, five components and the created database on the window.

            Step6:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new->device gam, stone gold, liquid gold, air gold score. and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                                     

RAILWAY RESERVATION

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. Two actors is created.  Actor name is called passenger and administrator.

            Step2:             Then include use case by secondary click on use case view->new->use case. Similarly create use case for seven modules login, create use case for seven modules login and create user, enquiry, reservation, seat arrangement, waiting list and cancellation.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram the creation includes create user and reservation use case.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the seven modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor "passenger" and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the passenger and the other classes select object message button (->).

            Step5:             Draw the line between the passenger and the homepage class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLOBORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates

                        Constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a datamodel diagram secondary click on the schema->data modeler->new->datamodel  diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required fields emp_id,emp->name,emo_address and basic pay.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as Employee_profile->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import.In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical view select newàpackage and name it.

            Step2:             Secondary click on component view-> data modeler->new-> database.

            Step3:             Drag and drop the package, seven components and the created database on the window.

            Step4:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deplyment diagram window.

            Step3:             Secondary click on the deployment view select new->device adband, registration,billing,direnq and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ONLINE BANKING MANAGEMENT

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. Two actors are created.  Actor name is called customer.

            Step2:             Then include use case by secondary click on use case view -> new->use case. Similarly create use case for six modules creation, atm, loan, deposit, withdraw, report.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association.

           

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the six classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the six modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor “customer”, and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the actors and the other classes select object message button (->).

            Step5:             Draw the line between the customer and creation class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s name, address, occupation, contact_no, etc.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as custtable->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the six physical components for all the six modules(creation, atm, loan, deposit, withdraw, report).

        Step2:   To draw the component diagram double click on component view, a component diagram window opens.

            Step3:             Secondary click on component view-> data modeler->    new-> database.

             Step4:   Secondary click on the component view select new-> package and name it.

            Step5:             Drag and drop the package, six components and the created database on the window.

            Step6:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new->device creation, atm, loan, deposit, withdraw, report and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                            

                                                                     

                                                                     

TELEPHONE DIRECTORY

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->new->actor. Two actors are created customer and officer.

            Step2:             Then include use case by secondary click on use case view->new->use case. Similarly create use case for five modules home page, broad band, registration, billing and direnq.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram the registration includes broad band and extends directory use cases. Billing includes both registration and broad band this relationship is represented by using the dependency button.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the seven modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor "customer" and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the user and the other classes select object message button (->).

            Step5:             Draw the line between the user and the homepage class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLOBORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically

                        creates a constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model  diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required fields name, address and occupation, modern type, plan option, lamt, bamt and totamt content.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as teleview->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical components for all the five modules.

        Step2:    to draw the component diagram double click on component view a component diagram window opens.

            Step3:            secondary click on the component view select new-> package and name it.

            Step4:             Secondary click on component view-> data modeler->new-> database.

            Step5:             Drag and drop the package, five components and the created database on the window.

            Step6:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new-> device. All the modules home page, broadband, registration, billing, direnq  and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

                                                                

                                                                     

                                   

LIBRARY MANAGEMENT SYSTEM

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view-> new->actor. Two actors are created.  Actor name is called user and administrator.

            Step2:             Then include use case by secondary click on use case view -> new->use case. Similarly create use case for six modules administration, membership, processing, search, acquisition and order.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. The diagram includes six modules and various attributes. Those modules are linked through unidirectional association.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the six classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the six modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor “user”, and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the customer and the other classes select object message button (->).

            Step5:             Draw the line between the customer and the creation class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s name, address, contact_no, etc,.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as member data->ok. Create another table as book data in similar way and give its field names.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required queries are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the six physical component for all the six modules.

        Step2:   To draw the component diagram double click on component view, a component diagram window opens.

            Step3:             Secondary click on component view-> data modeler->    new-> database.

             Step4:   Secondary click on the component view select new-> package and name it.

            Step5:             Drag and drop the package, six components and the created database on the window.

            Step6:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new->device administration, membership, processing, search, acquisition  order and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

                                                               

          

 

 

 

                                                          

                                                                     

 

HOTEL RESERVATION

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. Two actors is created.  Actor name is called Owner and Cutomer

            Step2:             Then include use case by secondary click on use case view->new->use case. Similarly create use case for eight modules login, create use case for eight modules login, Cost of Rooms, Room status, Finance, Food, Workers, Maintenances, and Facilities

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram the creation includes create user and reservation use case.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the seven modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor "passenger" and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the passenger and the other classes select object message button (->).

            Step5:             Draw the line between the passenger and the homepage class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLOBORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates

                        Constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a datamodel diagram secondary click on the schema->data modeler->new->datamodel  diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required fields emp_id,emp->name,emo_address and basic pay.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as Employee_profile->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import.In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical view select newàpackage and name it.

            Step2:             Secondary click on component view-> data modeler->new-> database.

            Step3:             Drag and drop the package, seven components and the created database on the window.

            Step4:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deplyment diagram window.

            Step3:             Secondary click on the deployment view select new->device adband, registration,billing,direnq and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                               

                                                                     

                                                                     

STUDENT INFORMATION

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->new->actor. Two actors are created.  Actor name is called user and admin.

            Step2:             Then include use case by secondary click on use case view -> new->use case. Similarly create use case for five modules

                        User1, find letter or word, display, database and administrator.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram user1 extends find letter or word extends display, this relationship is represented by using the dependency button.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the five modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor "admin" or “user” and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the user, admin and the other classes select object message button (->).

            Step5:             Draw the line between the user and the user’s class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s word and meaning.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as view->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the five physical components for all the four modules.

        Step2:    to draw the component diagram double click on component view a component diagram window opens.

            Step3:            secondary click on the component view select new-> package and name it.

            Step4:             Secondary click on component view-> data modeler->new-> database.

            Step5:             Drag and drop the package, four components and the created database on the window.

            Step6:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new-> device. All the modules users, administrator, find the letter or word, displaying and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                                

                                                                     

                                                                     

EMPLOYEE PAYBILL

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. Two actors are created.  Actor name is called HR and administrator.

            Step2:             Then include use case by secondary click on use case view -> new->use case. Similarly create use case for five modules

                        Employee profile, attendance, leaves info, pay slip generation and payroll mgnt.

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram generate a association between employee profile, attendance, leave info, pay slip generation and payroll mgnt.

              Step5:  Open the specification for the association specified that has extended.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the five classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the five modules using the unidirectional association button by dragging lines between them.

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor "HR" and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the pay slip generation and the other classes select object message button (->).

            Step5:             Draw the line between the HR and the employee profie class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s customer_id, customer_name.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as customer->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical view select newàpackage and name it.

            Step2:             Secondary click on component view-> data modeler->new-> database.

            Step3:             Drag and drop the package, seven components and the created database on the window.

            Step4:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new->device c_order, purchase, sales, stock etc and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                           

INVENTORY SYSTEM

 

 

 

 

USECASE DIAGRAM

 

            Step1:  To create a use case diagram secondary click on use case view->     new->actor. Two actors are created.  Actor name is called customer and suppliers.

            Step2:             Then include use case by secondary click on use case

                           view-> new->use case. Similarly create use case for seven modules purchase, sales, stock, c_order, c_ordreturn,  s_purchase, s_purchasereturn

            Step3:             Drag and drop the actors and use cases on the use case view window.

            Step4:             The actors and use cases are related by using unidirectional association button. In the diagram purchase, sales, stock, c_order, c_ordreturn, s_purchase, s_purchasereturn.

            Step5:   Open the specification for the association specified that has extended.

 

CLASS DIAGRAM

 

            Step1:             To create the class diagram secondary clicks the logical view->new->class. Similarly create all the seven classes.

            Step2:             Drag and drop the classes on the class diagram window.

            Step3:             Secondary click on the class ->new attribute to include the corresponding attributes to the classes.

            Step4:             Secondary click on the class->new operation to include to the corresponding functions to the classes.

            Step5:             Add the relationships between all the seven modules using the unidirectional association button by dragging lines between them.

 

 

 

 

 

 

SEQUENCE DIAGRAM

 

            Step1:             This diagram is based on the class diagram.

            Step2:             To create the sequence diagram secondary click on the logical view and select new->sequence diagram.

            Step3:             Double click on the sequence diagram to open the sequence diagram window. Drag and drop the actor “customer”, “suppliers” and all the classes on the window that were created earlier in the use case diagram.

            Step4:             To represent the relationship between the actors and the other classes select object message button (->).

            Step5:             Draw the line between the customer and c_order class then secondary click on the line and select the respective function to be called.  Similarly draw and select the appropriate associate for each class.

 

COLLABORATION DIAGRAM

 

            Step1:             Once the sequence diagram is created, to generate the collaboration diagram press F5.

            Step2:             Collaboration diagram is now created and shows all the relationships and Associations created earlier.

 

STATECHART DIAGRAM

 

            Step1:             To create a state chart diagram secondary click on logical view and select new->state chart diagram.

            Step2:             Double click on the state chart diagram to open the state chart diagram window.

            Step3:             Select the start state button to show the start of the process in the diagram and place it on the window.

            Step4:             The modules are represented by the state button.  Place the end state in the diagram. And arrange the states on the diagram.

            Step5:             Relationships are represented using the state transition button.  Drag the arrows between all the states.

 

 

 

 

 

CODE GENERATION

 

            Step1:             To generate codes select tools->options->notation tab and set the default language as java.

            Step2:             Select tools->java->project specification.  The specification window opens and then the class path pointing to java compiler is set.

            Step3:             After setting the path secondary click on each class in the class diagram and select Java->generate code.

            Step4:             After the code is generated for each class it automatically creates constructor for each class.

 

DATAMODEL DIAGRAM

 

            Step1:             To create a data model diagram secondary click on the schema->data modeler->new->data model diagram.  A data model diagram window opens.

            Step2:             Secondary click on the created schema->data modeler->new->table.  Give the required field’s customer_id, customer_name.

            Step3:             To create a view for schema. Secondary click on the created view->open specification rename it as customer->ok.

            Step4:             In the form tab select the available variables and view members, then check the correlation name.

            Step5:             In the columns tab-> import columns and select all the fields of the table -> import. In the SQL tab all the required quires are generated->apply.

            Step6:             Drag and drop the table and the view on the data model diagram window and link both the table and view by using the dependency button.

 

 

 

 

 

 

 

 

 

COMPONENT DIAGRAM

 

            Step1:             After the code generation the rational rose generates the seven physical view select newàpackage and name it.

            Step2:             Secondary click on component view-> data modeler->new-> database.

            Step3:             Drag and drop the package, seven components and the created database on the window.

            Step4:            Relationship is represented using the dependency button by drawing the line between the components, package and database.

 

DEPLOYMENT DIAGRAM

 

            Step1:             Before the deployment diagram the schema is created where the database tables are created in the logical view.

            Step2:             Double click on the deployment view to open the deployment diagram window.

            Step3:             Secondary click on the deployment view select new->device c_order, purchase, sales, stock etc and the database all are represented as devices.

            Step4:             All the devices are linked together by using connect button.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Unix Lab Programming

 

 

 

 

  1. /*BASIC UNIX AND NETWORKING COMMANDS*/

 

 

 

BASIC UNIX COMMANDS

 

 

passwd:

 

            This command allows you to change your login password. You are propted to enter your current password, and then prompted (twice) to enter  your new password.

                          

 

OUTPUT:

 

[2mcaa17mca24~]$ passwd

 

changing password for user 2mcaa2

changing password for 2mcaa2

(current) UNIX password:

New UNIX password:

Retype new UNIX password.

 

passwd: all authentication token updated successfully.

 

 

cd:

 

            This command, as in DOS changes directories. You can use to represent the directory above the current directory.

 

syntax:   cd directory name

 

 

OUTPUT:

 

[2mcaa17@mca24~]$ cd khs

[2mcaa17@mca24~ khs]$

 

 

 

 

 

 


pwd
:

 

            This command tells you which directory you are currently working in, your home directory from anywhere, type cd~, however typing cd without the ~ also works on Linux system.

 

OUTPUT:

 

[2mcaa2@mca24~]$ pwd

/home/2mcaa2/khs

 

 

ls:

 

            This gives you listing of all files in a directory. You cannot tell which files are and which directories are.

 

 

OUTPUT:

 

arms.sh            fibb.sh             fibo.sh             reverse.sh

sqcu.sh                        sum.sh             swapping.sh

 

ls-f:

 

            This shows which files are normal files (they have no special symbols at the end), which are directories (they end in a/character), which are links (they end in a @ symbol) and which are executables (they end in a *character). There special symbol are NOT part of the file name.

 

OUTPUT:

 

.creat.c.swo     .zshre               .                       ..                      .bash_logout

.bashrc             .swp                 .add.sh.swp     .swm.sh           swapping.sh   

.creat.sh.swp   .fork.c.swp      .fibb.sh.swp     swapp.sh         .viminfo

arms.sh            .bash_profile   fibo.sh            .bash_history   .kde

.sqcu.sh           .creat.c.swp

 

ls-l:

 

            "Long" format. Gives more details about the files and directories in the current directory.

 

 

 

 

 

OUTPUT:

 

[2mcaa2@mca24~]$ ls-l

 

total 32

 

-rw-r--r--          1 2mcaa2 2mcaa2 232 Jul 1 19:44 arms.sh

-rw-r--r--          1 2mcaa2 2mcaa2 197 Jul 2 19:17 fibb.sh

-rw-r--r--          1 2mcaa2 2mcaa2 233 Jul 2 19:16 fibo.sh

-rw-r--r--          1 2mcaa2 2mcaa2 124 Jul 4 16:44 revere.sh

-rw-r--r--          1 2mcaa2 2mcaa2 160 Jul 6 20:29 sqcu.sh

-rw-r--r--          1 2mcaa2 2mcaa2 157 Jul 6 19:42 sum.sh

-rw-r--r--          1 2mcaa2 2mcaa2 175 Jul 6 20:22 swapp.sh

 

 

ls-a:

 

            List "hidden" files in current directory (Those starting with a. character).

 

OUTPUT:

 

.                       arms.sh            .bash_profile   .create.c.swp   .fibb.sh.swp     .kde    

.sww.sh           swp                  ..                      .bash_history   .fibo.sh            reverse.sh .\sqcu.sh      .fork.c.swp             .zshrc               .bash.logout

 

 

ls-la:

 

            Options may usually be combined. This particular combination would list both hidden and unhidden files in the long format.

 

OUTPUT:

 

total 176

 

drwx-----         3          2mcaa2      2mcaa2      4096     Jul       6        20:29    .

drwxr-xr-x       386      root             root           12288  Jul       30      15:00    ..          

-rw------           1          2mcaa2       2mcaa2     12288  Dec     12      2008     .

-rw-r--r--          1          2mcaa2       2mcaa2     232      Jul       1        19:44    arms.sh

-rw-r--r--          1          2mcaa2       2mcaa2     197       Jul       2        19:17    fibb.sh

 

 

 

 

 

 

mv:

            The "move" command is how you rename files.

Syntax:   mv oldfilename newfilename

 

OUTPUT:

 

[2mcaa2@mca24~]$ mv swapp.sh  swap.sh

[2mcaa2@mca24~]$ ls

 

arms.sh            fibb.sh             fibo.sh             reverse.sh               swap.sh

                      

 

cp:

            Allowos you to copy one or more files.

 

syntax:      cp oldfilename.sh newfilename.sh

 

OUTPUT:

 

[2mcaa2@mca24~]$ cp fibb.sh fibonaci.sh

 

 

rm:

            Deletes a file. BE CAREFULL!! There is no "undeleted" command.

 

syntax:            rm filename.sh

 

OUTPUT:

 

[2mcaa2@mca24~]$ rm sum.sh

 

 

cat:

            Sends the contents of a file to stdout (usually the display screen). The name comes from "concatenate".

 

syntax:            cat

 

OUTPUT:

 

[2mcaa2@mca24~]$ cat

Welcome to all

Welcome to all

 

 

more:

            Like cat but display a files one page a time.

 

syntax:            more filename.sh

 

 

OUTPUT:

 

[2mcaa2@mca24~]$ more arithmetic.sh

 

echo "Read two values";

read a b;

c='expr $a + $b';

d='expr $a - $b';

e='expr $a /* $b';

f='expr $a % $b';

echo "c = $c";

echo "d = $d";

echo "e = $e";

echo "f = $f";

 

 

wc:

 

            Counts the number of lines, words and characters in a file.

 

Syntax:   wc filename.sh

 

OUTPUT:

 

[2mcaa2@mca24~]$ wc arithmetic.sh

 

10        35        163      arithmetic.sh

 

 

tail-n:

 

            Display the last n lines of a file.

 

Syntax:   tail-n lines filename.sh

 

 

 

 

 

 

OUTPUT:

 

[2mcaa2@mca24~]$ tail -2 arithmetic.sh

 

echo "e = $e";

echo "f = $f";

 

 

head-n:

 

            Display the first n lines of a file.

 

Syntax:  head -n filename.sh

 

OUTPUT:

 

[2mcaa2@mca24~]$ head -3 arithmetic.sh

 

echo "Read two values";

read a b;

c = 'expr $a + $b';

 

 

mkdir:

 

            Creates a new directory, located below the presents directory. (Use pwd first tp check where you are)

 

Syntax:    mkdir directoryname

 

OUTPUT:

 

[2mcaa2@mca24~]$ mkdir khs

 

 

rmdir:              

 

            Deletes a directory.

 

Syntax:  rmdir directoryname

 

OUTPUT:

 

[2mcaa2@mca24~]$ rmdir khs

 

man:

 

            The most important UNIX command. It displays the manual pages fir a chosen UNIX command. Press [Enter] to advance one line, [Spacebar] to advance one page, and [Q] key to quit and return to the UNIX prompt.

 

Syntax:   man mkdir

 

OUTPUT:

 

NAME                        mkdir -make directories

SYNOPSIS     mkdir [OPTION] DIRECTORY....

 

DESCRIPTION

           

            Create the DIRECTORY(ies), if they do not already exits.

            Mandatory arguments to long options are mandatory for short options too.

            -z, --context = CONTEXT (SE Linux) set security context to CONTEXT.

            -m, --mode = NODE

            set permission mode (as in chmod), not rwxrwxrwx -unmask.

 

AUTHOR

 

            Written by David Mackenzie.

 

REPORTING BUGS

           

            Report bugs to <bug-coreutils@gnu.org>.

 

man-k:

 

            Displays all UNIX commands related to a given keyword.

 

Syntax:  man command -k

 

OUTPUT:

 

[2mcaa2@mca24~]$ man mkdir -k

 

mkdir               (1)   - make directories

mkdir               (2p) - make directories

mkdir               (2)   - create a directory

mkdir               (3p) - make a directory

mkdirat                        (2)   - create a directory relative to a directory file descriptor

mkdir hier                    (1x) - makes a directory hierarchy

 

 

date:

 

            Shows the current time and date.

 

syntax:            date

 

OUTPUT:

 

[2mcaa2@mca24~]$ date

 

Wed Jul 8 20:49:48 IST 2009

 

 

logout:

 

            Terminate the current login session, land returns you to your telnet client, if that is how you established the session originally.

 

syntax:            logout

 

OUTPUT:

 

[2mcaa2@mca24~]$ logout

 

There are stopped jobs

 

[2mcaa2@mca24~]$

 

 

 

 

 

 

 

 

 

 

 

                 

 

 

         

2./* CREATE OPEN CLOSE SYSTEM CALL */

 

 

 

#include<stdio.h>

#include<stdlib.h>                           

#include<fcntl.h>                

#include<unistd.h>

#include<sys/types.h>

int main(int argc, char *argv[])

{                                                                                         

int fd1;

char buf[4096];

fd1=creat(argv[1],O_WRONLY);

if(fd1<0)

{

printf("\n error creating file %s \n",argv[1]);

exit(0);

}

close(fd1);

printf("/n fib %s is created  sucessfully", argv[1]);

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

OUTPUT:

 

 

[2mcaa17@mca24 ~]$ vim rlab2.c

[2mcaa17@mca24 ~]$ gcc rlab2.c

[2mcaa17@mca24 ~]$ ./a.out rexample.c

 

/n fib rexample.c is created  successfully

 

[2mcaa17@mca24 ~]$./a.out rexample.c

 

error creating file rexample.c

 

[2mcaa17@mca24 ~]$ ./a.out

              

error creating file (null)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                     

                                  3.  /* EXEC SYSTEM CALL */

 

 

 

 

#include<unistd.h>

#include<stdio.h>

#include<sys/types.h>

#include<sys/stat.h>

#include<stdlib.h>

#include<fcntl.h>

int system(const char * cmd)

{

pid_t pid;

int status;

if(cmd==NULL)

status = 1;

else if((pid=fork())<0)

status = -1;

else if(pid==0)

{

printf("\n\n Now executing command %s \n \n",cmd );

sleep(2);

execl("/bin/sh","sh","c",cmd,(char *)0);

_exit(127);

}

return(status);

}

int main()

{

int st;

st=system("date");

st=system("uname -a");

}

 

 

 

 

 

 

 

 

 

 

                                          

OUTPUT:

                            

 

                               /* EXEC SYSTEM CALL */

 

 

[2mcaa17@mca24 ~]$ vim  rlab8.c

[2mcaa17@mca24 ~]$ gcc  rlab8.c

[2mcaa17@mca24 ~]$ ./a.out

 

 

Now executing command date

 

 

Now executing command uname -a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                           4.  /*LSEEK SYSTEM CALL */

 

 

 

 

#include<stdio.h>

#include<unistd.h>

#include<sys/types.h>

#include<sys/stat.h>

#include<stdlib.h>

#include<fcntl.h>

int main(int argc,char *argv[])

{

 

int lv,ret,fd,n;

char buff[4096];

fd=open(argv[1],O_RDONLY);

lv=lseek(fd,0,SEEK_END);

lseek(fd,0,SEEK_SET);

printf("LV=%d,LV/2=%d",lv,lv/2);

while((ret=read(fd,buff,4096))!=-1)

{

write(STDOUT_FILENO,buff,lv/2);

printf("\n\n");

exit(0);

}

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

/*LSEEK SYSTEM CALL */

 

 

 

 

OUTPUT:

 

 

 

 

[2mcaa17@mca24 ~]$ vim rlab6.c

[2mcaa17@mca24 ~]$ gcc rlab6.c

[2mcaa17@mca24 ~]$ ./a.out rlab1.c

#include <sys/types.h>

#include <sys/stat.h>

#include<stdio.h>

#include<stdlib.h>

main(int argc,char *argv[])

{

int i;

struct stat statbuff;

char *ptr;

for(i=1; i<argc; i++)

{

printf ("%s",argv[i]);

if(stat(argv[i],&statbuff)<0)

printf("fstat error");

switch(statbuff.st_mode & S_IFMT)

{

case S_IFDIR: ptr="directory";

break;

case S_IFCHR: ptr="charac

 

LV=702,LV/2=351

 

 

                

 

 

 

 

 

 

 

 

 

 

                                  5. /*FILE TYPES */             

 

                   

#include <sys/types.h>

#include <sys/stat.h>

#include<stdio.h>

#include<stdlib.h>

main(int argc,char *argv[])

{

int i;

struct stat statbuff;

char *ptr;

for(i=1; i<argc; i++)

{

printf ("%s",argv[i]);

if(stat(argv[i],&statbuff)<0)

printf("fstat error");

switch(statbuff.st_mode & S_IFMT)

{

case S_IFDIR: ptr="DIRECTORY";

break;

case S_IFCHR: ptr="CHARACTER ";

break;

case S_IFBLK:  ptr="BLOCK SPECIAL";

break;

case S_IFREG:

ptr="REGULAR";

break;

#ifdef S_IFLINK

case S_IFLINK:

ptr="SYMBOLIC LINK";

break;