Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

What does this error mean i have never gotten it before?

here are my errors

GiftBag.java:22: error: cannot find symbol

double getLimit = in.nextDouble();

^

symbol: variable in

location: class GiftBag

GiftBag.java:34: error: cannot find symbol

double weight = in.nextDouble();

^

symbol: variable in

location: class GiftBag

normally when i write the code like that it works just fine but not this time for some reason, here is the rest of my code if you need it.

//Mike Sigl

//Programming Final Exam (GiftBag)

//December 15th, 2011

import java.util.*;

//a class for planning your shopping day based on weight

public class GiftBag

{

private int GiftBag;

private double currentWeight = 0;

private double weight = 0;

String aBigRedBag = null;

double getLimit = 0;

public int count = 0;

//gets the bags weight limit

public void getLimit()

{

Scanner scan = new Scanner(System.in);

System.out.println("Please input your bags weight limit");

double getLimit = in.nextDouble();

}

// scanner

Scanner addGifts = new Scanner(System.in);

//Loop for collecting the weights of the gifts

public void getcurrentWeight()

{

while (count <= 3)

{

System.out.println("Please input a gift weight ");

double weight = in.nextDouble();

currentWeight = (currentWeight + weight);

count++;

}

}

//If statements that determine status of bag

public void getStatusOfBag(String getStatusOfBag)

{

if (currentWeight <= (getLimit / 2))

System.out.println("Your bag is less than or equal to half full, you may continue shopping if you wish");

else if (currentWeight >= (getLimit / 2) && currentWeight < getLimit)

System.out.println("Your bag is nearing its limits you may continue shopping cautiously ");

else if (currentWeight >= getLimit)

System.out.println("You have reached your bags limit please precede to the check out line or get another bag");

}

//returns aBigRedBag to the viewer

public String getaBigRedBag()

{

return aBigRedBag;

}

}

1 Answer

Relevance
  • Will H
    Lv 7
    9 years ago
    Favorite Answer

    double getLimit = scan.nextDouble();

    in while loop

    Scanner addGifts = new Scanner(System.in);

    System.out.println("Please input a gift weight ");

    double weight = addGifts.nextDouble();

Still have questions? Get your answers by asking now.