Friday, February 24, 2012

Open Question: Help with "if" "else" statment java?




Yahoo! Answers: Search for





Open Question: Help with "if" "else" statment java?



When I compile the program it gives me an error "reached end of file while parsing", I cannot get the last } to connect to the very top {

import java.util.Scanner;

public class PA2test
{


/**
* Creates a new instance of PA2test.
*/
public PA2test()
{
}

/**
* @param args the command line arguments
*/
public static void main(String[] args)
{

double income;
double education;
double charity;
double mortgage;
double insurance;
char Y;
char N;

Scanner input = new Scanner(System.in);

if (income <= 0)
{
System.out.printf("You earned no income so you owe no taxes!"); //prompt 1
System.out.printf("Please enter your gross annual income or 0 for none: ");
}
else
{

System.out.printf("Please enter your annual tuition and expenses for higher education or 0 for none: "); //prompt 2
System.out.printf("Please enter your annual charitable contributions or 0 for none: "); //prompt 3
System.out.printf("Please enter the annual interest paid for your home mortgage or 0 for none: "); //prompt 4
System.out.printf("Did you purchase health insurance through your employer or outside the workplace? "); //prompt 5

if (Character.toUppercase (response) == "Y")
{
}
}
System.out.printf("Are you filling as a family? Enter 'Y' or 'N': "); //prompt 6

if (Character.toUppercase (response) == "Y")
{
insurance = 3500.00;
}
else
{
System.out.printf("Are you filling as single? "); //prompt 7

if (Character.toUppercase (response) == "Y")
{

healthInsTaxCr = 2000.00;

}


else
{
healthInsTaxCr = 0.00;
}
{
healthInsTaxCr = 0.00;
}

System.exit(0);
}
}






No comments:

Post a Comment