Charlie Garc

Greenhorn
+ Follow
since Jan 31, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Charlie Garc

This are the places my errors occur
3 days ago
So I solved the class def error and got the program to compile.  However it only works through collecting the user's operation choice.  Then the command prompt states this error:

F:\GarciaP2>java MainP2
Exception in thread "main" java.lang.NullPointerException
       at FractionCalc.calculate(FractionCalc.java:81)
       at FractionCalc.setInputData(FractionCalc.java:55)
       at FractUI.run(FractUI.java:64)
       at MainP2.<init>(MainP2.java:14)
       at MainP2.main(MainP2.java:8)
3 days ago
I have all 4 .java files in a folder called GarciaP2 on my USB.  I thought after compiling the MainP2 file that I should have .class files of all 4 .java files, however I only have a .class file for the MainP2 and the FractUI file.  All in the same GarciaP2 folder..
4 days ago
This is the error I am receiving:

F:\GarciaP2>java MainP2
Exception in thread "main" java.lang.NoClassDefFoundError: FractionCalc
       at FractUI.<init>(FractUI.java:15)
       at MainP2.<init>(MainP2.java:13)
       at MainP2.main(MainP2.java:8)
Caused by: java.lang.ClassNotFoundException: FractionCalc
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       ... 3 more
4 days ago
After working out all of my errors my program compiles and then at run time an exception comes up that says no class def error...  I have my code written into 4 separate notepad++ files that are all in the same folder.. I'm not sure what's wrong.  Any help is much appreciated.  





FractUI.java




FractionCalc.java




FractionReducer.java
4 days ago
My assignment is to contain all of my code within the main method.. My next program will be to separate it out...
1 week ago
Disregard the last question, I figured that part out. Thank you for your help!
1 week ago
That helped.  Thank you.
Is this how I now convert my string back to an int so that I can reduce the fraction?

1 week ago
I'm making a fraction calculator program and it was running fine until I wrote the if statement.. Now I am getting incompatible types error:  int cannot be converted to string.  Here is my code and the error messages I am receiving.  I will keep looking at it.. Thanks for any help.



Garcia_P1.java:69: error: incompatible types: int cannot be converted to String
                               sResults = ((n1*d2) + (n2*d1)) / (d1*d2);
                                                              ^
Garcia_P1.java:74: error: incompatible types: int cannot be converted to String
                               sResults = ((n1*d2) - (n2*d1)) / (d1*d2);
                                                              ^
Garcia_P1.java:85: error: incompatible types: int cannot be converted to String
                               sResults = ((n1/d1) * (d2/n2));
                                                   ^
3 errors
2 weeks ago
These are my errors as of right now.  I will look over my joptionpanes again. I have to learn Java this way so that I will be able to read anything written in old java...

GarciaP1.java:48: error: bad operand type String for unary operator '+++'
                               +"\n + \n - \n * \n /",
                               ^
GarciaP1.java:52: error: cannot find symbol
                       int choice = integer.ParseInt(sChoice);
                                    ^
 symbol:   variable integer
 location: class GarciaP1
GarciaP1.java:74: error: incompatible types: int cannot be converted to String
                               sResults = ((n1*d2) + (n2*d1))/(d1*d2);
                                                             ^
GarciaP1.java:79: error: incompatible types: int cannot be converted to String
                               sResults = ((n1*d2) - (n2*d1))/(d1*d2);
                                                             ^
GarciaP1.java:91: error: incompatible types: int cannot be converted to String
                               sResults = ((n1/d1) * (d2/n2));
                                                   ^
GarciaP1.java:159: error: variable sAgain is already defined in method main(String[])
                       int sAgain = JOptionPane.showInputDialog(null,
                           ^
GarciaP1.java:159: error: no suitable method found for showInputDialog(<null>,String,String,int,int)
                       int sAgain = JOptionPane.showInputDialog(null,
                                               ^
   method JOptionPane.showInputDialog(Object) is not applicable
     (actual and formal argument lists differ in length)
   method JOptionPane.showInputDialog(Object,Object) is not applicable
     (actual and formal argument lists differ in length)
   method JOptionPane.showInputDialog(Component,Object) is not applicable
     (actual and formal argument lists differ in length)
   method JOptionPane.showInputDialog(Component,Object,Object) is not applicable
     (actual and formal argument lists differ in length)
   method JOptionPane.showInputDialog(Component,Object,String,int) is not applicable
     (actual and formal argument lists differ in length)
   method JOptionPane.showInputDialog(Component,Object,String,int,Icon,Object[],Object) is not applicable
     (actual and formal argument lists differ in length)
7 errors
2 weeks ago
I am getting cannot convert object to string and int to string error messages that I don't understand.  This is the start of my Fraction Calculator program but as is it won't even compile yet.


Moderator edit: added code tags
2 weeks ago