Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › I need C# help bad... ALL HELP APPRECIATED
New Posts  All Forums:Forum Nav:

I need C# help bad... ALL HELP APPRECIATED

post #1 of 60
Thread Starter 
I cannot figure this out and I have looked at both my book and online. How do I tell the compiler... "If gas prices are from 0-99.9 then the equation to calculate cost is x

Here is a pic of what I got

Home.png

Please help
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
post #2 of 60

Re: I need C# help bad

By the looks of it you'll need an opening { after your if condition (which is correct) and a closing } to enclose the body of the statement

Sent from my Nexus S using Tapatalk
Main System
(18 items)
 
Server
(11 items)
 
 
CPUCPUMotherboardGraphics
Intel Xeon X5660 Intel Xeon X5660 Intel S5520UR Onboard 
RAMHard DriveHard DriveCooling
Samsung 24GB (6x4GB) DDR3 ECC REG 1333MHz 500GB Samsung 2.5" SATA 250GB Seagate 3.5" SATA Cooler Master Hyper 212 EVO + TX-3 
OSPowerCase
Windows Server 2012 x64 Dell OEM PSU 375W Antec 900 II (Modified) 
  hide details  
Reply
Main System
(18 items)
 
Server
(11 items)
 
 
CPUCPUMotherboardGraphics
Intel Xeon X5660 Intel Xeon X5660 Intel S5520UR Onboard 
RAMHard DriveHard DriveCooling
Samsung 24GB (6x4GB) DDR3 ECC REG 1333MHz 500GB Samsung 2.5" SATA 250GB Seagate 3.5" SATA Cooler Master Hyper 212 EVO + TX-3 
OSPowerCase
Windows Server 2012 x64 Dell OEM PSU 375W Antec 900 II (Modified) 
  hide details  
Reply
post #3 of 60
Thread Starter 
Yea I see that part but how do I link the If statement with that equation?

Basically how do I use boolean statements with arithmetic?
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
post #4 of 60

Re: I need C# help bad

Syntax is as follows:

if (condition 1) {
Do something
} else if (condition 2) {
Do something else
} else {
Do something if all above fail

So each segment is controlled by the condition preceding it and enclosed by { }

The else if and else branches are also optional

Sent from my Nexus S using Tapatalk
Main System
(18 items)
 
Server
(11 items)
 
 
CPUCPUMotherboardGraphics
Intel Xeon X5660 Intel Xeon X5660 Intel S5520UR Onboard 
RAMHard DriveHard DriveCooling
Samsung 24GB (6x4GB) DDR3 ECC REG 1333MHz 500GB Samsung 2.5" SATA 250GB Seagate 3.5" SATA Cooler Master Hyper 212 EVO + TX-3 
OSPowerCase
Windows Server 2012 x64 Dell OEM PSU 375W Antec 900 II (Modified) 
  hide details  
Reply
Main System
(18 items)
 
Server
(11 items)
 
 
CPUCPUMotherboardGraphics
Intel Xeon X5660 Intel Xeon X5660 Intel S5520UR Onboard 
RAMHard DriveHard DriveCooling
Samsung 24GB (6x4GB) DDR3 ECC REG 1333MHz 500GB Samsung 2.5" SATA 250GB Seagate 3.5" SATA Cooler Master Hyper 212 EVO + TX-3 
OSPowerCase
Windows Server 2012 x64 Dell OEM PSU 375W Antec 900 II (Modified) 
  hide details  
Reply
post #5 of 60
Thread Starter 
home3.png

I get this when I try that

Is "Do" the command in that line of code?
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
post #6 of 60
I think you need to say:

if (GalofFuel >= 0 && GalofFuel <= 99.9)
{
(Rate * GalofFuel) + Surcharge1
}
else
{
Pass; <--- Or leave this part our, or whatever else you need it to do.
}

Something along those lines.
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
post #7 of 60
yea so the ";" needs to be right after the expression

and i would see what happens if you take out some of the parenthesis in the if statement
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
post #8 of 60
Surcharge1 = what? What does surcharge1 equal!? that's your problem.
Unto The Void
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 6800k Gigabyte G1 X99-Phoenix SLI Gigabyte GTX 1080 G1 32GB RipJaw 4 DDR4-3000 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 500GB Crucial M4 2 x Spinpoint F1 Samsung 850 1TB 
CoolingOSMonitorMonitor
Noctua NH-D15S Windows 10 LG Ultrawide 29" Asus 24" 
KeyboardPowerCaseMouse
Logitech 810 EVGA P2 650 Watt In Win 303 Logitech G502 
  hide details  
Reply
Unto The Void
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 6800k Gigabyte G1 X99-Phoenix SLI Gigabyte GTX 1080 G1 32GB RipJaw 4 DDR4-3000 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 500GB Crucial M4 2 x Spinpoint F1 Samsung 850 1TB 
CoolingOSMonitorMonitor
Noctua NH-D15S Windows 10 LG Ultrawide 29" Asus 24" 
KeyboardPowerCaseMouse
Logitech 810 EVGA P2 650 Watt In Win 303 Logitech G502 
  hide details  
Reply
post #9 of 60
yea that wasn't in the first pic ^^
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
The Donbot
(12 items)
 
Crushinator
(10 items)
 
Lenovo T450S
(6 items)
 
CPUMotherboardGraphicsRAM
i5 2320 Asrock H61M-VG4 EVGA GTX 970 8gig Samsung LowPro 
Hard DriveMonitorKeyboardPower
Samsung 840 Evo 250gb/WD Black 640gb Asus 24 inch (1080p) Sades Mechanical w/blues Rosewill Hive 550 
CaseMouse
Apevia X-ENERQ Pink Logitec G100s 
CPUMotherboardGraphicsRAM
i5 5300u @ 2.90 Lenovo HD Graphics 5500 12 gigs 
Hard DriveOS
Samsung 250g SSD Windows 10 
  hide details  
Reply
post #10 of 60
Thread Starter 
I have completely confused myself

My assignment is this

home3-1.png
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
Zaxbuild Mk II
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel 2500k Asus P67 WS Revolution EVGA GTX 670 SC 4GB 2x4gb G.Skill Rip Jaws CL6 
Hard DriveOptical DriveCoolingOS
Crucial M4 128gb & Crucial C300 60gb SSD & 2x 1... Asus 24x CD/DVD-RW XSPC RASA 240 Kit Windows 7 Pro 64bit 
MonitorKeyboardPowerCase
4 x ASUS VN247H-P's in Surround + Accessory Logitech G15 Corsair HX750 NZXT Phantom-White 
MouseMouse PadAudio
Logitech G5 Razer Kabuto Asus Xnonar DX 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › I need C# help bad... ALL HELP APPRECIATED