d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help Beginner Using Mod Operator( Java) > Topic
Prev12
Add Reply New Topic New Poll
Member
Posts: 2,702
Joined: Jan 5 2008
Gold: 0.49
Oct 10 2013 09:53am


then after i fill that out and put run. this is the output

Exception in thread "main" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at Client.main(Client.java:30)
Java Result: 1

BUILD SUCCESSFUL (total time: 55 seconds)
Member
Posts: 2,757
Joined: Nov 26 2007
Gold: 1,214.81
Oct 10 2013 09:59am
Quote (Yohancy @ Oct 10 2013 11:53am)
http://s7.postimg.org/8zgl426cb/first.png

then after i fill that out and put run. this is the output

Exception in thread "main" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at Client.main(Client.java:30)
Java Result: 1

BUILD SUCCESSFUL (total time: 55 seconds)


at line 63, input is still null. That's why you get NumberFormatException

change line 63 to 66 to this
Code
input = JOptionPane.showInputDialog( null,
"What is the name eights amount?", "Eights",
JOptionPane.QUESTION_MESSAGE );
eightsportion = Integer.parseInt( input );




and line 68-71 to this
Code
input = JOptionPane.showInputDialog( null,
"What is the name dollar ammount?", "Dollar",
JOptionPane.QUESTION_MESSAGE );
dollarportion = Integer.parseInt( input );



You also have to do that in several other places
Member
Posts: 2,702
Joined: Jan 5 2008
Gold: 0.49
Oct 10 2013 10:12am
that fixed that problem! thanks!

but now... my math seems to be off completely.. or idk. this is what i am getting as an output when i type this

Company: The Ramjac Corporation

Shares Held: 100

Opening Price per Share: 37 5/8

Opening Portfolio Value: $3762.50

Change in Share Price: 7 2/8

Closing Price per Share: 44 7/8

Closing Portfolio Value: $4487.50

Change in Share Price: 4 4/8

Closing Price per Share: 49 3/8

Closing Portfolio Value: $4937.50



This is my output:

Company:The Ramjac Corporation
Shares Held: 100
Opening Price per Share:375/8
Opening Portfolio Value:4200

Change in Share price72/
Opening Price per Share:72/8
Closing Portfolio Value: 400

Change in Share price72/
Opening Price per Share:72/8
Closing Portfolio Value: 400

Change in Share price44/
Opening Price per Share:44/8
Closing Portfolio Value: 800
BUILD SUCCESSFUL (total time: 1 minute 19 seconds)
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll