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

  • Home
  • SEARCH
  • 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 8818421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:06:05+00:00 2026-06-14T05:06:05+00:00

I keep getting a cannot find symbol error here: System.out.println (Are there still more

  • 0

I keep getting a “cannot find symbol” error here:

    System.out.println ("Are there still more precincts to report? Please enter y or n");
    response = scan.next();
    while (response.equalsIgnoreCase(y))// Initializations
    {
    System.out.print("Enter votes for Polly: ");
   votesForPolly = scan.nextInt();
    System.out.print("Enter votes for Ernest: ");

Here’s the full code if the problem lies elsewhere:

import java.util.Scanner;

public class Election
{
    public static void main (String[] args)
    {
    int votesForPolly;  // number of votes for Polly in each precinct
    int votesForErnest; // number of votes for Ernest in each precinct
    int totalPolly;     // running total of votes for Polly
    int totalErnest;    // running total of votes for Ernest
    String response;    // answer (y or n) to the "more precincts" question

    int pollyCarried = 0;
    int ernestCarried = 0;
    int tied = 0;

    Scanner scan = new Scanner(System.in);

    System.out.println ();
    System.out.println ("Election Day Vote Counting Program");
    System.out.println ();

    System.out.println ("Are there still more precincts to report? Please enter y or n");
    response = scan.next();
    while (response.equalsIgnoreCase(y))// Initializations
    {
    System.out.print("Enter votes for Polly: ");
   votesForPolly = scan.nextInt();
    System.out.print("Enter votes for Ernest: ");
    votesForErnest = scan.nextInt();

    totalPolly += votesForPolly;
    totalErnest += votesForErnest;

    if ( votesForPolly > votesForErnest )
    pollyCarried++;
   else if ( votesForErnest > votesForPolly )
      ernestCarried++;
   else
      tied++;

    System.out.println ("Are there still more precincts to report? Please enter y or n");
    response = scan.next();
    }// Loop to "process" the votes in each precinct
    int totalVotes = votesForPolly + votesForErnest;

    System.out.println("Polly got " + totalPolly + " votes carrying " + pollyCarried + " precincts.");// Print out the results
    System.out.println("Ernest got " + totalErnest + " votes carrying " + ernestCarried + " precincts.");
    System.out.println("Polly got " + ((totalPolly/totalVotes)*100));
    System.out.println("Ernest got " + ((totalErnest/totalVotes)*100));
    System.out.println("Polly carried " + pollyCarried + " precincts");
    System.out.println("Ernest carried " + ernestCarried + "precincts");
    System.out.println(tied + " precincts resulted in a tie");

    }
}

I’ve also tried making a char or string called “affirmative” and assigning it the letter y so that I can use it in my loop but it’s no good.

  • 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-06-14T05:06:06+00:00Added an answer on June 14, 2026 at 5:06 am

    You have not declared anything that pertains to y

    At this line,

    while (response.equalsIgnoreCase(y))

    The compiler doesn’t know what y is.

    I’m guessing you meant this?

    while (response.equalsIgnoreCase("y"))

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

Sidebar

Related Questions

I'm modifying inherited code and keep getting a weird cannot find symbol error which
I keep getting a 'cannot find file' error when trying to run this. Why
I keep getting this error saying that it cannot find my javascript function checkpw().
On the query below I keep getting this error: Cannot read the next data
Keep getting this error after inserting a subdatasheet into a query and trying to
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep getting this error and have no idea why. I googled and scanned
I keep getting this error on emulator: I copied this from a tutorial and
I keep getting this error Error in readPNG(destfile) : libpng error: PLTE: CRC error

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.