SlideShare a Scribd company logo
Design a Windows Desktop application and write the code that will execute according to the
program requirements in Figure 4-108. Before designing the user interface, create a Use Case
Definition. Before writing the code, create an event-planning document for each event in the
program.
Solution
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
public class IncomeTaxCalculator extends Applet implements ActionListener,WindowListener{
private Label label,label1,label2,label3;
private JTextField txt,txt1,txt3,txt4;
private JButton btn1,btn2;
public void init(){
Frame f=new Frame();
Frame f1=new Frame();
f.setLayout(new BorderLayout());
f.setSize(1000, 300);
Panel p=new Panel();
Panel pc1=new Panel();
f.add(pc1,"South");
f.add(p,"North");
label=new Label("Enter Income :");
label1=new Label("Tax To Be Paid :");
label2=new Label("Cess");
label3=new Label("Income Tax");
txt1=new JTextField(10);
txt3=new JTextField(10);
txt4=new JTextField(10);
txt=new JTextField(10);
p.add(label);
p.add(txt);
p.add(label3);
p.add(txt4);
p.add(label2);
p.add(txt3);
p.add(label1);
p.add(txt1);
btn1= new JButton("SUBMIT");
btn2= new JButton("EXIT");
pc1.add(btn1);
pc1.add(btn2);
f.setVisible(true);
btn1.addActionListener(this);
btn2.addActionListener(this);
}
public static void main(String args[]){
new IncomeTaxCalculator().init();
}
@Override
public void actionPerformed(ActionEvent e) {
JButton btn=(JButton)e.getSource();
if(btn==btn1){
double a=Integer.parseInt(txt.getText());
double tax=0,b=0;
if(a>0 && a<=160000){
txt1.setText("0");
txt4.setText("0");
txt3.setText("0");
}else if(a>160000 && a<=300000){
a=a-160000;
tax=0.1*a;
txt4.setText(String.valueOf(tax));
txt3.setText(String.valueOf(tax*.03));
tax+=tax*.03;
txt1.setText(String.valueOf(tax));
}else if(a>300000 && a<=500000){
a=a-300000;
tax=0.2*a+14000;
txt4.setText(String.valueOf(tax));
txt3.setText(String.valueOf(tax*.03));
tax+=tax*.03;
txt1.setText(String.valueOf(tax));
}else if(a>500000){
a=a-500000;
tax=0.3*a+54000;
txt4.setText(String.valueOf(tax));
txt3.setText(String.valueOf(tax*.03));
tax+=tax*.03;
txt1.setText(String.valueOf(tax));
}
}else if(btn==btn2){
System.exit(0);
}
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowOpened(WindowEvent e) {
}
}

More Related Content

More from Footageetoffe16 (20)

Why did the defendants fight jurisdiction in the United States in th.pdf
Why did the defendants fight jurisdiction in the United States in th.pdfWhy did the defendants fight jurisdiction in the United States in th.pdf
Why did the defendants fight jurisdiction in the United States in th.pdf
Footageetoffe16
 
Why was the frontier important in American historySolutionFro.pdf
Why was the frontier important in American historySolutionFro.pdfWhy was the frontier important in American historySolutionFro.pdf
Why was the frontier important in American historySolutionFro.pdf
Footageetoffe16
 
What is the multiplication principle Also, provide example.Solu.pdf
What is the multiplication principle Also, provide example.Solu.pdfWhat is the multiplication principle Also, provide example.Solu.pdf
What is the multiplication principle Also, provide example.Solu.pdf
Footageetoffe16
 
What were the three primary goals of the FASB in developing the Codi.pdf
What were the three primary goals of the FASB in developing the Codi.pdfWhat were the three primary goals of the FASB in developing the Codi.pdf
What were the three primary goals of the FASB in developing the Codi.pdf
Footageetoffe16
 
What is the difference between public relations and public affairs.pdf
What is the difference between public relations and public affairs.pdfWhat is the difference between public relations and public affairs.pdf
What is the difference between public relations and public affairs.pdf
Footageetoffe16
 
What is Network Chatter and how does it affect performanceSolut.pdf
What is Network Chatter and how does it affect performanceSolut.pdfWhat is Network Chatter and how does it affect performanceSolut.pdf
What is Network Chatter and how does it affect performanceSolut.pdf
Footageetoffe16
 
What are the elements types to add video and audio and give some att.pdf
What are the elements types to add video and audio and give some att.pdfWhat are the elements types to add video and audio and give some att.pdf
What are the elements types to add video and audio and give some att.pdf
Footageetoffe16
 
What are the types of nonverbal communication used by President John.pdf
What are the types of nonverbal communication used by President John.pdfWhat are the types of nonverbal communication used by President John.pdf
What are the types of nonverbal communication used by President John.pdf
Footageetoffe16
 
The owner of a small business is planning on expanding his business. .pdf
The owner of a small business is planning on expanding his business. .pdfThe owner of a small business is planning on expanding his business. .pdf
The owner of a small business is planning on expanding his business. .pdf
Footageetoffe16
 
The government safety net creates an adverse selection problem and m.pdf
The government safety net creates an adverse selection problem and m.pdfThe government safety net creates an adverse selection problem and m.pdf
The government safety net creates an adverse selection problem and m.pdf
Footageetoffe16
 
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdfSyntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Footageetoffe16
 
scene from American Samoa Paradise Lost •How does power, both form.pdf
scene from American Samoa Paradise Lost •How does power, both form.pdfscene from American Samoa Paradise Lost •How does power, both form.pdf
scene from American Samoa Paradise Lost •How does power, both form.pdf
Footageetoffe16
 
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdfQUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
Footageetoffe16
 
Problems2. This is a map for a diploid plantR--------35-------.pdf
Problems2. This is a map for a diploid plantR--------35-------.pdfProblems2. This is a map for a diploid plantR--------35-------.pdf
Problems2. This is a map for a diploid plantR--------35-------.pdf
Footageetoffe16
 
Prompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdfPrompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdf
Footageetoffe16
 
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdfPLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
Footageetoffe16
 
List the limitations of the GDP. Which one is most importantSol.pdf
List the limitations of the GDP. Which one is most importantSol.pdfList the limitations of the GDP. Which one is most importantSol.pdf
List the limitations of the GDP. Which one is most importantSol.pdf
Footageetoffe16
 
Information is given about a polynomial f(x) whose coefficients are r.pdf
Information is given about a polynomial f(x) whose coefficients are r.pdfInformation is given about a polynomial f(x) whose coefficients are r.pdf
Information is given about a polynomial f(x) whose coefficients are r.pdf
Footageetoffe16
 
I need to create two binary search trees in Ruby. One using recursio.pdf
I need to create two binary search trees in Ruby. One using recursio.pdfI need to create two binary search trees in Ruby. One using recursio.pdf
I need to create two binary search trees in Ruby. One using recursio.pdf
Footageetoffe16
 
I am studying gut flora and had a few questions.Can you discribe a.pdf
I am studying gut flora and had a few questions.Can you discribe a.pdfI am studying gut flora and had a few questions.Can you discribe a.pdf
I am studying gut flora and had a few questions.Can you discribe a.pdf
Footageetoffe16
 
Why did the defendants fight jurisdiction in the United States in th.pdf
Why did the defendants fight jurisdiction in the United States in th.pdfWhy did the defendants fight jurisdiction in the United States in th.pdf
Why did the defendants fight jurisdiction in the United States in th.pdf
Footageetoffe16
 
Why was the frontier important in American historySolutionFro.pdf
Why was the frontier important in American historySolutionFro.pdfWhy was the frontier important in American historySolutionFro.pdf
Why was the frontier important in American historySolutionFro.pdf
Footageetoffe16
 
What is the multiplication principle Also, provide example.Solu.pdf
What is the multiplication principle Also, provide example.Solu.pdfWhat is the multiplication principle Also, provide example.Solu.pdf
What is the multiplication principle Also, provide example.Solu.pdf
Footageetoffe16
 
What were the three primary goals of the FASB in developing the Codi.pdf
What were the three primary goals of the FASB in developing the Codi.pdfWhat were the three primary goals of the FASB in developing the Codi.pdf
What were the three primary goals of the FASB in developing the Codi.pdf
Footageetoffe16
 
What is the difference between public relations and public affairs.pdf
What is the difference between public relations and public affairs.pdfWhat is the difference between public relations and public affairs.pdf
What is the difference between public relations and public affairs.pdf
Footageetoffe16
 
What is Network Chatter and how does it affect performanceSolut.pdf
What is Network Chatter and how does it affect performanceSolut.pdfWhat is Network Chatter and how does it affect performanceSolut.pdf
What is Network Chatter and how does it affect performanceSolut.pdf
Footageetoffe16
 
What are the elements types to add video and audio and give some att.pdf
What are the elements types to add video and audio and give some att.pdfWhat are the elements types to add video and audio and give some att.pdf
What are the elements types to add video and audio and give some att.pdf
Footageetoffe16
 
What are the types of nonverbal communication used by President John.pdf
What are the types of nonverbal communication used by President John.pdfWhat are the types of nonverbal communication used by President John.pdf
What are the types of nonverbal communication used by President John.pdf
Footageetoffe16
 
The owner of a small business is planning on expanding his business. .pdf
The owner of a small business is planning on expanding his business. .pdfThe owner of a small business is planning on expanding his business. .pdf
The owner of a small business is planning on expanding his business. .pdf
Footageetoffe16
 
The government safety net creates an adverse selection problem and m.pdf
The government safety net creates an adverse selection problem and m.pdfThe government safety net creates an adverse selection problem and m.pdf
The government safety net creates an adverse selection problem and m.pdf
Footageetoffe16
 
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdfSyntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Syntrophy often involvesA. hydrogenB.OxygenC. fermentation by.pdf
Footageetoffe16
 
scene from American Samoa Paradise Lost •How does power, both form.pdf
scene from American Samoa Paradise Lost •How does power, both form.pdfscene from American Samoa Paradise Lost •How does power, both form.pdf
scene from American Samoa Paradise Lost •How does power, both form.pdf
Footageetoffe16
 
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdfQUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
QUESTION 25 Chris Korda, an advocate of a certain religion, publishes.pdf
Footageetoffe16
 
Problems2. This is a map for a diploid plantR--------35-------.pdf
Problems2. This is a map for a diploid plantR--------35-------.pdfProblems2. This is a map for a diploid plantR--------35-------.pdf
Problems2. This is a map for a diploid plantR--------35-------.pdf
Footageetoffe16
 
Prompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdfPrompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdf
Footageetoffe16
 
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdfPLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
Footageetoffe16
 
List the limitations of the GDP. Which one is most importantSol.pdf
List the limitations of the GDP. Which one is most importantSol.pdfList the limitations of the GDP. Which one is most importantSol.pdf
List the limitations of the GDP. Which one is most importantSol.pdf
Footageetoffe16
 
Information is given about a polynomial f(x) whose coefficients are r.pdf
Information is given about a polynomial f(x) whose coefficients are r.pdfInformation is given about a polynomial f(x) whose coefficients are r.pdf
Information is given about a polynomial f(x) whose coefficients are r.pdf
Footageetoffe16
 
I need to create two binary search trees in Ruby. One using recursio.pdf
I need to create two binary search trees in Ruby. One using recursio.pdfI need to create two binary search trees in Ruby. One using recursio.pdf
I need to create two binary search trees in Ruby. One using recursio.pdf
Footageetoffe16
 
I am studying gut flora and had a few questions.Can you discribe a.pdf
I am studying gut flora and had a few questions.Can you discribe a.pdfI am studying gut flora and had a few questions.Can you discribe a.pdf
I am studying gut flora and had a few questions.Can you discribe a.pdf
Footageetoffe16
 

Recently uploaded (20)

Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
A Brief Introduction About Jack Lutkus
A Brief Introduction About  Jack  LutkusA Brief Introduction About  Jack  Lutkus
A Brief Introduction About Jack Lutkus
Jack Lutkus
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
A Brief Introduction About Jack Lutkus
A Brief Introduction About  Jack  LutkusA Brief Introduction About  Jack  Lutkus
A Brief Introduction About Jack Lutkus
Jack Lutkus
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
Ad

Design a Windows Desktop application and write the code that will exe.pdf

  • 1. Design a Windows Desktop application and write the code that will execute according to the program requirements in Figure 4-108. Before designing the user interface, create a Use Case Definition. Before writing the code, create an event-planning document for each event in the program. Solution import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.applet.*; public class IncomeTaxCalculator extends Applet implements ActionListener,WindowListener{ private Label label,label1,label2,label3; private JTextField txt,txt1,txt3,txt4; private JButton btn1,btn2; public void init(){ Frame f=new Frame(); Frame f1=new Frame(); f.setLayout(new BorderLayout()); f.setSize(1000, 300); Panel p=new Panel(); Panel pc1=new Panel(); f.add(pc1,"South"); f.add(p,"North"); label=new Label("Enter Income :"); label1=new Label("Tax To Be Paid :"); label2=new Label("Cess"); label3=new Label("Income Tax"); txt1=new JTextField(10); txt3=new JTextField(10); txt4=new JTextField(10); txt=new JTextField(10); p.add(label); p.add(txt); p.add(label3);
  • 2. p.add(txt4); p.add(label2); p.add(txt3); p.add(label1); p.add(txt1); btn1= new JButton("SUBMIT"); btn2= new JButton("EXIT"); pc1.add(btn1); pc1.add(btn2); f.setVisible(true); btn1.addActionListener(this); btn2.addActionListener(this); } public static void main(String args[]){ new IncomeTaxCalculator().init(); } @Override public void actionPerformed(ActionEvent e) { JButton btn=(JButton)e.getSource(); if(btn==btn1){ double a=Integer.parseInt(txt.getText()); double tax=0,b=0; if(a>0 && a<=160000){ txt1.setText("0"); txt4.setText("0"); txt3.setText("0"); }else if(a>160000 && a<=300000){ a=a-160000; tax=0.1*a; txt4.setText(String.valueOf(tax)); txt3.setText(String.valueOf(tax*.03)); tax+=tax*.03; txt1.setText(String.valueOf(tax));
  • 3. }else if(a>300000 && a<=500000){ a=a-300000; tax=0.2*a+14000; txt4.setText(String.valueOf(tax)); txt3.setText(String.valueOf(tax*.03)); tax+=tax*.03; txt1.setText(String.valueOf(tax)); }else if(a>500000){ a=a-500000; tax=0.3*a+54000; txt4.setText(String.valueOf(tax)); txt3.setText(String.valueOf(tax*.03)); tax+=tax*.03; txt1.setText(String.valueOf(tax)); } }else if(btn==btn2){ System.exit(0); } } @Override public void windowActivated(WindowEvent e) { } @Override public void windowClosed(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } @Override
  • 4. public void windowDeiconified(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowOpened(WindowEvent e) { } }