Norm Radder

Rancher
+ Follow
since Aug 10, 2005
Worked mostly with IBM mainframe assembly code. Loved IBM's VM OS.
On vacation
Cows and Likes
Cows
Total received
38
In last 30 days
0
Total given
1
Likes
Total received
536
Received in last 30 days
7
Total given
105
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Norm Radder

difference between compiling and executing?  


The compiler reads source code and produces a file that can be used to execute the program.

It has 10 errors.


Have you located any of the errors?
Create a source file from the posted code and pass it to the compiler to have it find the errors.
1 day ago
Do you have any questions?
What happens when you compile the code?
If the compile has no errors, what happens when you execute the code?
1 day ago
The { on line 16 (paired with } on line 39) is confusing.  I don't think it does anything.
The message to user:  Enter the number 7 to stop
does not agree with the logic in the while on line 16 which will continue with a 7

Then the next loop uses different logic, it asks user to enter a 7 to continue.
The confusion is the first loop says enter 7 to stop, the second loop says enter 7 to continue.
1 day ago
You may need to have some set... methods to pass references to the classes that need them.
4 days ago

at Library/library.Menu2.run(Menu2.java:90)


Which line is line 90?

Read the API doc for the Arrays asList method.  I do not believe the list it returns can be added to.
4 days ago
What have you tried?
What problems are you having?
4 days ago
There are missing class declarations that keep the code from being compiled for testing.

Also what is on the console when the code is executed?
4 days ago
Can you post the new code
and the console that shows your input.
Add comments that describe the problem:  >>> This should be xyz...
4 days ago
To see what the code is doing, add a print statement that prints the value of i and the value of total for each iteration of the loop.
The print out will show you what is happening.
4 days ago

Why does this program return the answer 45


What value do you expect to be printed?  
Have you desk checked the code to see what the correct output should be?
4 days ago
One problem I see in the posted code is that a new Scanner is created on each iteration of the loop.
Move the Scanner creation code outside of the loop.
4 days ago
Can you post the new code so we can test it?

Also copy and paste here the contents of the console from your test.  Be sure to add comments to the output describing what is wrong with it and show what it should be.
4 days ago
One problem I see is more than one instance of Scanner that takes input from System.in.
Change the code to have only one instance of Scanner that uses System.in.
4 days ago

 it goes automatically to the next option


That sounds like the standard problem with using the Scanner class and mixing calls to next... with calls to nextLine();
This article discusses it: https://www.geeksforgeeks.org/why-is-scanner-skipping-nextline-after-use-of-other-next-functions/
4 days ago
The classes are contained within the CompositeExample class and only exist when there is an instance of the class.
main is a static method and can only access static members of the class.

Change the classes to static and the code in main will be able to access them.  For example:

5 days ago