Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7551809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:35:38+00:00 2026-05-30T10:35:38+00:00

Sorry to be editing this once again, but rather than make another post, I

  • 0

Sorry to be editing this once again, but rather than make another post, I thought I would ask it here.

    public static void main(String[] args)
{
    // TODO code application logic here

char response = 0;
double grossAnnualIncome = 0.0;
double annualTuition = 0.0;
double annualCharity = 0.0;
double homeMortgage = 0.0;
double healthCredit = 0.0;
double annualAfterTaxes = 0.0;
double monthlyAfterTaxes = 0.0;
double taxAt17 = 0.0;
double taxableIncome = 0.0;
double ans1 = 0.0;

Scanner input = new Scanner(System.in);

System.out.printf( "Please enter your gross annual income or 0 for none: " );
grossAnnualIncome = input.nextDouble();

if( grossAnnualIncome > 0 )
    {
    System.out.printf( "Please enter your annual tuition and expenses for higher education or 0 for none: ");
    annualTuition = input.nextDouble();

 System.out.printf( "Please enter your annual charitable contributions or 0 for none: ");
    annualCharity = input.nextDouble();

    System.out.printf( "Please enter the annual interest paid for your home mortgage or 0 for none: ");
    homeMortgage = input.nextDouble();
    input.nextLine();

    System.out.printf( "Did you purchase health insurance through your employer or outside the workplace?"
              + " Enter 'Y' or 'N': ");
response = input.nextLine().charAt(0);


        if( Character.toUpperCase(response) == 'Y' )
        {
        System.out.printf( "Are you filing as a family?  Enter 'Y' or 'N': ");
        response = input.nextLine().charAt(0);

            if ( Character.toUpperCase(response) == 'Y' )
            {
            healthCredit = 3500;
            }
        else
        {

        if( Character.toUpperCase(response) == 'N' )
            {
                System.out.printf( "Are you filing as single?  Enter 'Y' or 'N': ");
                response = input.nextLine().charAt(0);
            }
                    if( Character.toUpperCase(response) == 'Y')
                    {
                    healthCredit = 2000;
                    }

        }

        }
        else
        {
        healthCredit = 0;
        }

    taxableIncome = grossAnnualIncome - homeMortgage - annualTuition - annualCharity - healthCredit;
        taxAt17 = taxableIncome * .17;
        annualAfterTaxes = grossAnnualIncome - taxAt17;
        monthlyAfterTaxes = annualAfterTaxes / 12;
        ans1 = homeMortgage + annualTuition + annualCharity + healthCredit;

    System.out.printf( "\nYOUR TAXES\n\n"
                    + "Gross Annual Income: %,.0f\n\n"
                    + "Deductions: \n"
                    + "\tHigher Education: %,.0f\n"
                    + "\tCharitable Contributions: %,.0f\n"
                    + "\tHome Mortgage Interest: %,.0f\n"
                    + "\tHealth Insurance Tax Credit: %,.0f\n\n"
                    + "Tax at 17%%: %,.0f\n"
                    + "Annual Income After Taxes: %,.0f\n"
                    + "Monthly Income After Taxes: %,.0f", grossAnnualIncome, annualTuition, annualCharity,
                       homeMortgage, healthCredit, taxAt17, annualAfterTaxes, monthlyAfterTaxes);


}

  if( grossAnnualIncome <= 0 )
  {
  System.out.printf( "You earned no income so you owe no taxes!" );
  }

   System.exit(0);
  }

}

Both of my outputs are correct, but I am having trouble with my last one.

My last output needs to read “YOU OWE $0.00 IN TAXES!”

When I code:

if (grossAnnualIncome <= ans1)
{
System.out.printf( "YOU OWE $0.00 IN TAXES!" );
}

It shows everything from grossAnnualIncome > 0 output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:35:40+00:00Added an answer on May 30, 2026 at 10:35 am

    Java: Literal percent sign in printf statement

    It probably has to do with the percent in 17%. It needs to be escaped which can be done with another %

    17%%
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry to ask this again, I've looked over all the related questions here,
Sorry if this sounds like a really stupid question, but I need to make
Sorry for constantly re-editing my question but looks like this is the only way
Sorry for this not being a real question, but Sometime back i remember seeing
Sorry for my ignorance here, but when I hear the word webserver, I immediately
Sorry if this is well known but Googling for my answer only came up
First time poster so sorry if this is too long, but I've hit a
Sorry if this has been asked before, but I couldn't find a solution to
Lots of words below, sorry - but I wanted to explain this situation well:
Sorry if this a simple, but I can't get it right. The problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.