New Posts  All Forums:Forum Nav:

im stuck in java

post #1 of 35
Thread Starter 
so i just started doing java this semester and im stuck... i need to change a variable from a double type to an int. can someone help me out here

ps. im so boned in this class lol i may need to get help with other things so if you check back i would greatly apperciate the help
post #2 of 35
Thread Starter 
i fixxed the problem i had XD however im gonna need help later XD
post #3 of 35
lol im also currently learning java, but i wasnt sure how to solve your problem.
Roof Ski
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7 950 @4ghz HT on 1v XFX X58I SLi 295's 12GB OCZ Obsidian 1600mhz 
Hard DriveOptical DriveOSMonitor
ocz agility 3 + 4TB Drives Samsung DVD-RW Win 7 Ultimate x64 2x Samsung 24"s + DELL E248WFP 
KeyboardPowerCaseMouse
G11 Sleeved corsair ax850 800D Sidewinder 
  hide details  
Reply
Roof Ski
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7 950 @4ghz HT on 1v XFX X58I SLi 295's 12GB OCZ Obsidian 1600mhz 
Hard DriveOptical DriveOSMonitor
ocz agility 3 + 4TB Drives Samsung DVD-RW Win 7 Ultimate x64 2x Samsung 24"s + DELL E248WFP 
KeyboardPowerCaseMouse
G11 Sleeved corsair ax850 800D Sidewinder 
  hide details  
Reply
post #4 of 35
Thread Starter 
man this is hard stuff lol idont understand the concept of methods and such care to help me out XD
post #5 of 35
Java (all first languages for that matter) is a bit daunting at first, but once you're starting to get the hang of the basics, I find the API's to be of great help! http://download.oracle.com/javase/1.5.0/docs/api/

Also the java tutorials are great aswell in my opinion!
http://download.oracle.com/javase/tutorial/
My System
(28 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 950 X58 Extreme NVIDIA GeForce GTX 760 NVIDIA GeForce GTX 760 
GraphicsRAMRAMRAM
NVIDIA GeForce GTX 460 Kingston  Kingston  Kingston  
RAMRAMRAMHard Drive
Kingston  Kingston  Kingston  2 TB Samsung HDD 
Hard DriveCoolingCoolingOS
OCZ 120 GB Agility 3 SSD Corsair Cooling Hydro Series H80 Scythe Kaze Fan Controller Windows 7 Ultimate 64bit 
MonitorMonitorMonitorKeyboard
3x BenQ XL2420  Philips HDTV 2x Fujitsu Siemens 24" Razer Lycosa Mirror Edition 
PowerCaseMouseMouse Pad
Antec Truepower TP-750 Cooler Master HAF 912 Plus Razer Deathadder Razer Vespula 
AudioAudioAudio
Muse Pocket LT3  Razer Megalodon Logitech Dolby 5.1 
  hide details  
Reply
My System
(28 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 950 X58 Extreme NVIDIA GeForce GTX 760 NVIDIA GeForce GTX 760 
GraphicsRAMRAMRAM
NVIDIA GeForce GTX 460 Kingston  Kingston  Kingston  
RAMRAMRAMHard Drive
Kingston  Kingston  Kingston  2 TB Samsung HDD 
Hard DriveCoolingCoolingOS
OCZ 120 GB Agility 3 SSD Corsair Cooling Hydro Series H80 Scythe Kaze Fan Controller Windows 7 Ultimate 64bit 
MonitorMonitorMonitorKeyboard
3x BenQ XL2420  Philips HDTV 2x Fujitsu Siemens 24" Razer Lycosa Mirror Edition 
PowerCaseMouseMouse Pad
Antec Truepower TP-750 Cooler Master HAF 912 Plus Razer Deathadder Razer Vespula 
AudioAudioAudio
Muse Pocket LT3  Razer Megalodon Logitech Dolby 5.1 
  hide details  
Reply
post #6 of 35
Thread Starter 
sweet ive been using the api but im just so lost its not even funny
post #7 of 35
Quote:
Originally Posted by Onions View Post
sweet ive been using the api but im just so lost its not even funny
yeah the api's are really confusing at start! I'm in my 3rd semester of java now and once you get the hang of the basic mechanics, all the other api's seem to get a lot easier... So don't panic!
My System
(28 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 950 X58 Extreme NVIDIA GeForce GTX 760 NVIDIA GeForce GTX 760 
GraphicsRAMRAMRAM
NVIDIA GeForce GTX 460 Kingston  Kingston  Kingston  
RAMRAMRAMHard Drive
Kingston  Kingston  Kingston  2 TB Samsung HDD 
Hard DriveCoolingCoolingOS
OCZ 120 GB Agility 3 SSD Corsair Cooling Hydro Series H80 Scythe Kaze Fan Controller Windows 7 Ultimate 64bit 
MonitorMonitorMonitorKeyboard
3x BenQ XL2420  Philips HDTV 2x Fujitsu Siemens 24" Razer Lycosa Mirror Edition 
PowerCaseMouseMouse Pad
Antec Truepower TP-750 Cooler Master HAF 912 Plus Razer Deathadder Razer Vespula 
AudioAudioAudio
Muse Pocket LT3  Razer Megalodon Logitech Dolby 5.1 
  hide details  
Reply
My System
(28 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 950 X58 Extreme NVIDIA GeForce GTX 760 NVIDIA GeForce GTX 760 
GraphicsRAMRAMRAM
NVIDIA GeForce GTX 460 Kingston  Kingston  Kingston  
RAMRAMRAMHard Drive
Kingston  Kingston  Kingston  2 TB Samsung HDD 
Hard DriveCoolingCoolingOS
OCZ 120 GB Agility 3 SSD Corsair Cooling Hydro Series H80 Scythe Kaze Fan Controller Windows 7 Ultimate 64bit 
MonitorMonitorMonitorKeyboard
3x BenQ XL2420  Philips HDTV 2x Fujitsu Siemens 24" Razer Lycosa Mirror Edition 
PowerCaseMouseMouse Pad
Antec Truepower TP-750 Cooler Master HAF 912 Plus Razer Deathadder Razer Vespula 
AudioAudioAudio
Muse Pocket LT3  Razer Megalodon Logitech Dolby 5.1 
  hide details  
Reply
post #8 of 35
Thread Starter 
lol well im never gonna make it to third sem at this point lol i cant even get my friggin bot to turn right XD this sucks ass lol
post #9 of 35
What you're doing is called type casting.. Just remember that when using non-whole numbers you will always round down
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
post #10 of 35
Thread Starter 
so this is my assignment
Code:

  Requirements:


   1. Create a java class called Fraction whose constructor accepts two integer arguments which define the numerator and the denominator of a fraction object.
   2. The constructor will call a private method named reduce() which will reduce the fraction. This method will accept no arguments, it will operate on the private variables numerator and denominator defined by the constructor. This method will not return anything.
   3. The reduce() method will call a private method named findGCD(). This method accepts no arguments. This method will return an integer, the greatest common divisor (gcd). This value, gcd, will be used to reduce the fraction.
   4. The Fraction class will have a public method named display() which will print out to the console the value of the numerator and denominator.
   5. Write accessor methods getNumerator() and getDenominator() which are public methods and return the appropriate integer.
   6. The Fraction class will have a public method named add() which will accept an object of type Fraction and return a new object of type Fraction. The work done by this method will add the passed in object values to the host object values and save the result in the new object which is returned to the main line of the program.
   7. The main() method of your application will prompt the user for a numerator and an denominator twice to define two objects of type Fraction. If the user enters a zero for the denominator stay in a loop prompting for another integer until you get something non-zero.
   8. The main() method will print the two fractions using the display() method.
   9. The main() method will add the two fractions together and display the sum.
  10. Include documentation which can be read by the javadoc utility. Include features suitable to an application of this size.
  11. Your documentation should include a general description of what this application does. 
so this is how lost i am whats a method
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming