Xi Practical File

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Index

SNo. Index Page Remark


No
1. Making use of Page Formatting,
Header and Footer in Open Office
Writer
2. Making use of Hyperlink in Open
Office Writer
3. Creating and Applying formula is
Open Office Calc
4. Creating Charts in Open Office Calc
5. Creating database and tables using
SQL Query
6. Creating table and making use of
various SQL queries to get specific
output.
7. Creating table and making use of
various DML command to get
specific output.
8. Introduction to NetBeans IDE and
Basic of Java
9. To design GUI Application to
Display Message
10 To Design a GUI Application to add
two numbers
11. To Design a GUI Application to
calculate the Simple Interest
1. A one-page article that lists the steps that you take to clean the
environment (use bullets). Format the page. Insert header and
footer in the document.
Ans-
 Start Open office writer and create a new document.
 Turn on the bullet and numbering option to write the steps to make the
environment clean.
Steps to format the page
Inserting Headers and Footers
A header is an area that appears at the top of a page. A footer appears at
the bottom of the page. Information, such as page numbers inserted into
a header or footer, displays on every page of the document with that page
style.
Steps to insert header and footer.
 To insert a header, choose Insert > Header > Default (or the page
style, if not Default).
 Click File > Properties > Description and type a title for your
document.
 Add a header (Insert > Header > Default).
 Place the cursor in the header part of the page.
 Choose Insert > Fields > Title. The title should appear on a gray
background (which does not show when printed and can be turned
off).
 To change the title for the whole document, go back to File >
Properties > Description.
2. What is hyperlink? Write the steps to create the hyperlink in
your document.
Hyperlink-In computing, a hyperlink, or simply a link, is a reference to
data that the user can follow by clicking or tapping. A hyperlink points
to a whole document or to a specific element within a document.
Hypertext is text with hyperlinks. The text that is linked from is called
anchor text.
Steps to insert hyperlink
 To display the dialog, click the Hyperlink icon on the Standard
toolbar or choose Insert > Hyperlink from the menu bar.
 To turn existing text into a link, highlight it before opening the
dialog. On the left side, select one of the four categories of hyperlink:
 Internet: the hyperlink points to a web address, normally
starting with http://
 Mail & News: the hyperlink opens an email message that is pre-
addressed to a particular recipient
 Document: the hyperlink points to another document or to
another place in the current document
 New document: the hyperlink creates a new document

The top right part of the dialog changes according to the choice made for
the hyperlink category in the left panel. A full description of all the choices
and their interactions is beyond the scope of this chapter. Here is a
summary of the most common choices.
 For an Internet hyperlink, choose the type of hyperlink (Web, FTP, or
Telnet), and enter the required web address (URL).
 For a Mail and News hyperlink, specify whether it is a mail or news
link, the receiver’s address, and for email, also the subject.
 For a Document hyperlink, specify the document path (the Open File
button opens a file browser) or leave this blank if you want to link to
a target in the same document. Optionally specify the target in the
document (for example a specific slide). Click on the Target in
Document icon to open the Navigator where you can select the
target; or if you know the name of the target, you can type it into the
box.
 For a New Document hyperlink, specify whether to edit the newly
created document immediately (Edit now) or just create it (Edit
later), enter the file name, and select the type of document to create
(text, spreadsheet, and so on). Click the Select Path button to open a
file browser and choose where to store the file.
The Further settings section in the bottom right part of the dialog is
common to all the hyperlink categories, although some choices are
more relevant to some types of links.

 Set the value of Frame to determine how the hyperlink will open.
This applies to documents that open in a Web browser.
 Form specifies if the link is to be presented as text or as a button. A
hyperlink button is a type of form control. See Chapter 15 of the
Writer Guide for more information.
 Text specifies the text that will be visible to the user. If you do not
enter anything here, OOo uses the full URL or path as the link text.
Note that if the link is relative and you move the file, this text will not
change, though the target will.
 Name is applicable to HTML documents. It specifies text that will be
added as a NAME attribute in the HTML code behind the hyperlink.
 Events button : click this button to open the Assign Macro dialog
and choose a macro to run when the link is clicked.
3. What is formula? Write the various method to create the basic
formula in Calc.
Formula- It is an equation that makes calculations based on the
data in your spreadsheet. Formulas are entered into a cell in your
worksheet. They must begin with an equal sign, followed by the
addresses of the cells that will be calculated upon, with an
appropriate operand placed in between.
Creating formula using direct values.
Example : Adding data in two numbers and storing the result in cell
Step 1: In cell D6, type the equal sign (=). This informs Calc that D6
will contain a formula.
Step 2: Now type 4+5
Step 3: Press Enter Cell D6 will contain 9. You can see the formula
(=4+5) in the Input line in the formula toolbar

Creating formula using cell reference


In Calc, a cell reference identifies the location of a cell or group of cells
in the worksheet. The cell reference is also called address of a cell. Cell
references are used in formulas, functions, and other commands.
The steps to insert cell reference using the mouse is as follows:
Step 1: Double-Click on the cell in which you want to insert cell
reference.
Step 2: Type equal sign (=).
Step 3: Now click on the cell whose reference you want to add. On
Clicking you will notice that the address of the cell which you
have clicked is inserted.
For example, steps to add data in two cells D4 and D5 and store the
result in cell D6.
Step 1: Enter numbers in cell D4 and D5.
Step 2: Double-click on the cell D6 and type =.
Step 3: Click on cell D4. The address D4 will be inserted in cell D6
after the = sign. Alternatively, you can type D4.
Step 4: Type plus sign (+) in cell D6.
Step 5: Click on cell D5, the address D5 will be inserted in cell D6
after the + sign. Alternatively, you can type D5.
Formula in cell D6 =D4+D5.
4. What is chart? What are the various types of charts mainly used
in Calc. Write the steps to insert a chart with suitable example.
Ans- A chart is graphical or pictorial representation of worksheet data
The various types of chart mainly used in Calc are.
a. Column Chart d. Line Chart
b. Bar Chart e. Area Chart
c. Pie Chart f. Line Chart
Steps to insert chart in Calc
Step 1: Select the data which is to be
included in the chart.
Step 2: Go to the Insert menu and select
the Chart option as shown in Figure 4.54
or another way is to click on the Chart icon
in the Standard toolbar.
Step 3: Chart wizard dialog box is
displayed as shown in Fig which is used to
insert various options related to the chart
such as the type of chart, data range, data
series and elements of the chart.
Step 4: Select the chart type (Column
chart, Bar chart, Pie chart etc.) and click
on the Finish button.
5.Write SQL query to create the following Database: Library and table:
Book with following description also write the query to view the
structure of the created table .
Field Name Datatype Constraint
BNo Integer(4) primary Key
Bname Varchar(20)
Author Varchar(30)
Price Decimal(4,2)

 SQL Query to create the database is as follow:


Syntax:
CREATE DATABASE <DATABASE NAME>;
Example-
mysql>CREATE DATABASE LIBRARY;
Using above query a databse named library is created.
 SQL Query to create the table Books in created database named
Library
Syntax: CREATE TABLE <TableName>(<ColumnName1><Data
Type1>,<ColumnName2> <Data Type2>,… ,<ColumnNameN> <Data
TypeN>);
Example-
mysql>CREATE TABLE Books(BNO INTEGER(6) PRIMARY
KEY,BNAME VARCHAR(25),AUTHOR VARCHAR(35),PRICE
DECIMAL(4,2));
Using above query the table Books is created in the database Library.
 SQL Query to create to view the stucture of the table
The DESCRIBE statement can be used to see the structure of a table
as indicated in the Create Statement.
Syntax:
DESCRIBE <table name>;
OR
DESC <table name>;
mysql> DESCRIBE Student;
6. Consider the following table named "Student_Data" with details
about students.
Table Name : Student_Data

Admno Name Father Name Address


1001 Anirudh Amrish Kumar Adarsh Nagar
1002 Kamlesh Sunil Kumar Vikas Nagar
1003 Suman Avinash Choudhary Shyampur
1004 Anita Karamchand Ranjeetpur
1005 Kavyanshi Arvind Garg Hari Nagar
1006 Daljeet Kaur Sukhjeet Singh Main Market
1007 Amir Ansari Suhail Ansari New Colony
1008 Surendra Singh Satish Kumar Vikas Nagar
1009 Arnav Singh Rajbeer Choudhary Ram Colony
1010 Vidisha Singhal Sanjay Singhal Adarsh Nagar
 Write SQL statements to do the following:
a. Display all the record in the table.
b. To add primary key constraint on the field “Admno”
c. To add a column named “Contact_No” in a table in the above table.
d. To make column named “Contact_No” NOT NULL( It will not accept
NULL value.
e. To delete the structure or remove the table
Ans-
a. Display all the record in the table.
SELECT command is used to view the data from a relation in a
database. It returns a result set of data/ records from one or more
relations.
Syntax of SELECT Command :
SELECT <column name> FROM <table name >;
mysql> select * from Student_Data;
b. To add primary key constraint on the field “Admno”
ALTER TABLE command is used to specify the primary key.
Syntax of ALTER TABLE :
ALTER TABLE <Table Name> ADD PRIMARY KEY <column name>;
Statement:
mysql> ALTER TABLE Student_Data ADD PRIMARY KEY(Admno);
c. To add a column named “Contact_No” in a table in the above
table.
ALTER TABLE command is used to ADD/DROP column from the
table.
Syntax:
ALTER TABLE <table_name>ADD/DROP<column name[datatype];
Statement:
ALTER TABLE Student_Data ADD Address(varchar(40));
d. To make column named “Contact_No” NOT NULL(It will not accept
NULL value.
ALTER TABLE Student_Data MODIFY Contact_No INTEGER NOT
NULL;
e. To delete the structure of table or remove the table.
f. DROP TABLE command is used delete the structure of table or remove
the table.
Syntax:
DROP TABLE <tablename>;
Statement:
DROP TABLE Student_Data;
7. Consider a following table in which students marks are given.
Write the SQL statement to do the following.

Admno Name Gender Marks/700


1101 Piyush M 572
1102 Somit M 489
1103 Raghav M 678
1104 Anshika Saini F 587
1105 Aditi Panwar F 256
1106 Ritika Singh F 612
1107 Arsh Malik M 577
1108 Parasdeep Singh M 495
1109 Devansh M 345
1110 Varnika Gupta F 640

a. To insert new record in table


Admno=1111, Name =Adesh Kumar ,Gender-F, Marks=610
b. To display the marks without repitation.
c. To display records of students who have a got marks greater than
600.
d. Make use of airthmetic operator to give 20 marks of activity
whose marks are lessthan 350.
e. To display the records of the students who are female and marks
are greather than 500.
f. To display the records of the students who have marks greater
then 350 and lessthan 650.
Ans-
a. To insert new record in table
Admno=1111, Name =Adesh Kumar , Gender=F, Marks=610
INSERT INTO command is used to enter values in a table. Syntax of
insert command is as follows
INSERT INTO <TABLENAME >(COLUMN NAMES>) VALUES (value1,
value2, value3,……)
Example-
mysql> INSERT INTO STUDENT(Admno,Name,Gender, Marks)
VALUES(1111,'Adesh Kumar', 'F',610);
b. To display the marks without repitation.
DISTINCT command is used to displaying values without repetition.
Example-
mysql> Select DISTINCT marks from STUDENT;
c. To display records of students who have a got marks greater than
600.
Where clause is used to fetch data based on a criteria/ condition.
Criteria can be given using an expression.
Syntax:
SELECT <column name1> [,<column name> ,….] FROM <table name>
WHERE <condition>;
Example:
mysql> select Admno, Name, Marks from STUDENT WHERE
Marks>600
d. Make use of airthmetic operator to give 20 marks of activity
whose marks are lessthan 350.
mysql> select Name, Marks + 20 from Student where Marks <350;
e. To display the records of the students who are female and marks
are greather than 500.
mysql> select Admno,Name,Gender,Marks FROM STUDENT
WHERE Gender='F' and Marks>500 ;
f. To display the records of the students who have marks greater
then 350 and lessthan 650.
mysql> mysql> select Admno,Name,Gender,Marks FROM STUDENT
WHERE Marks > 350 and Marks<650;
8. Write the steps to create the following in Java.
 Create a New Form
 Create a JFrame Form container
 To add button component to the form
Creating a new Project
Creating a new Form
To create a new application project called "Book":
1. Choose File > New Project. Alternately, click the New Project icon in
the toolbar.
2. From the Categories pane select Java and in the Projects pane,
choose Java Application.Click Next.
3. Enter a name (in this case Book) in the Project Name field and specify
the project location by clicking on the Browse button. By default, the
project is saved in the NetBeans Projects folder in My Documents and
so this is the default Project location displayed in this field.
4. Ensure that the Set as Main Project checkbox is selected and clear
the Create Main Class field.
5. Click Finish.
To create a JFrame Form container:
1. In the Projects window, right-click the Book node and choose New >
JFrame Form as shown in Figure 5.21.

2. Enter Form Example 1 as the Class Name. This will be the name of
your form.
3. Enter Book as the package. This should be the name given while
creating the Project. 4. Click
4. Finish.
Netbeans creates The Form Example1 form within the application and
opens the form in the
Builder. Now we are ready to add components to our form.
Adding a Button Component to a Form
We want to add a button so follow the given steps to add a JButton to the
form:
1.In the Palette window, select the JButton component from the Swing
Controls category displayed in Figure .

2.Move the cursor over the Form. When the guidelines appear (as displayed
in Figure 5.22) indicating that the JButton is positioned in the desired
location, click to place the button. The JButton is added to the form as
displayed in Figure 5.22. Note that as soon as the button is added on the
form, a corresponding node representing the component is added to the
Inspector window.
9. Design a GUI application in Java to display a message “ Hello!
Good Morning” on clicking the jbutton.
Ans- The aim of the application is to display the meesage on the click of
a button.

Steps to create the Jform.


1. Create the new project named Hello byfllowing the general steps to
create the project.
2. In the Projects window, right-click the Hello node and choose New >
JFrame.
3. Enter Message as the Class Name. This will be the name of your
form.
4. Enter Hello as the package. This should be the name given while
creating the Project.
5. Click Finish
Adding componets to the Jform
6. In the Palette window, select the JButton component from the Swing
Controls category.
7. Move the cursor over the Form. When the guidelines appear indicating
that the JButton is positioned in the desired location, click to place
the button. The JButton is added to the form as displayed in Note that
as soon as the button is added on the form, a corresponding node
representing the component is added to the Inspector window.
8. Select the button component by clicking on it. In the Properties
window highlight the text property and type STOP in the textbox
adjacent to it.
9. Switch to the source window and add the single line code in the
following section of the code.
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt)
{
JOptionPane.showMessageDialog(this,"Hello! Good Morning");
}
10. Press the run button or F6 file to execute the code to view the output.
10. Design a GUI application to add two numbers.
Ans- The aim of the application is to accept the two numbers in two
separate text fields and add the numbers on the click of a button.

Steps to create the Jform.


1. Create the new project named Additon by following the general steps
to create the project.
2. In the Projects window, right-click the Addition node and choose
New > JFrame.
3. Enter SUM as the Class Name. This will be the name of your form.
4. Enter Addition as the package. This should be the name given while
creating the Project. Addition
5. Click Finish
Adding componets to the Jform
6. In the Palette window, select the JLabel component from the Swing
Controls category.
7. Move the cursor over the Form. When the guidelines appear indicating
that the JLabel is positioned in the desired location, click to place the
button. The JLabel is added to the form as displayed.
8. Repeat the step 6 and 7 to add two more labels (Second Number and
Result)
9. Select the label component by clicking on it. In the Properties window
highlight the text property and type First Number in the textbox
adjacent to it.
10. Repeat the above step to set the text property of other label
components available on the form.
11. Now In the Palette window, select the JTextField component from the
Swing Controls category.
12. Repeat the step to 7 to place the component on the form.
13. Again repeat the above steps to add the two more JTextField to the
form.
14. Select the TextField component by clicking on it. In the Properties
window highlight the text property and make it blank in the textbox
adjacent to it.
15. Repeat the above step to set the text property of other TextField
component components available on the form.
16. In the Palette window, select the JButton component from the Swing
Controls category.
17. Move the cursor over the Form. When the guidelines appear indicating
that the JButton is positioned in the desired location, click to place
the button. The JButton is added to the form as displayed.
18. Select the button component by clicking on it. In the Properties
window highlight the text property and type ADD in the textbox
adjacent to it.
19. Repeat the step no 17 to add another button component and In the
Properties window highlight the text property and type STOP in the
textbox adjacent to it.
20. Switch to the source window and add the single line code in the
following section of the code.
Coding:
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
// Code to add Number1and Number2:
double Number1,Number2,Result;
Number1=Double.parseDouble(jTextField1.getText());
Number2=Double.parseDouble(jTextField2.getText());
Result=Number1+Number2;
jTextField3.setText(Double.toString(Result));
}
private void
jButton5ActionPerformed(java.awt.event.ActionEvent
evt)
{
// Code to clear the contents of thetext field:
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
}

21. Press the run button or F6 file to execute the code to view the output.
11. Design a GUI application to calculate the simple intrest.
Ans- The aim of the application is to accept the principal amount, rate
and time in three separate text fields and calculate the simple interest
on the click of a button.

Steps to create the Jform.


1. Create the new project named SI(Simple Intrest) by following the
general steps to create the project.
2. In the Projects window, right-click the SI node and choose New >
JFrame.
3. Enter Interest_Calc(Intrest Calculator) as the Class Name. This will
be the name of your form.
4. Enter SI as the package. This should be the name given while
creating the Project.
5. Click Finish
Adding componets to the Jform
6. In the Palette window, select the JLabel component from the Swing
Controls category.
7. Move the cursor over the Form. When the guidelines appear
indicating that the JLabel is positioned in the desired location, click
to place the button. The JLabel is added to the form as displayed.
8. Reapeat the step 6 and 7 to add three more labels (Rate % ,Time
and Simple Intrest)
9. Select the label component by clicking on it. In the Properties window
highlight the text property and type Principle in the textbox adjacent
to it.
10. Repeat the above step to set the text property of other label
components available on the form.
11. Now In the Palette window, select the JTextField component from the
Swing Controls category.
12. Repeat the step to 7 to place the component on the form.
13. Again repeat the above steps to add the three more JTextField to
the form.
14. Select the TextField component by clicking on it. In the Properties
window highlight the text property and make it blank in the textbox
adjacent to it.
15. Repeat the above step to set the text property of other TextField
component components available on the form.
16. In the Palette window, select the JButton component from the Swing
Controls category.
17. Move the cursor over the Form. When the guidelines appear indicating
that the JButton is positioned in the desired location, click to place
the button. The JButton is added to the form as displayed in
18. Select the button component by clicking on it. In the Properties
window highlight the text property and type CalculateS.Intrest in the
textbox adjacent to it.
19. Repeat the step no 17 amd 18 to another button component and set
the properties of it.
20. Switch to the source window and add the single line code in the
following section of the code.
Coding:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
double Principal,Rate,SInterest;
byte Time; //Expected value not more than 127 Years
Principal=Double.parseDouble(jTextField1.getText());
Rate=Double.parseDouble(jTextField2.getText());
Time=Byte.parseByte(jTextField3.getText());
SInterest=(Principal*Rate*Time)/100; //Formula to calculate SI
jTextField4.setText(Double.toString(SInterest));
private void jButton6ActionPerformed(java.awt.event.ActionEvent
evt)
{
System.exit(0);
}
21. Press the run button or F6 file to execute the code to view the output

You might also like