Professional Documents
Culture Documents
Practical File Java 2016
Practical File Java 2016
}
private void exButtonActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
Q4. Application to input a number and display its reverse (using do…while loop)
l1.setText("" + t);
}
Q6. ABN Shipment Corporation imposes charges to customers for different product. The shipment
company costs for an order in 2 forms : Wholesaler &Retailer. The cost is calculated as below :
No Units Price for wholesaler (per unit) Price for retailer (per unit)
1 – 15 Rs 50/- Rs 60
16 - 20 Rs 45/ Rs 55/
21 - 30 Rs 40/ Rs 50/
31 - 50 Rs 35/ Rs 45/
> 50 Rs 30/ Rs 40/
Coding
import javax.swing.table.*;
@SuppressWarnings("unchecked")
//user defined class
public class Rectangle {
int length;
int breadth;
/** Constructor Creates a new instance of Rectangle */
public Rectangle () {
length=0;
breadth=0;
}
int area ( int L, int B) {
length=L;
breadth=B;
return (length*breadth);
}
int perimeter (int L, int B) {
length=L;
breadth=B;
return (2*(length+breadth)); }
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int result=0;
int L= Integer.parseInt(jTextField1.getText());
int B= Integer.parseInt(jTextField2.getText());
// creates an object RecOBj for Rectangle class
Rectangle RecOBj=new Rectangle();
if (jRadioButton1.isSelected())
result=RecOBj.area(L,B);
else
if (jRadioButton2.isSelected())
result=RecOBj.perimeter(L,B);
jTextField3.setText(Integer.toString(result));
}
Q16 . To create a simple GUI application that takes input and adds a record to the above created database
<HTML>
<TABLE BORDER=2 CELLPADDING=4>
<TR> <TH COLSPAN=2 BGCOLOR="BLUE">Production</TH> </TR>
<TR> <TD>N. N. Reddy</TD> <TD>1493</TD> </TR>
<TR> <TD>S. M. Krishna</TD> <TD>3829</TD> </TR>
<TR> <TD>P. Chidamberam</TD> <TD>0283</TD> </TR>
<TR> <TH COLSPAN=2 BGCOLOR="Blue">Sales</TH> </TR>
<TR> <TD>Maria Philip</TD> <TD>4827</TD> </TR>
<TR> <TD>S. Gandhi</TD> <TD>7246</TD> </TR>
<TR> <TD>James Andrew</TD> <TD>5689</TD> </TR>
</TABLE>
<HTML>
Creating a website along with the unordered list, image & links.
<HTML>
<HEAD>
<TITLE>Wildlife</TITLE>
</HEAD>
<BODY vLink=red aLink=blue link=Maroon bgColor=SilVer>
<FONT FACE ="Times New Roman" SIZE=2 >
<H1 align=center>What is Social Networking ?</H1>
</FONT>
<FONT FACE ="Times New Roman" SIZE=4 >
<Img align="right" border = "1" width=160 height=140 src="Image1.JPG">
<P align="justify">
Social networking is the grouping of individual into specific groups,
like small rural communities or a neighbourhood subdivision, if you
will. Although social networking is possible in person, especially in
schools or in the workplace, it is most popular online.
</P>
<P align="justify">When it comes to online social networking, websites
are commonly used. These websites are known as social sites.
</P>