I have an interesting bug I need to fix. The code is very long and involved, but I'm hoping this can just be an easy question for someone with more experience without having to post it all. In the below code, it will prompt questions and answers. Once I added the double on Weight (so that I can do a calculation later that limits the weight) it started skipping the next question. it will display it, but then the next question will display on the same line and it is not possible to answer the first one. Here is the code:
System.out.print("Enter Item Name: ");
cat.setName(input.nextLine());
System.out.print("Enter Weight(lbs) - Max 25 Tons: ");
cat.setWeight(input.nextDouble());
System.out.print("Enter Value: "); //This is the line that will get skipped
cat.setValue(input.nextLine());
System.out.print("Durability (weak = 1, medium = 2, tough = 3): ");
cat.setDurability(input.nextLine());
System.out.print("Enter ID: ");
cat.setId(input.nextLine());
The output will look like this:
Enter Value: Durability (weak = 1, medium = 2, tough = 3):
Instead of:
Enter Value:
Durability (weak = 1, medium = 2, tough = 3):
In attempting to debug, I commented out the Value, and the same exact thing will happen to the next line. This tells me it's something to do with the preceding double but I'm not sure how to address it.
Thanks in advance!