+ 2

Please help me to find the reason why the code is not working for the next four numbers.

Here this JAVA program describes the operations performed by calculator. Here I used the 3 objects for code reusability for next two times. The problem with this is it is executing the code for one time and showing errors after executing. Please enter 6 integers in input block and check this code. https://code.sololearn.com/cin01J2FpnR5/?ref=app.

31st Aug 2020, 12:54 PM
Venkatesh
7 Respuestas
+ 3
Vishesh I got the answer to this program,the problem is with the sololearn compiler, when I tried executing the same code on online compiler it worked...
31st Aug 2020, 1:47 PM
Venkatesh
+ 2
Haa yes I did it Avalon
31st Aug 2020, 1:37 PM
Venkatesh
+ 2
Thanks everyone.....
31st Aug 2020, 1:47 PM
Venkatesh
+ 1
Firstly, I think this is bad design. If we really want to use the calculator three times in seperate points on the timeline, then there is no need of three instances of the calculator class. Just use one object or loop over it. Correct me if I am wrong. Second, the problem I think is because of some issues with the input prompt of the code playground. Did you tried to run in in some other IDEs?
31st Aug 2020, 1:28 PM
विशेष
विशेष - avatar
+ 1
In SL playg, you need to write all inputs in one time separating them by enter
31st Aug 2020, 1:31 PM
Shadoff
Shadoff - avatar
+ 1
Listen Vishesh,I am new to JAVA programming,and my intension is to create a program without using loops,etc.I just tried to use the basic syntax i.e classes and objects.
31st Aug 2020, 1:36 PM
Venkatesh
+ 1
Of course, I don't mean to put you down. I only pointed out something I found weird. And design is also a big factor to improve as a coder. Best of luck.
31st Aug 2020, 1:44 PM
विशेष
विशेष - avatar