• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help converting my code to work with a driver class?  RSS feed

 
John Sing
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I had to make a program where a user inputs values and I have to test if they are a magic square. I was able to do that with the following code



but I have to make it so the user inputs the value through JOptionPane and so that the program uses a driver class. So here is my driver class



and here is my new main code



So how can I convert my code to use the values entered from the JOptionPane? Would I have to redo the entire code?
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With over 50 posts to this site, you should have been told multiple times already that you need to format your code properly. This will help tremendously in getting more help from people. As it is right now, my only inclination to help is to tell you, once again, to do yourself and others a favor and format your code properly. Are you not using an IDE like Eclipse or NetBeans or IDEA? All it takes is a few keystrokes or if you're not up to doing that, a few clicks of the mouse.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have to change your code to work with a driver class? Most classes should have a public interface and any other code using the class uses that public interface. You need to program your driver class to work with the public interface.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!