I am working on some assignment. I read the book, and did exactly as it said, but it came up some weird error I don't know how to fix. Please edit my problem, so I can continue my work. Thank you.

import java.io.*;
public class Assignment4
{
	public static void main(String[]args) throws IOException
	{
		//delcare and construct variables
		int status, marStatus, earn, excess, tax, total, count, gross;
		double average;
		BufferedReader dataIn= new BufferedReader(new InputStreamReader(System.in));

		//print prompts and get input
		System.out.print("Enter your status 1)Single, or 2)Married ");
		marStatus = dataIn.readLine();
		status = Integer.parseInt(marStatus);

		System.out.print("Enter your weekly gross pay ");
		gross = dataIn.readLine();
		earn = Integer.parseInt(gross);


		     	if (status==1)
		     	{
		     	if (earn <= 116)
		     		{
		            System.out.println("Excess Earning" + (earn-116));
		            //System.out.println("Tax Withholding" + (excess * .10));
		        	}
		        /*else if (Earn>=116 && Earn<=200)
		        	{
		            System.out.println("Excess Earning" + earnsingle - 116 = excess);
		            System.out.println("Tax Withholding" + excess * .10 = tax);
		        	}
		        else if (Earn>=116 && Earn<=200)
					{
					System.out.println("Excess Earning" + earnsingle - 116 = excess);
					System.out.println("Tax Withholding" + excess * .10 = tax);
		        	}
		        else if (Earn>=116 && Earn<=200)
					{
					System.out.println("Excess Earning" + earnsingle - 116 = excess);
					System.out.println("Tax Withholding" + excess * .10 = tax);
		        	}
				}*/
		        else
		        {
		            System.out.println("Grade = " + earn);
		        }
			}






		//calculations
		//average = (double) total/count;

		//output
		//System.out.println("The average is " + average);
}
}

Recommended Answers

All 2 Replies

marStatus =Integer.parseInt(dataIn.readLine());
		status = marStatus;

		System.out.print("Enter your weekly gross pay ");
		gross = Integer.parseInt(dataIn.readLine());
		earn =gross;

or simply as standard

status =Integer.parseInt(dataIn.readLine());
earn = Integer.parseInt(dataIn.readLine());

Thank you very much. It fix my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.