1. Basic Java class
class Ex1
{
public static void main(String args[])
{
int width;
int length;
int height;
width=5;
length=12;
height=3;
int v;
v=width*length*height;
System.out.println("Volume is :"+v);
}
}
Volume is :180
1. Basic Java class
class Ex1
{
public static void main(String args[])
{
int width;
int length;
int height;
width=5;
length=12;
height=3;
int v;
v=width*length*height;
System.out.println("Volume is :"+v);
}
}
Volume is :180
program list:
WAP program to show constructor overloading using static member.
WAP to implement multilevel inheritance and method overriding.
WAP to implement interface class and show use of package.
WAP to implement multilevel exception handling and create your own exception.
WAP to implement 3 threads such that 1st sleeps for 200ms, 2nd for 400ms and 3rd for 600ms.
WAP to create applet of moving banner.
WAP to make a simple calculator.
Build a client server chat application.
Use C++ to Manipulate mozSettings in GeckoChih-Hsuan Kuo
If you want to manipulate mozSettings with JavaScript, you can reference to Settings API on MDN (https://developer.mozilla.org/en-US/docs/Web/API/Settings_API).
But if you want to manipulate it with C++, we can only reference to the codebase of Gecko. Now, let me show you some example.
OOP and FP - Become a Better ProgrammerMario Fusco
The story of Simon, an experienced OOP Java developer, exposed to the new lambda features of JDK 8. His friend Mario, a long-bearded FP geek, will try to convince him that FP can help him develop more readable and maintainable code. A journey into the discovery of the main new feature - lambda expressions - of JDK 8
Sunnahs of Prophet Mohammed SAW.
Includes:
Chapter 1. The Noble Features of Rasoolullah.
Chapter 2. Seal of Nubuwwah (Prophethood) Of Rasoolullah.
Chapter 3. The Mubarak Hair of Rasulullah.
Chapter 4. The Combing Of the Hair of Rasulullah.
Chapter 5. Appearing Of the White Hair of Rasulullah.
Chapter 6. Rasulullah Using a Dye.
Chapter 7. The Kuhl of Rasulullah.
Chapter 8. The Dressing of Rasulullah.
Chapter 9. The Khuff (Leather Socks) Of Rasoolullah.
Chapter 010, Hadith Number 003 (073).
Chapter 10. The Shoes Of Rasulullah.
Chapter 11. The Mubaarak Ring Of Rasulullah.
Chapter 12. Stating That Rasulullah Wore The Ring On His Right Hand.
Chapter 13. The Sword Of Rasulullah.
Chapter 14. The Armor Of Rasulullah.
Chapter 15. The Helmet Of Rasulullah.
Chapter 16. The Turban Of Rasulullah.
Chapter 17. The Lungi Of Rasulullah.
Chapter 18. The Walking Of Rasulullah.
Chapter 19. The Qinaa Of Rasulullah.
Chapter 20. The Sitting Of Rasulullah.
Chapter 21. The Pillow Of Rasulullah.
Chapter 22. Rasulullah Leaning On Something Other Than A Pillow.
Chapter 23. Description Of The Eating Of Rasulullah.
Chapter 24. The Bread Of Rasulullah.
Chapter 25. Description Of The Curry Of Rasulullah.
Chapter 26. Rasulullah Performing Wudu At The Time Of Eating.
Chapter 27. The Words That Of Rasulullah Said Before And After Eating.
Chapter 27. The Words That Of Rasulullah Said Before And After Eating.
Chapter 28. The Cup Of Rasulullah.
Chapter 29. The Fruits Eaten By Rasulullah.
Chapter 30. Description Of The Things Rasulullah Drank.
Chapter 31. Hadith Describing The Manner Rasulullah Drank.
Chapter 32. Rasulullah Using 'Itr.
Chapter 33. The Speech Of Rasulullah.
Chapter 34. The Laughing Of Rasulullah.
Chapter 35. Description Of The Joking Of Rasulullah.
Chapter 36. Description Of The Saying Of Rasulullah On Poetry.
Chapter 37. Story Telling Of Rasulullah At Night.
Chapter 38. The Sleeping Of Rasulullah.
Chapter 39. Worship And Devotion Of Rasulullah.
Chapter 40. Salaatut Duha (Chaast Prayers).
Chapter 41. Sayyidina Rasulullah Performing Nawaafil At Home.
Chapter 42. The Fasting Of Sayyidina Rasulullah.
Chapter 43. The Recital Of Sayyidina Rasulullah.
Chapter 44. The Weeping Of Sayyidina Rasulullah.
Chapter 45. Narrations Of The Bed Of Sayyidina Rasulullah.
Chapter 46. The Humbleness Of Sayyidina Rasulullah.
Chapter 47. Noble Character And Habits Of Sayyidina Rasulullah.
Chapter 48. Modesty Of Sayyidina Rasulullah.
Chapter 49. Hajaamah (Cupping-Cautering) Of Sayyidina Rasulullah.
Chapter 50. The Living Of Sayyidina Rasulullah.
Chapter 51. The Names Of Sayyidina Rasulullah.
Chapter 52. The Noble Age Of Sayyidina Rasulullah.
Chapter 53. The Death Of Sayyidina Rasulullah.
Chapter 54. The Legacy Of Sayyidina Rasulullah.
Chapter 55. The Seeing Of Sayyidina Rasulullah In A Dream.
program list:
WAP program to show constructor overloading using static member.
WAP to implement multilevel inheritance and method overriding.
WAP to implement interface class and show use of package.
WAP to implement multilevel exception handling and create your own exception.
WAP to implement 3 threads such that 1st sleeps for 200ms, 2nd for 400ms and 3rd for 600ms.
WAP to create applet of moving banner.
WAP to make a simple calculator.
Build a client server chat application.
Use C++ to Manipulate mozSettings in GeckoChih-Hsuan Kuo
If you want to manipulate mozSettings with JavaScript, you can reference to Settings API on MDN (https://developer.mozilla.org/en-US/docs/Web/API/Settings_API).
But if you want to manipulate it with C++, we can only reference to the codebase of Gecko. Now, let me show you some example.
OOP and FP - Become a Better ProgrammerMario Fusco
The story of Simon, an experienced OOP Java developer, exposed to the new lambda features of JDK 8. His friend Mario, a long-bearded FP geek, will try to convince him that FP can help him develop more readable and maintainable code. A journey into the discovery of the main new feature - lambda expressions - of JDK 8
Sunnahs of Prophet Mohammed SAW.
Includes:
Chapter 1. The Noble Features of Rasoolullah.
Chapter 2. Seal of Nubuwwah (Prophethood) Of Rasoolullah.
Chapter 3. The Mubarak Hair of Rasulullah.
Chapter 4. The Combing Of the Hair of Rasulullah.
Chapter 5. Appearing Of the White Hair of Rasulullah.
Chapter 6. Rasulullah Using a Dye.
Chapter 7. The Kuhl of Rasulullah.
Chapter 8. The Dressing of Rasulullah.
Chapter 9. The Khuff (Leather Socks) Of Rasoolullah.
Chapter 010, Hadith Number 003 (073).
Chapter 10. The Shoes Of Rasulullah.
Chapter 11. The Mubaarak Ring Of Rasulullah.
Chapter 12. Stating That Rasulullah Wore The Ring On His Right Hand.
Chapter 13. The Sword Of Rasulullah.
Chapter 14. The Armor Of Rasulullah.
Chapter 15. The Helmet Of Rasulullah.
Chapter 16. The Turban Of Rasulullah.
Chapter 17. The Lungi Of Rasulullah.
Chapter 18. The Walking Of Rasulullah.
Chapter 19. The Qinaa Of Rasulullah.
Chapter 20. The Sitting Of Rasulullah.
Chapter 21. The Pillow Of Rasulullah.
Chapter 22. Rasulullah Leaning On Something Other Than A Pillow.
Chapter 23. Description Of The Eating Of Rasulullah.
Chapter 24. The Bread Of Rasulullah.
Chapter 25. Description Of The Curry Of Rasulullah.
Chapter 26. Rasulullah Performing Wudu At The Time Of Eating.
Chapter 27. The Words That Of Rasulullah Said Before And After Eating.
Chapter 27. The Words That Of Rasulullah Said Before And After Eating.
Chapter 28. The Cup Of Rasulullah.
Chapter 29. The Fruits Eaten By Rasulullah.
Chapter 30. Description Of The Things Rasulullah Drank.
Chapter 31. Hadith Describing The Manner Rasulullah Drank.
Chapter 32. Rasulullah Using 'Itr.
Chapter 33. The Speech Of Rasulullah.
Chapter 34. The Laughing Of Rasulullah.
Chapter 35. Description Of The Joking Of Rasulullah.
Chapter 36. Description Of The Saying Of Rasulullah On Poetry.
Chapter 37. Story Telling Of Rasulullah At Night.
Chapter 38. The Sleeping Of Rasulullah.
Chapter 39. Worship And Devotion Of Rasulullah.
Chapter 40. Salaatut Duha (Chaast Prayers).
Chapter 41. Sayyidina Rasulullah Performing Nawaafil At Home.
Chapter 42. The Fasting Of Sayyidina Rasulullah.
Chapter 43. The Recital Of Sayyidina Rasulullah.
Chapter 44. The Weeping Of Sayyidina Rasulullah.
Chapter 45. Narrations Of The Bed Of Sayyidina Rasulullah.
Chapter 46. The Humbleness Of Sayyidina Rasulullah.
Chapter 47. Noble Character And Habits Of Sayyidina Rasulullah.
Chapter 48. Modesty Of Sayyidina Rasulullah.
Chapter 49. Hajaamah (Cupping-Cautering) Of Sayyidina Rasulullah.
Chapter 50. The Living Of Sayyidina Rasulullah.
Chapter 51. The Names Of Sayyidina Rasulullah.
Chapter 52. The Noble Age Of Sayyidina Rasulullah.
Chapter 53. The Death Of Sayyidina Rasulullah.
Chapter 54. The Legacy Of Sayyidina Rasulullah.
Chapter 55. The Seeing Of Sayyidina Rasulullah In A Dream.
Ubuntu - For Absolute Beginners.
How Ubuntu Works, What It is.
Its an awesome beginners guide for Linux Based OS Ubuntu thos who want to learn.
Good for Programmers, Better for Learners.
Theory related to OS :
It Includes:
1. Unit I (COMPONENTS OF COMPUTER SYSTEM)
2. Unit II (OPERATING SYSTEM STRUCTURE)
3. Unit III (PROCESS MANAGEMENT)
4. Unit IV (MEMORY MANAGEMENT)
5. Unit V (FILE SYSTEM)
6. Unit VI (INPUT OUTPUT SYSTEM)
Cryptography & Network Security by Atul Kahate
Author: Atul Kahate
Edition: 2nd
Summary: It includes principles of Encryption and Security, Cryptography, also various Ciphers and Steganography, RSA, DES, Kerberos, TCP/IP, VPNs, Intrusion, Spoofing and etc.
You are to simulate a dispatcher using a priority queue system in C+.pdfJUSTSTYLISH3B2MOHALI
You are to simulate a dispatcher using a priority queue system in C++. New processes are to be
entered using a GUI with priority included (numbering should be automatic). Processes are also
to be terminated by GUI command. Context switches are to be by command with the cause of the
switch being either a blocking call, time slice exceeded or termination. Assume only one CPU.
Priorities and numbers of processes can be kept small, just big enough to demonstrate the
required functionality. You may pre-populate the queues initially from a data file. I am looking
at the mechanism as you are NOT creating actual processes, just simulating them. Functionality
to be provided by you: 1. Priority based Ready Queue(s). 2. Blocked list. 3. Output of complete
system status after every context switch showing ready, blocked, and running processes.
Sample Output: A3 Antrian WAKTU TUN... TA1Telah diEksekusi Ambil No Antrian
Solution
//dispatcherSim.java
public class dispatcherSim {
public static void main(String[] args)
{
simulator sim=new simulator(1000);
sim.addProcessReady(1); //test data
sim.addProcessReady(3);
sim.addProcessReady(2);
sim.addProcessReady(7);
sim.addProcessReady(4);
sim.addProcessBlocked(1);
sim.addProcessBlocked(3);
sim.addProcessBlocked(2);
sim.addProcessBlocked(7);
sim.addProcessBlocked(4);
GUI gui=new GUI(sim);
gui.setVisible(true);
}
}
=====================================================================
=========
//GUI.java
import java.awt.BorderLayout;
import java.awt.Dialog.ModalityType;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class GUI extends JFrame {
private JPanel panel;
private JMenuBar menuBar;
private JMenu menu;
private JMenuItem addNew;
private JMenuItem unBlock;
private JMenuItem terminate;
private JMenuItem readMe;
private JMenuItem exit;
private JButton cSwitch;
private JTextArea info;
private JScrollPane scroll;
private simulator sim;
private final String CS = \"CONTEXT SWITCH: \";
private int count = 1;
public GUI(simulator disSim) {
sim = disSim;
initComponents();
}
private void addNewBox() {
final JDialog addDialog = new JDialog();
JPanel miniPanel = new JPanel(new BorderLayout());
miniPanel.setPreferredSize(new Dimension(175, 100));
ButtonGroup radioGroup = new ButtonGroup();
final JRadioButton blocked = new JRadioButton(\"Blocked List\");
final JRadioButton ready = new JRadioButton(\"Ready Queue\");
ready.setSelected(true);
radioGroup.add(ready);
radioGroup.add(blocked);
JPanel radios = new JPanel();
radios.setPreferredSize(new Dimension(50, 50));
.
Distributed systems
1.Write a program for implementing Client Server communication model.
2.Write a program to show the object communication using RMI.
3.Show the implementation of Remote Procedure Call.
4.Show the implementation of web services.
5.Write a program to execute any one mutual exclusion algorithm.
6.Write a program to implement any one election algorithm
7.Show the implementation of any one clock synchronization algorithm.
8.Write a program to implement two phase commit protocol
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
Wiktor Toporek: TypeScript bez wątpienia jest obecnie pewnym standardem wśród obecnych rozwiązań powstałych w JavaScripcie. Ale czy poza byciem dodatkiem który uzupełnia odrobinę dokumentacje i deklaruje kontrakt jakiego typu parametry przyjmują i zwracają np. funkcje jakiejś biblioteki, można wycisnąć z niego coś więcej? Podczas prezentacji wykorzystamy TypeScript do granic możliwości, używając zaawansowanych technik które sprawiają że interfejs naszego API będzie sam kierował używających go developerów na drogę poprawnego użycia, które jest zgodne z naszymi (twórców) założeniami, poprawiając tym samym ich doświadczenia.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
10. Q6. Write a program in java for Implementing RMI.
Solution: -
An applet using RMI implementing a calculator.
CODE –
CLIENT.JAVA
import java.rmi.*;
import java.rmi.registry.*;
import java.awt.*;
import java.awt.event.*;
class mathClient extends Frame implements ActionListener
{
Button B1=new Button("Sum");
Button B2=new Button("Subtract");
Button B3=new Button("Multiply");
Button B4=new Button("Divide");
Label l1=new Label("Number 1");
Label l2=new Label("Number 2");
Label l3=new Label("Result");
TextField t1=new TextField(20);
TextField t2=new TextField(20);
TextField t3=new TextField(20);
public mathClient()
{
super("Calculator");
setLayout(null);
l1.setBounds(20,50,55,25);
add(l1);
l2.setBounds(20,100,55,25);
add(l2);
l3.setBounds(20,150,55,25);
add(l3);
t1.setBounds(150,50,100,25);
add(t1);
t2.setBounds(150,100,100,25);
add(t2);
t3.setBounds(150,150,100,25);
add(t3);
B1.setBounds(20,200,80,25);
add(B1);
B2.setBounds(100,200,80,25);
add(B2);
B3.setBounds(180,200,80,25);
add(B3);
B4.setBounds(260,200,80,25);
add(B4);
B1.addActionListener(this);
B2.addActionListener(this);
B3.addActionListener(this);
B4.addActionListener(this);
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
11. );
}
public void actionPerformed(ActionEvent AE)
{
if(AE.getSource()==B1)
{s
um();
}e
lse if(AE.getSource()==B2)
{
subt();
}e
lse if(AE.getSource()==B3)
{
mult();
}e
lse if(AE.getSource()==B4)
{
div();
}
}
public void sum()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.add(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void subt()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.subt(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void mult()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.mult(i,j);
12. t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public void div()
{
int i=Integer.parseInt(t1.getText());
int j=Integer.parseInt(t2.getText());
int val;
try
{
String ServerURL="MathServ";
mathInterface MI=(mathInterface)Naming.lookup(ServerURL);
val=MI.div(i,j);
t3.setText(""+val);
}
catch(Exception ex)
{
System.out.println("Exception:"+ex);
}
}
public static void main(String args[])
{
mathClient MC=new mathClient();
MC.setVisible(true);
MC.setSize(600,500);
};
}
SERVER.JAVA
import java.rmi.*;
import java.rmi.Naming.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.net.*;
import java.util.*;
interface mathInterface extends Remote
{
public int add(int a,int b) throws RemoteException;
public int subt(int a,int b) throws RemoteException;
public int mult(int a,int b) throws RemoteException;
public int div(int a,int b) throws RemoteException;
}c
lass mathServer extends UnicastRemoteObject implements mathInterface
{
public mathServer() throws RemoteException
{
System.out.println("Initializing Server");
}p
ublic int add(int a,int b)
{
return(a+b);
}p
ublic int subt(int a,int b)
{
return(a-b);
}p
ublic int mult(int a,int b)
{
return(a*b);
}
13. public int div(int a,int b)
{
return(a/b);
}p
ublic static void main(String args[])
{
try
{
mathServer ms=new mathServer();
java.rmi.Naming.rebind("MathServ",ms);
System.out.println("Server Ready");
}c
atch(RemoteException RE)
{
System.out.println("Remote Server Error:"+ RE.getMessage());
System.exit(0);
}c
atch(MalformedURLException ME)
{
System.out.println("Invalid URL!!");
}
}
}
OUTPUT –
Q7. Write a program in java for reading a file from a designated URL.
Solution: -
I have used my drop-box account for accessing a file stored in my DROPBOX server.
CODE –
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
14. import java.net.URL;
class MainClass {
public static void main(String[] args) throws Exception {
URL u = new URL("https://dl.dropbox.com/u/94684259/Rajat.txt");
InputStream in = u.openStream();
in = new BufferedInputStream(in);
Reader r = new InputStreamReader(in);
int c;
while ((c = r.read()) != -1) {
System.out.print((char) c);
}
}
}
OUTPUT –
Q8. Write a program in java implementing File input output functions.
Solution: -
CODE –
import java.io.*;
public class CopyFile
{
private static void copyfile(String srFile, String dtFile)
{
try
{
File f1 = new File(srFile);
File f2 = new File(dtFile);
15. InputStream in = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}i
n.close();
out.close();
System.out.println("File copied.");
}c
atch(FileNotFoundException ex)
{
System.out.println(ex.getMessage() + " in the specified directory.");
System.exit(0);
}c
atch(IOException e)
{
System.out.println(e.getMessage());
}
}p
ublic static void main(String[] args)
{
switch(args.length)
{
case 0: System.out.println("File has not mentioned.");
System.exit(0);
case 1: System.out.println("Destination file has not mentioned.");
System.exit(0);
case 2: copyfile(args[0],args[1]);
System.exit(0);
default : System.out.println("Multiple files are not allow.");
System.exit(0);
}
}
}
OUTPUT –
Q9. Write a program in java implementing Java Beans.
Solution: -
Implementing a counter with JSP on a server for counting number of website views.
CODE –
COUNTERBEAN.JAVA
package form;
public class CounterBean implements java.io.Serializable
{
int coun = 0;
16. public CounterBean()
{}p
ublic int getCoun()
{
coun++;
return this.coun;
}p
ublic void setCoun(int coun)
{
this.coun = coun;
}
}
COUNTER.JSP
<%@ page language="java" %>
<jsp:useBean id="counter" scope="session" class="form.CounterBean" />
<HTML>
<HEAD><TITLE>Use Bean Counter Example</TITLE>
</HEAD>
<BODY>
<table><tr><td><b>The current count for the counter bean is: </b>
<%=counter.getCoun() %></td></tr>
</table
</BODY>
</HTML>
OUTPUT –
17. Q10. Write a program in java implementing Swings.
Solution: -
CODE –
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.html.*;
public class bar
{
final static int interval = 1000;
int i;
JLabel label;
JProgressBar pb;
Timer timer;
JButton button;
public bar()
{
JFrame frame = new JFrame("Progress Bar :: By - Rajat Suneja");
button = new JButton("Start");
button.addActionListener(new ButtonListener());
pb = new JProgressBar(0, 20);
pb.setValue(0);
pb.setStringPainted(true);
label = new JLabel("Rajat Suneja");
JPanel panel = new JPanel();
panel.add(button);
panel.add(pb);
JPanel panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1.add(panel, BorderLayout.NORTH);
panel1.add(label, BorderLayout.CENTER);
panel1.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
frame.setContentPane(panel1);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
timer = new Timer(interval, new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
if (i == 20)
{