SlideShare a Scribd company logo
1 of 3
Download to read offline
//Tested on Eclipse
/****************Equivalence.java*************/
package chegg;
import java.util.Scanner;
public class Equivalence {
/*Income tax calculation method*/
public void calculateTax(double income){
double tax=0;
/*Based on provided data in question*/
if(income<10){
tax=tax+0;
}else if(income>=10 && income<20){
tax=tax+(income*10)/100;
}else if(income>=20 && income<40){
/*add 10 % of 10k means 1k needs to be added in tax*/
tax=tax+1+((income-20)*12)/100;
}else if(income>=40 && income<80){
/*add 10 % of 10k means 1k and 12% of 20k needs to be added in tax*/
tax=tax+1+2.4+((income-40)*15)/100;
}else if(income>=80){
/*add 10 % of 10k means 1k and 12% of 20k and 15 % of 40k needs to be added in tax*/
tax=tax+1+2.4+6+((income-80)*20)/100;
}
System.out.println("Total Tax is: $"+tax+"K");
}
/*Main method start*/
public static void main(String args[]){
/*Variable declaration*/
double income;
Scanner input=new Scanner(System.in);
/*Class object creation*/
Equivalence equivalence=new Equivalence();
/*Prompt for income*/
System.out.println("Please Enter the income");
income=input.nextDouble();
/*calling calculateTax method*/
equivalence.calculateTax(income);
}
}
/************output***********/
Please Enter the income
25
Total Tax is: $1.6K
Solution
//Tested on Eclipse
/****************Equivalence.java*************/
package chegg;
import java.util.Scanner;
public class Equivalence {
/*Income tax calculation method*/
public void calculateTax(double income){
double tax=0;
/*Based on provided data in question*/
if(income<10){
tax=tax+0;
}else if(income>=10 && income<20){
tax=tax+(income*10)/100;
}else if(income>=20 && income<40){
/*add 10 % of 10k means 1k needs to be added in tax*/
tax=tax+1+((income-20)*12)/100;
}else if(income>=40 && income<80){
/*add 10 % of 10k means 1k and 12% of 20k needs to be added in tax*/
tax=tax+1+2.4+((income-40)*15)/100;
}else if(income>=80){
/*add 10 % of 10k means 1k and 12% of 20k and 15 % of 40k needs to be added in tax*/
tax=tax+1+2.4+6+((income-80)*20)/100;
}
System.out.println("Total Tax is: $"+tax+"K");
}
/*Main method start*/
public static void main(String args[]){
/*Variable declaration*/
double income;
Scanner input=new Scanner(System.in);
/*Class object creation*/
Equivalence equivalence=new Equivalence();
/*Prompt for income*/
System.out.println("Please Enter the income");
income=input.nextDouble();
/*calling calculateTax method*/
equivalence.calculateTax(income);
}
}
/************output***********/
Please Enter the income
25
Total Tax is: $1.6K

More Related Content

More from anupamele

True, they are identical Thats just the bottom vi.pdf
                     True, they are identical Thats just the bottom vi.pdf                     True, they are identical Thats just the bottom vi.pdf
True, they are identical Thats just the bottom vi.pdfanupamele
 
The NH2OH is in acidic solution as a reactant and.pdf
                     The NH2OH is in acidic solution as a reactant and.pdf                     The NH2OH is in acidic solution as a reactant and.pdf
The NH2OH is in acidic solution as a reactant and.pdfanupamele
 
The atom is a basic unit of matter consisting of .pdf
                     The atom is a basic unit of matter consisting of .pdf                     The atom is a basic unit of matter consisting of .pdf
The atom is a basic unit of matter consisting of .pdfanupamele
 
see the inner one is union of events from 1-inf. .pdf
                     see the inner one is union of events from 1-inf. .pdf                     see the inner one is union of events from 1-inf. .pdf
see the inner one is union of events from 1-inf. .pdfanupamele
 
No you wouldnt include the intermediates in the.pdf
                     No you wouldnt include the intermediates in the.pdf                     No you wouldnt include the intermediates in the.pdf
No you wouldnt include the intermediates in the.pdfanupamele
 
mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf
                     mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf                     mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf
mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdfanupamele
 
millimoles of HBr=500.04=2 millimoles of KOH=25.pdf
                     millimoles of HBr=500.04=2 millimoles of KOH=25.pdf                     millimoles of HBr=500.04=2 millimoles of KOH=25.pdf
millimoles of HBr=500.04=2 millimoles of KOH=25.pdfanupamele
 
initially 2 moles of HCl per L of water suppose x.pdf
                     initially 2 moles of HCl per L of water suppose x.pdf                     initially 2 moles of HCl per L of water suppose x.pdf
initially 2 moles of HCl per L of water suppose x.pdfanupamele
 
i cant see the question.. please post the complet.pdf
                     i cant see the question.. please post the complet.pdf                     i cant see the question.. please post the complet.pdf
i cant see the question.. please post the complet.pdfanupamele
 
hey pls give the reactions.... .pdf
                     hey pls give the reactions....                   .pdf                     hey pls give the reactions....                   .pdf
hey pls give the reactions.... .pdfanupamele
 
FT-Raman spectra of some calcium phosphates, calc.pdf
                     FT-Raman spectra of some calcium phosphates, calc.pdf                     FT-Raman spectra of some calcium phosphates, calc.pdf
FT-Raman spectra of some calcium phosphates, calc.pdfanupamele
 
H is oxidised here no O2 is not oxidised as it g.pdf
                     H is oxidised here  no O2 is not oxidised as it g.pdf                     H is oxidised here  no O2 is not oxidised as it g.pdf
H is oxidised here no O2 is not oxidised as it g.pdfanupamele
 
Current Stock price = Expected dividend (Required rate of return -.pdf
Current Stock price = Expected dividend  (Required rate of return -.pdfCurrent Stock price = Expected dividend  (Required rate of return -.pdf
Current Stock price = Expected dividend (Required rate of return -.pdfanupamele
 
YES the news stories in the Illustrated American sympathetic or non-.pdf
YES the news stories in the Illustrated American sympathetic or non-.pdfYES the news stories in the Illustrated American sympathetic or non-.pdf
YES the news stories in the Illustrated American sympathetic or non-.pdfanupamele
 
Well its quite an easy one. The given curve is a cardioid. The limit.pdf
Well its quite an easy one. The given curve is a cardioid. The limit.pdfWell its quite an easy one. The given curve is a cardioid. The limit.pdf
Well its quite an easy one. The given curve is a cardioid. The limit.pdfanupamele
 
Total ionic Equation is 2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdf
Total ionic Equation is  2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdfTotal ionic Equation is  2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdf
Total ionic Equation is 2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdfanupamele
 
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdf
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdfAnswerSOCS are the supressor of cytokine signaling proteins and a.pdf
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdfanupamele
 
The pre-mRNA is converted into mature mRNA by modifications known as.pdf
The pre-mRNA is converted into mature mRNA by modifications known as.pdfThe pre-mRNA is converted into mature mRNA by modifications known as.pdf
The pre-mRNA is converted into mature mRNA by modifications known as.pdfanupamele
 
CH3CH2OH will have high boiling point becauseof t.pdf
                     CH3CH2OH will have high boiling point becauseof t.pdf                     CH3CH2OH will have high boiling point becauseof t.pdf
CH3CH2OH will have high boiling point becauseof t.pdfanupamele
 
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdf
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdfSO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdf
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdfanupamele
 

More from anupamele (20)

True, they are identical Thats just the bottom vi.pdf
                     True, they are identical Thats just the bottom vi.pdf                     True, they are identical Thats just the bottom vi.pdf
True, they are identical Thats just the bottom vi.pdf
 
The NH2OH is in acidic solution as a reactant and.pdf
                     The NH2OH is in acidic solution as a reactant and.pdf                     The NH2OH is in acidic solution as a reactant and.pdf
The NH2OH is in acidic solution as a reactant and.pdf
 
The atom is a basic unit of matter consisting of .pdf
                     The atom is a basic unit of matter consisting of .pdf                     The atom is a basic unit of matter consisting of .pdf
The atom is a basic unit of matter consisting of .pdf
 
see the inner one is union of events from 1-inf. .pdf
                     see the inner one is union of events from 1-inf. .pdf                     see the inner one is union of events from 1-inf. .pdf
see the inner one is union of events from 1-inf. .pdf
 
No you wouldnt include the intermediates in the.pdf
                     No you wouldnt include the intermediates in the.pdf                     No you wouldnt include the intermediates in the.pdf
No you wouldnt include the intermediates in the.pdf
 
mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf
                     mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf                     mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf
mole of NaOH= 1240 =0.3 so molarity = 0.31.8 = .pdf
 
millimoles of HBr=500.04=2 millimoles of KOH=25.pdf
                     millimoles of HBr=500.04=2 millimoles of KOH=25.pdf                     millimoles of HBr=500.04=2 millimoles of KOH=25.pdf
millimoles of HBr=500.04=2 millimoles of KOH=25.pdf
 
initially 2 moles of HCl per L of water suppose x.pdf
                     initially 2 moles of HCl per L of water suppose x.pdf                     initially 2 moles of HCl per L of water suppose x.pdf
initially 2 moles of HCl per L of water suppose x.pdf
 
i cant see the question.. please post the complet.pdf
                     i cant see the question.. please post the complet.pdf                     i cant see the question.. please post the complet.pdf
i cant see the question.. please post the complet.pdf
 
hey pls give the reactions.... .pdf
                     hey pls give the reactions....                   .pdf                     hey pls give the reactions....                   .pdf
hey pls give the reactions.... .pdf
 
FT-Raman spectra of some calcium phosphates, calc.pdf
                     FT-Raman spectra of some calcium phosphates, calc.pdf                     FT-Raman spectra of some calcium phosphates, calc.pdf
FT-Raman spectra of some calcium phosphates, calc.pdf
 
H is oxidised here no O2 is not oxidised as it g.pdf
                     H is oxidised here  no O2 is not oxidised as it g.pdf                     H is oxidised here  no O2 is not oxidised as it g.pdf
H is oxidised here no O2 is not oxidised as it g.pdf
 
Current Stock price = Expected dividend (Required rate of return -.pdf
Current Stock price = Expected dividend  (Required rate of return -.pdfCurrent Stock price = Expected dividend  (Required rate of return -.pdf
Current Stock price = Expected dividend (Required rate of return -.pdf
 
YES the news stories in the Illustrated American sympathetic or non-.pdf
YES the news stories in the Illustrated American sympathetic or non-.pdfYES the news stories in the Illustrated American sympathetic or non-.pdf
YES the news stories in the Illustrated American sympathetic or non-.pdf
 
Well its quite an easy one. The given curve is a cardioid. The limit.pdf
Well its quite an easy one. The given curve is a cardioid. The limit.pdfWell its quite an easy one. The given curve is a cardioid. The limit.pdf
Well its quite an easy one. The given curve is a cardioid. The limit.pdf
 
Total ionic Equation is 2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdf
Total ionic Equation is  2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdfTotal ionic Equation is  2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdf
Total ionic Equation is 2Cu2+ +4 Cl - + 4H+ +SO42- --- Cu2SiO4+ 4.pdf
 
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdf
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdfAnswerSOCS are the supressor of cytokine signaling proteins and a.pdf
AnswerSOCS are the supressor of cytokine signaling proteins and a.pdf
 
The pre-mRNA is converted into mature mRNA by modifications known as.pdf
The pre-mRNA is converted into mature mRNA by modifications known as.pdfThe pre-mRNA is converted into mature mRNA by modifications known as.pdf
The pre-mRNA is converted into mature mRNA by modifications known as.pdf
 
CH3CH2OH will have high boiling point becauseof t.pdf
                     CH3CH2OH will have high boiling point becauseof t.pdf                     CH3CH2OH will have high boiling point becauseof t.pdf
CH3CH2OH will have high boiling point becauseof t.pdf
 
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdf
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdfSO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdf
SO4 would have isolated (unlinked) tetrahedra that are all oxygen an.pdf
 

Recently uploaded

TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 

Tested on EclipseEquivalence.java.pdf

  • 1. //Tested on Eclipse /****************Equivalence.java*************/ package chegg; import java.util.Scanner; public class Equivalence { /*Income tax calculation method*/ public void calculateTax(double income){ double tax=0; /*Based on provided data in question*/ if(income<10){ tax=tax+0; }else if(income>=10 && income<20){ tax=tax+(income*10)/100; }else if(income>=20 && income<40){ /*add 10 % of 10k means 1k needs to be added in tax*/ tax=tax+1+((income-20)*12)/100; }else if(income>=40 && income<80){ /*add 10 % of 10k means 1k and 12% of 20k needs to be added in tax*/ tax=tax+1+2.4+((income-40)*15)/100; }else if(income>=80){ /*add 10 % of 10k means 1k and 12% of 20k and 15 % of 40k needs to be added in tax*/ tax=tax+1+2.4+6+((income-80)*20)/100; } System.out.println("Total Tax is: $"+tax+"K"); } /*Main method start*/ public static void main(String args[]){ /*Variable declaration*/ double income; Scanner input=new Scanner(System.in); /*Class object creation*/ Equivalence equivalence=new Equivalence(); /*Prompt for income*/ System.out.println("Please Enter the income"); income=input.nextDouble();
  • 2. /*calling calculateTax method*/ equivalence.calculateTax(income); } } /************output***********/ Please Enter the income 25 Total Tax is: $1.6K Solution //Tested on Eclipse /****************Equivalence.java*************/ package chegg; import java.util.Scanner; public class Equivalence { /*Income tax calculation method*/ public void calculateTax(double income){ double tax=0; /*Based on provided data in question*/ if(income<10){ tax=tax+0; }else if(income>=10 && income<20){ tax=tax+(income*10)/100; }else if(income>=20 && income<40){ /*add 10 % of 10k means 1k needs to be added in tax*/ tax=tax+1+((income-20)*12)/100; }else if(income>=40 && income<80){ /*add 10 % of 10k means 1k and 12% of 20k needs to be added in tax*/ tax=tax+1+2.4+((income-40)*15)/100; }else if(income>=80){ /*add 10 % of 10k means 1k and 12% of 20k and 15 % of 40k needs to be added in tax*/ tax=tax+1+2.4+6+((income-80)*20)/100; } System.out.println("Total Tax is: $"+tax+"K");
  • 3. } /*Main method start*/ public static void main(String args[]){ /*Variable declaration*/ double income; Scanner input=new Scanner(System.in); /*Class object creation*/ Equivalence equivalence=new Equivalence(); /*Prompt for income*/ System.out.println("Please Enter the income"); income=input.nextDouble(); /*calling calculateTax method*/ equivalence.calculateTax(income); } } /************output***********/ Please Enter the income 25 Total Tax is: $1.6K