Why Is My Java Program Not Working?

In summary, there is a request for help in finding mistakes in a Java program. The conversation also includes tips on posting code correctly and following Java naming conventions. There is also a reminder to provide more information, such as any errors encountered.
  • #1
grzz
1,021
21
TL;DR Summary
I need help because I cannot find mistakes in my java program.
Please help me to find what my mistakes are in the following java program.
 

Attachments

  • java progr.pdf
    38 KB · Views: 133
Technology news on Phys.org
  • #2
From the next time onwards, please post your code inside the code tags instead of a screenshot. That helps us to directly quote portions of the code rather than typing out everything again. Click on this:

1672309365723.png


paste your code, select the language and click on Continue.

That aside, from your screenshot, I see BlueJ already highlights the errors. There is no function nextint() or nextdouble() in the Scanner class. It's nextInt() and nextDouble(). Note the capitals. These follow from the Java function naming conventions.

Also, it is better if you name objects using the naming conventions. sc (small letters) is better than Sc. In addition, when you are taking input, you can use System.out.print(...) instead of System.out.println(...). The last one is just for aesthetics, though.
 
  • Like
Likes FactChecker, jim mcnamara and pbuk
  • #3
grzz said:
TL;DR Summary: I need help because I cannot find mistakes in my java program.

Please help me to find what my mistakes are in the following java program.
Please repost your thread using the instructions from @Wrichik Basu -- You really need to post the code within code tags if you want to get help at PF with your code. Please also tell us what you think is wrong with the code; are you getting errors?

This thread is closed.
 

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
Replies
1
Views
1K
Replies
8
Views
3K
Replies
14
Views
1K
Back
Top