New Posts  All Forums:Forum Nav:

Java Help?

post #1 of 4
Thread Starter 
Hey Everyone,

Trying to sign off all of my completed work and after checking over some I have noticed some tasks are not complete :/ and to add to that I don't understand a few so here is what I need help for:

1) With using Switch Statements what type of Values can they actually Cope with and what Values Can they not?

2) Suppose that salary and deductions are variable of type double, that are given values from the keyboard.
Write a program which uses an if-else statement that displays OK and sets the variable net equal to salary
minus deduction, provided that salary is at least as large as deductions. The variable net should also be
displayed. If, however, salary is less than deductions, the if-else statement should simply display the words
No Way but not change the value of any variables.

The Second Question I just don't basically understand what I need to do, Could anyone simplify what I need the program to do? My brain just isn't working lately, The coding should be easy.
I also would ask my tutor but as these questions are from old work they will not provide anymore help :/

Thanks to anyone who helps smile.gif
New Rig
(19 items)
 
Old Rig
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7-3770k Asus p8Z77-V Deluxe (Socket LGA1155) GeForce GTX 680 8GB Mushkin Enhanced Blackline Frostbyte 
RAMHard DriveHard DriveHard Drive
8GB Mushkin Enhanced Blackline Frostbyte 2GB Western Digital Caviar Green WD10EARS Mushkin Chronos 180GB SSD 2 TB Samsung HDD 
Optical DriveCoolingOSMonitor
LG GH22Ns70 22x DVDRW Be Quiet! Dark Rock PRO 2 Dual Fan Windows 7 Home Premium 23" AOC 2341 
MonitorKeyboardPowerCase
23" AOC 2341 Saitek Cyborg V7 Keyboard 860W Seasonic P-860 Platinum  IN WIN Dragon Rider Black Full Tower 
MouseMouse PadAudio
Gigabyte GM-M6880 xRaider Flexiglow Mousepad Realtek Audio Sound Thingy 
CPUMotherboardGraphicsRAM
Intel Core i3 540 Gigabyte H55M-ED55 (MS-7635) Nvidia GTX 560Ti 6GB Mushkin Blackline 
Hard DriveOptical DriveOSMonitor
2TB Seagate Hard Drive 2x GH22Nss50 Windows 7 Home Premium 64-Bit 2x 23" AOC Monitors 
KeyboardPowerCaseMouse
Saitek Cyborg V7 Keyboard Serena 850W Lian Li PC-K58B Lancool (Beast) Microsoft Sidewinder x8 Mouse 
Mouse Pad
Flexiglow XRaider Mouse Pad 
  hide details  
Reply
New Rig
(19 items)
 
Old Rig
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7-3770k Asus p8Z77-V Deluxe (Socket LGA1155) GeForce GTX 680 8GB Mushkin Enhanced Blackline Frostbyte 
RAMHard DriveHard DriveHard Drive
8GB Mushkin Enhanced Blackline Frostbyte 2GB Western Digital Caviar Green WD10EARS Mushkin Chronos 180GB SSD 2 TB Samsung HDD 
Optical DriveCoolingOSMonitor
LG GH22Ns70 22x DVDRW Be Quiet! Dark Rock PRO 2 Dual Fan Windows 7 Home Premium 23" AOC 2341 
MonitorKeyboardPowerCase
23" AOC 2341 Saitek Cyborg V7 Keyboard 860W Seasonic P-860 Platinum  IN WIN Dragon Rider Black Full Tower 
MouseMouse PadAudio
Gigabyte GM-M6880 xRaider Flexiglow Mousepad Realtek Audio Sound Thingy 
CPUMotherboardGraphicsRAM
Intel Core i3 540 Gigabyte H55M-ED55 (MS-7635) Nvidia GTX 560Ti 6GB Mushkin Blackline 
Hard DriveOptical DriveOSMonitor
2TB Seagate Hard Drive 2x GH22Nss50 Windows 7 Home Premium 64-Bit 2x 23" AOC Monitors 
KeyboardPowerCaseMouse
Saitek Cyborg V7 Keyboard Serena 850W Lian Li PC-K58B Lancool (Beast) Microsoft Sidewinder x8 Mouse 
Mouse Pad
Flexiglow XRaider Mouse Pad 
  hide details  
Reply
post #2 of 4
Hey Apridding, I'm pretty new to Java but I'll try to give you help where I can.

1) I'm not too sure on all the values a switch statement can take but I have used it with int values before, so they worked for me.

2) From what I gather, the user must input 2 different variables of type double. One is a salary and the other is the deduction. The value of the deduction must be taken away from the salary value.
An if statement must be set up so that if the deduction value is less than the salary (deduction < salary), the net variable should now be equal to: salary-deduction and the value will be displayed. A message stating 'OK' should also be displayed.
An else statement must also be created so if the deduction value is greater than the salary (deduction > salary), the final value will not be displayed and a message stating 'No Way' will be displayed. The net variable should still hold its initial value.

That is how I interpreted the question so hopefully it helps a bit.
post #3 of 4
1) Try this page. The very first link has the answer.

2)
  1. Get salary and deduction input from user (validate that they gave you numbers?)
  2. If salary is less than deductions, print no way
  3. otherwise print OK and calculate net salary... print it once you're done calculating
  4. celebrate victory with a return statement

This would be a first/second week of Java programming assignment. If you can't do this, how are you handling the rest of the class?
Edited by Desidero - 1/25/12 at 7:08pm
The New Guy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 G0@3.0GHz GA-P35-DS3L EVGA 8800GT Superclocked 4GB Corsair XMS2 DDR2 800 
Hard DriveHard DriveOptical DriveOS
Seagate 320GB 7200RPM Western Digital Caviar Black Lite-on DVD burner Windows 7 Professional x64 
MonitorKeyboardPowerCase
Samsung 225BW Filco Majestouch Ninja (full keyboard w/browns) Cooler Master Xtreme 650 Antec 900 
MouseAudioAudio
Logitech MX518 Denon AHD-2000 Sennheiser HD595 
  hide details  
Reply
The New Guy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 G0@3.0GHz GA-P35-DS3L EVGA 8800GT Superclocked 4GB Corsair XMS2 DDR2 800 
Hard DriveHard DriveOptical DriveOS
Seagate 320GB 7200RPM Western Digital Caviar Black Lite-on DVD burner Windows 7 Professional x64 
MonitorKeyboardPowerCase
Samsung 225BW Filco Majestouch Ninja (full keyboard w/browns) Cooler Master Xtreme 650 Antec 900 
MouseAudioAudio
Logitech MX518 Denon AHD-2000 Sennheiser HD595 
  hide details  
Reply
post #4 of 4
Thread Starter 
Quote:
Originally Posted by Rypac1502 View Post

Hey Apridding, I'm pretty new to Java but I'll try to give you help where I can.
1) I'm not too sure on all the values a switch statement can take but I have used it with int values before, so they worked for me.
2) From what I gather, the user must input 2 different variables of type double. One is a salary and the other is the deduction. The value of the deduction must be taken away from the salary value.
An if statement must be set up so that if the deduction value is less than the salary (deduction < salary), the net variable should now be equal to: salary-deduction and the value will be displayed. A message stating 'OK' should also be displayed.
An else statement must also be created so if the deduction value is greater than the salary (deduction > salary), the final value will not be displayed and a message stating 'No Way' will be displayed. The net variable should still hold its initial value.
That is how I interpreted the question so hopefully it helps a bit.

You did help in explaining the what I needed to do for the Salary Program, Thanks. (:
Quote:
Originally Posted by Desidero View Post

1) Try this page. The very first link has the answer.
2)
  1. Get salary and deduction input from user (validate that they gave you numbers?)
  2. If salary is less than deductions, print no way
  3. otherwise print OK and calculate net salary... print it once you're done calculating
  4. celebrate victory with a return statement
This would be a first/second week of Java programming assignment. If you can't do this, how are you handling the rest of the class?

That link was very useful and have now completed that task.
The Salary Program is much more clearer from both you and rypac1502 (:
Also, This is work for the 7th Week of tasks and it's been a while since then. And the rest of the class is fine tbh, just been really lazy and behind on a lot of work is all.
New Rig
(19 items)
 
Old Rig
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7-3770k Asus p8Z77-V Deluxe (Socket LGA1155) GeForce GTX 680 8GB Mushkin Enhanced Blackline Frostbyte 
RAMHard DriveHard DriveHard Drive
8GB Mushkin Enhanced Blackline Frostbyte 2GB Western Digital Caviar Green WD10EARS Mushkin Chronos 180GB SSD 2 TB Samsung HDD 
Optical DriveCoolingOSMonitor
LG GH22Ns70 22x DVDRW Be Quiet! Dark Rock PRO 2 Dual Fan Windows 7 Home Premium 23" AOC 2341 
MonitorKeyboardPowerCase
23" AOC 2341 Saitek Cyborg V7 Keyboard 860W Seasonic P-860 Platinum  IN WIN Dragon Rider Black Full Tower 
MouseMouse PadAudio
Gigabyte GM-M6880 xRaider Flexiglow Mousepad Realtek Audio Sound Thingy 
CPUMotherboardGraphicsRAM
Intel Core i3 540 Gigabyte H55M-ED55 (MS-7635) Nvidia GTX 560Ti 6GB Mushkin Blackline 
Hard DriveOptical DriveOSMonitor
2TB Seagate Hard Drive 2x GH22Nss50 Windows 7 Home Premium 64-Bit 2x 23" AOC Monitors 
KeyboardPowerCaseMouse
Saitek Cyborg V7 Keyboard Serena 850W Lian Li PC-K58B Lancool (Beast) Microsoft Sidewinder x8 Mouse 
Mouse Pad
Flexiglow XRaider Mouse Pad 
  hide details  
Reply
New Rig
(19 items)
 
Old Rig
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7-3770k Asus p8Z77-V Deluxe (Socket LGA1155) GeForce GTX 680 8GB Mushkin Enhanced Blackline Frostbyte 
RAMHard DriveHard DriveHard Drive
8GB Mushkin Enhanced Blackline Frostbyte 2GB Western Digital Caviar Green WD10EARS Mushkin Chronos 180GB SSD 2 TB Samsung HDD 
Optical DriveCoolingOSMonitor
LG GH22Ns70 22x DVDRW Be Quiet! Dark Rock PRO 2 Dual Fan Windows 7 Home Premium 23" AOC 2341 
MonitorKeyboardPowerCase
23" AOC 2341 Saitek Cyborg V7 Keyboard 860W Seasonic P-860 Platinum  IN WIN Dragon Rider Black Full Tower 
MouseMouse PadAudio
Gigabyte GM-M6880 xRaider Flexiglow Mousepad Realtek Audio Sound Thingy 
CPUMotherboardGraphicsRAM
Intel Core i3 540 Gigabyte H55M-ED55 (MS-7635) Nvidia GTX 560Ti 6GB Mushkin Blackline 
Hard DriveOptical DriveOSMonitor
2TB Seagate Hard Drive 2x GH22Nss50 Windows 7 Home Premium 64-Bit 2x 23" AOC Monitors 
KeyboardPowerCaseMouse
Saitek Cyborg V7 Keyboard Serena 850W Lian Li PC-K58B Lancool (Beast) Microsoft Sidewinder x8 Mouse 
Mouse Pad
Flexiglow XRaider Mouse Pad 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming