The Big Programming Thread - Page 59
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
stafu
Australia1196 Posts
| ||
catamorphist
United States297 Posts
On June 08 2011 22:45 Wala.Revolution wrote: Usually I won't ask a simple question, but I got a final coming up so I must ask. My teacher told the class there would be a question of what file I/O (in C) could be used for. The class was cut short because she ran out of time after explaining a few function of file I/O. From what I gathered it's a simple access read/write function. So I was going to answer ("To revise everyone's grades) or something akin to that. Is there any special features of file I/O I should be aware of to answer the question appropriately? You have a computer, right? And it has a filesystem, with files on it? And you are having a hard time coming up with good uses for reading and writing to files? | ||
ThatGuy
Canada695 Posts
| ||
Tiranimo
Netherlands12 Posts
On June 09 2011 02:12 ThatGuy wrote: Hi guys, more of an ethical question here: am I liable with the person/company that I design and set up a website for if their operation turns out to be illegal? Someone wants me to set up a site that could be interpreted as gambling (essentially sports betting), and if they run into any legal trouble I don't want any part of it. We handled this subject in my class a few weeks back. Basicly it came down to it being a 'grey area'. You can take the project on but you run the risk of getting in trouble if the owner gets caught. If he doesn't, then you can still feel guilty for making something that is used for 'evil'. Then again, a job is a job. If it makes good money, you should go for it. | ||
xHassassin
United States270 Posts
| ||
mmp
United States2130 Posts
On June 09 2011 02:12 ThatGuy wrote: Hi guys, more of an ethical question here: am I liable with the person/company that I design and set up a website for if their operation turns out to be illegal? Someone wants me to set up a site that could be interpreted as gambling (essentially sports betting), and if they run into any legal trouble I don't want any part of it. If it's illegal in your county/province/country then you probably don't want to maintain or provide services. If you sell a product or service that in itself has nothing to do with the illegal operations, then you're in a nice little grey area. If you're doing auxiliary work (like artwork) that is wholly unrelated to the illegal operations then you're probably safe. If you have to ask, you probably want to pass on this gig. | ||
ComaDose
Canada10352 Posts
work is a pretty bland thing today. just needed a place to complain. Trying to format the mess this department has made of their "database" so i can put it in the actual sql database I made. Excel is not my friend. | ||
mmp
United States2130 Posts
On June 09 2011 23:54 ComaDose wrote: Ugh... vba... work is a pretty bland thing today. just needed a place to complain. Trying to format the mess this department has made of their "database" so i can put it in the actual sql database I made. Excel is not my friend. I won't laugh, I won't laugh, I won't laugh. + Show Spoiler + Still not laughing! glhf | ||
ComaDose
Canada10352 Posts
just to give you something else to not laugh about this+ Show Spoiler + Component: Resistor, Fixed|Class: Military|Type: Carbon Comp|Features: Color Band|Package: Axial|Value: 5.6K Ohm|Tolerance: 5%|Power: 0.25 Watts @ 70 Deg. C RESISTOR, C.C., 33 OHM, 1/2 W, 5% | ||
AkaHenchway
United States41 Posts
+ Show Spoiler + import java.util.Scanner; public class CelsiusToFahrenheit { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Degree in Celsius:"); double Celsius = input.nextDouble(); double Fahrenheit = (9/5)* Celsius + 32; System.out.println("Degree in Celsius " + Celsius +"is" + (9/5) * Celsius + 32 + "Degrees Fahrenheit"); } } For this I keep getting an error that says "CelsiustoFahrenheit.java:7: class CelsiusToFahrenheit is public, should be declared in a file named CelsiusToFahrenheit.java public class CelsiusToFahrenheit { ^ This is beginning java so I am pretty much clueless as to what I have done wrong here.... 2nd Error that I was getting before the previous error started was + Show Spoiler + Exception in thread"main"java.lang.noclassdeffounderror: Celsius/java Caused by: java.lang.classnotfoundexception: Celsius.java at java.net.URLClassloader$1.run(URLClassloader.java:202> Keeps listing several java.net/security lines after this . ONLY NEED HELP ON 2nd ERROR NOW | ||
teamamerica
United States958 Posts
So Celsius and Farenheit should be celsius and farenheit. | ||
![]()
MasterOfChaos
Germany2896 Posts
| ||
AkaHenchway
United States41 Posts
| ||
One Student
73 Posts
On June 12 2011 17:41 AkaHenchway wrote: Thanks guys I figured it out right after I posted so just need help on the second error now which I dont get when I compile, but get it when I try to run it out of cmd. Can you tell us which editor program you are using to write and compile the code. I think the problem is with setting up the classpath to the JDK profile in the editor. | ||
Mahs
Netherlands171 Posts
Your code runs fine for me, so the issue isn't in the code. With a few slight adjustments in it, it does exactly what you want from it: + Show Spoiler + import java.util.Scanner; public class CelsiusToFahrenheit { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Degree in Celsius: "); double celsius = input.nextDouble(); double fahrenheit = (9.0 / 5.0) * celsius + 32; System.out.println("Degrees in Celsius: " + celsius + "\nDegrees in Fahrenheit: " + fahrenheit); } } As for the error - it looks a bit awkward to me. Java is looking for a class called Celsius, which isn't called anywhere in the code. What is the filename that contains the above code? A file with the above code should be called CelsiusToFahrenheit.java. If you've named the file Celsius.java, you have to either change the filename, or change "public class CelsiusToFahrenheit" to "public class Celsius" within the code to match the filename. | ||
Pe[N]guiN
Canada48 Posts
c++: + Show Spoiler + virtual bisearch_simple_set& operator+=(T item){ if(cur_size == 0){ biSet[0] = item; cur_size++; return *this; } if(cur_size < max_size){ last = cur_size-1; first = 0; mid = (first + last) / 2; while(first <= last){ if (item > biSet[mid]) first = mid + 1; else if(item < biSet[mid]) last = mid - 1; else{ for(int i = cur_size; i > mid; i--){ biSet[i] = biSet[i-1]; } biSet[mid] = item; cur_size++; return *this; } mid = (first + last) / 2; } if(first == cur_size){ biSet[cur_size] = item; cur_size++; return *this; } else{ for(int i = cur_size; i > mid; i--){ biSet[i] = biSet[i-1]; } biSet[mid] = item; cur_size++; return *this; } } else cout << "There is no space for addition!" << endl; return *this; } edit: it's not a syntax error, i'm just getting a strange result when I have an array.. for instance with [18, 34, 45] and I add in 27, it gives me [27, 18, 34, 45]. | ||
HowitZer
United States1610 Posts
On June 08 2011 22:45 Wala.Revolution wrote: Usually I won't ask a simple question, but I got a final coming up so I must ask. My teacher told the class there would be a question of what file I/O (in C) could be used for. The class was cut short because she ran out of time after explaining a few function of file I/O. From what I gathered it's a simple access read/write function. So I was going to answer ("To revise everyone's grades) or something akin to that. Is there any special features of file I/O I should be aware of to answer the question appropriately? For maintaining a user preference file. When a user sets a global environment option the file gets written to with the name and value of the preference. When the application starts, it loads the file to get the preferences so the application returns to the state the user wants. | ||
Manit0u
Poland17187 Posts
On June 13 2011 08:00 Pe[N]guiN wrote: I'm using binary search to insert into an already sorted array, but I made a mistake somewhere in my code... I have been staring at it for a while, if anyone could give me a hand I would appreciate it. c++: + Show Spoiler +
Using the 'code' environment here can help others analyze your code easier. Just take a look how does it look in the spoiler I quoted (I've also changed your formatting a bit, you didn't have enough curly braces in my opinion, and things were piled up a bit too much. Still, I can't really help you here as I'm not really sure what this code is supposed to do (and I'm just starting C++, don't know yet how much different it is from C). Your code seems to be missing some parts too... WTF is *this? There's no declaration or definition of it anywhere in the code you posted. Also, can you really have an array with [0] size? If you want it empty you could just set its value to NULL or something. And another thing, you're assigning values to first, last, mid and other variables, but in no place in this code is their type mentioned... Edit: Why the hell are there smileys displayed in code environment? Does spoiler suppress it or something? | ||
fiskrens
Sweden196 Posts
On June 13 2011 11:02 Manit0u wrote: Your code seems to be missing some parts too... WTF is *this? There's no declaration or definition of it anywhere in the code you posted. Also, can you really have an array with [0] size? If you want it empty you could just set its value to NULL or something. The *this pointer is just returning the current object from the function. How do you know he's using an array with 0 size? He's just assigning values to the index which is 0 in the array. EDIT: You can have an array with 0 size too, forgot to mention that. | ||
Manit0u
Poland17187 Posts
On June 13 2011 11:49 fiskrens wrote: The *this pointer is just returning the current object from the function. How do you know he's using an array with 0 size? He's just assigning values to the index which is 0 in the array. EDIT: You can have an array with 0 size too, forgot to mention that. Oh, ok. I was dealing with some chars lately so my brain automatically assumed that something[0] was a 0-length char haha. EDIT: Also, that's why he should at least put the variable types in there. This code can be pretty ambiguous without them. | ||
| ||