• Post Reply Bookmark Topic Watch Topic
  • New Topic

What am I doing wrong?  RSS feed

 
Junaid Mahmud
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am suppose to print the floor type based on preference of a user. The only problems I have with this is that It does not print out the floor type preference from the user as well as it always prints the same floor type even with different preference. Thanks


 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On line 65 you set floortype. In your switch statements you overwrite this value.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, your formatting makes it difficult to follow your logic. Your switch statement appears to have some logic errors but weeding through that much poorly formatted code taxes the patience.  Second, your variable names are cryptic and cause you to introduce bugs that could be easily avoided if you chose better names.  Read line 132 again carefully and see if it's really doing what you think it's doing.
 
Junaid Mahmud
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my updated program. I am still having issues. Please help I need it to print the preferred option with the price next to it.


 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
need it to print the preferred option with the price next to it.

Please copy the program's current output and paste it here so we can see the problem.

Add some comments to the post saying what is wrong with the print out and show what the output should be.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junaid Mahmud wrote:. . .
You must never do that.

As well as the incorrect formatting, you have poorly chosen variable and package names.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) Your switch formatting is very unreadable. b) You are still overwriting floortype.
 
salvin francis
Bartender
Posts: 1664
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Junaid Mahmud, I have formatted your code for better inputs. Next time, please do the same.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!