Bookmark Topic Watch Topic
  • New Topic

help please fix my codes :(  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Report post to moderator
when I type 1000 or lower it should end and if i type 1001 - 4999 it should say my salary and if I type 5000-7999 it should ask if i would like to pay for my premiums and end. and when I type higher value I should get the other response. please help me fix my codes ASAP

* To change this template, choose Tools | Templates
* and open the template in the editor.
package exer5;

import java.util.Scanner;
public class Exer5 {

public static void main(String[] args) {
Scanner Kirk = new Scanner (;
Scanner lui = new Scanner (;

String name,yes,no;
double ans=0,salary,tax=0,sss=0,ded=0,ng=0,sta;

System.out.print("Please Input Your Name: ");;
System.out.println("Welcome: " +name);
System.out.print("Please Input Your Salary: ");

if(salary>1000 && salary<=4999){
System.out.println(name +" your net income" +salary);



else if(salary>5000){
System.out.println(name +"would you like to pay for your premiums");
System.out.println("Input 1 if yes");
System.out.println("Input 2 if no");
ans = lui.nextDouble();
ans = salary - 560;
System.out.println("you're premiums is "+ans);
else if(ans==2){
System.out.println("You're net gross is"+ng);

else if(salary<8000)
sss = 350;

else if(salary>8000&&salary<10000)
sss = 400;

else if(salary>10000&&salary<12000)
sss= 450;

else if(salary>12000&&salary<15000)
sss = 500;

else if(salary>15000)
sss = 550;

System.out.println("Please choose your current marital status from the choices below:");
System.out.println("Press 1 if, Single/Married w/o dependents");
System.out.println("Press 2 if, Single w/ dependents");
System.out.println("Press 3 if, w/ dependents more than 2");



if(sta == 1){
tax = salary *.10;
System.out.println("Your tax is: "+tax);
}else if (sta == 2){
tax = salary *.07;
System.out.println("Your tax is: "+tax);
}else if (sta == 3){
tax = salary *.05;
System.out.println("Your tax is:"+tax);
System.out.println("Please Try Again!");


ded = tax + sss + 210;
System.out.println("Your deductions is: "+ded);

ng = salary - ded;
System.out.println("Your Net Income is:" +ng);
Posts: 42972
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once. Let's continue the discussion in this duplicate thread where you got answers already. If you have questions about those - just ask. Also let us know how you have changed your code in the mean time, and what specific problem you're grappling with now.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!