Java Why Is My Java Program Not Working?

AI Thread Summary
The discussion focuses on a request for assistance in identifying mistakes in a Java program. Participants emphasize the importance of posting code within code tags instead of screenshots to facilitate easier quoting and analysis. Key errors identified include the incorrect use of method names in the Scanner class, specifically "nextInt()" and "nextDouble()" instead of "nextint()" and "nextdouble()", highlighting the significance of adhering to Java's naming conventions. Additionally, suggestions are made to improve variable naming practices and to consider using System.out.print(...) for input prompts instead of System.out.println(...) for aesthetic reasons. The thread concludes with a reminder to follow proper posting guidelines for future assistance.
grzz
Messages
1,030
Reaction score
26
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

Technology news on Phys.org
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
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.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top