Jump to content
xisto Community

Jeune

Members
  • Content Count

    105
  • Joined

  • Last visited

Everything posted by Jeune

  1. I want to create an array of type Cards. Is this the right way of doing it? Card decker[];decker = new Card[5]; I always get the error DeckofCards: java:47: missing return statement whenever I compile this.
  2. I agree with beeseven. The Deitel and Deitel book is the probably the best to use if you want to learn Java. I don't know anything about the Java for Dummies book but based from the title I guess if you don't have any background in programming, I recommend you go with the Java for Dummies book. Deitel and Deitel books are pretty inscrutable for starting programmers. I tried learning Java in high school using Deitel and Deitel and completely did not understand anything I was reading. For instance, I found it hard, as a starting programmer - someone with no prior experience in programming, to understand his explanation in first part (chapter 2 I think) on why you have to use the static method in java applications. The thing is, if you're the type who does not just accept some fundamental things as they are taught to you, it would be hard to understand the next few chapters which are built on the fundamental things you learn in the first few lessons. It's just now that I am in college, more than 3 years since I first tried to learn java, that I understood what actually going on. Just a note. I am using Sun's compiler javac and jvm to compile and run my programs. you can download it from the sun website (just google it, I don't know the exact address).
  3. It's what you call the triumph of marketing over substance. The people who coined the term football to american football must have probably thought of banking on the popularity of soccer. It's what javscript did to java when the latter was still new. I agree. Some sports games like basketball have timeouts and it breaks the momentum of one team. I hate it because it just shows how incapable the other team is in going back into the game. If the momentum is not on your side, then get the running and start concentrating! I thinking CALLING TIMEOUTS are COWARDLY. I love watching the big football(not american football) games, mostly the Champion's League. The premier league is good to watch too (e.g Liverpool-Chelsea or some of the ManU games.) I wish they would broadcast the bundesliga in my country. Geez
  4. for instance, we enter no line at all for the first line. IN general form that would mean, 0x +0y +0 =0 or in slope intercept form: 0y =0x +b. But the requires that the inputs be coefficients in general form so, Enter the coefficients A,B and C of the first line: 0 0 0 if we do the same for the second line, Enter the coefficients A,B and C of the second line: 0 0 0 the output would be The first line does not exist. There is no slope and y-intercept to compute. The second line does not exist. There is no slope and y-intercept to compute. Obviously there is no intersection. cheers.
  5. Hi guys. I just finished my programming homework. It's a program that gets the coefficients A,B, and C of two lines in general form and computes for the (1) Slope of each line (2) y-intercept of each line (3) and their intersections (if there are any) I know it's quite trivial but it's a homework and I need help in making sure the algorithm works for all cases. For me, the hardest part is the third one where you have to get the intersections. Here are some cases I came up with: No lines at all Parallel Lines Perpendicular Lines First line is non-existent Second line is non-existent Normal case(there is an intersection) Can somebody, well if you have time to spare of course, be kind enough to help me try to test the program to see if there are any bugs? It's pretty simple. Just type in all the possible cases you know and see if the output of the program is correct. I have tried all the cases I know and as far as they are concerned, the program is ok. Thanks and best wishes this holiday season. This is my code btw: /* Author: Jose Luis Roberto Asuncion Section: G-4L Date: 21/12/05 10:13am Description: Given the coefficients of two lines in general form, this program computes for their slope, y-intercept and intersection. */#include "stdio.h"main() { float A,B,C; /* coefficents of 1st line */ float D,E,F; /* coefficients of 2nd line */ printf("\nEnter the coefficents"); printf(" A,B and C of the first line:"); printf("\n(press enter after each coefficient)\n\n"); scanf("%f %f %f",&A,&B,&C); printf("\nEnter the coefficents"); printf(" A,B and C of the second line:"); printf("\n(press enter after each coefficient)\n\n"); scanf("%f %f %f",&D,&E,&F); printf("\n"); /* Compute for the slope of the first line */ if ((A==0) && (B!=0)) /* Instance of a horizontal line where A=0 and B!=0 */ { printf("The slope of the first line is 0"); } else if (B==0) { if (A!=0) /* instance of a vertical line where A!=0 and B==0 */ printf("The slope of the first line is undefined"); else /* instance where the user entered A==0 and B==0 */ printf("\nThe first line does not exist. There is no slope"); } else { /* instance where the user entered some number other than 0 for each coefficient */ printf("The slope of the first line is %1.1f",(-1*A)/B); } /* Compute for the Y-intercept of the first line */ if ((A==0) && (B!=0)) /* instance when the line is a horizontal line */ printf(" and the y-intercept is %1.1f",(-1*C)/B); else if (B==0) /* instance when B=0, triggering a vertical line... */ { if ((C==0) && (A!=0)) /* that either coincides with the y-axis */ { printf(" and is conincidental to the y-axis."); printf(" and thus, has infinitely many y-intercepts"); } else if (A!=0) /* or is a vertical line somewhere on the plane */ printf(", is a vertical line and does not have a y-intercept."); else /* instance where there is no line because A and B is 0*/ printf(" and no y-intercept to compute"); } else /* instance where the user entered some number other than 0 for each coefficient */ printf(" and has a y-intercept of %1.1f",(-1*C)/B); printf("\n"); /* Compute for the slope of the second line */ if ((D==0) && (E!=0)) /* instance of a horizontal line */ { printf("The slope of the second line is 0"); } else if (E==0) /* instance of a vertical line */ { if (D!=0) /* instance of a vertical line somewhere on the plane */ printf("The slope of the second line is undefined"); else /* instance where there is no line at all bec. D & E is 0 */ printf("The second line does not exist. There is no slope"); } else /* instance where the user entered some number other than 0 for each coefficient */ { printf("The slope of the second line is %1.1f",(-1*D)/E); } /* compute for the y-intercept of the second line */ if ((D==0) && (E!=0)) /* instance of a horizontal line */ printf(" the y-intercept is %1.1f",(-1*F)/E); else if (E==0) { if ((F==0) && (D!=0)) /* instance when the line coincides with the y-axis*/ { printf(" and is coincidental to the y-axis."); printf(" and thus, has infinitely many y-intercepts"); } else if (D!=0) /* instance of a vertical line somewhere on the plane */ printf(", is a vertical line and does not have a y-intercept."); else /* instance when there is no line because A is 0 */ printf(" and no y-intercept to compute"); } else /* instance when the user entered some number other than 0 for each coefficient */ printf(" and has a y-intercept of %1.1f",(-1*F)/E); printf("\n"); float Det, DetX,DetY,X,Y; /* declare variables for use in Cramer's rule*/ Det = (A*E)-(B*D); /* Equation to get the Determinant */ DetX = -1*C*E - (-1*F)*B; /* Equation to get the Determinant of X*/ DetY = -1*A*F - (-1*C)*D; /* Equation to get the Determinant of Y*/ X = DetX/Det; /* Equation to get X */ Y = DetY/Det; /* Equation to get Y */ /* In some cases, the determinant may be zero and Cramer's rule cannot be employed to solve for the intersection. In this case the lines may be parallel, coincidental, either or both non existent. */ if (Det==0) { /* assuming that C and F are both not zero, this is a special instance of two parallel lines that are either horizontal or vertical but not both of course */ if (((A==0)&&(D==0) || (B==0)&&(E==0)) && !((A==0)&&(D==0) && (B==0)&&(E==0)) && ((C!=0)&&(F!=0)) && (C!=F)) { if ((A==0)&&(D==0)) /* instance of a horizontal line */ { printf("There is no intersection because the two lines are parallel"); printf("\nThey are both horizontal lines."); } else /* instance of a vertical line */ { printf("There is no intersection because the two lines are parallel"); printf("\nThey are both vertical lines."); } } /* instance where one of the lines is non-existent */ else if ((((A==0) && (B==0)) || ((D==0) && (E==0))) && !(((A==0) && (B==0)) && ((D==0) && (E==0)))) { if ((A==0)&&(B==0)) /* instance where the first line is non-existent */ printf("There is no intersection because the first line is non-existent"); else /* instance where the second line is non-existent */ printf("There is no intersection because the second line is non-existent"); } else if (((A==0) && (B==0)) && ((D==0) && (E==0))) { /* instance where the coefficients entered do not determine a line */ printf("Obviously there is no intersection"); } else if (((-1*A/B)==(-1*D/E)) && (-1*C/B!=-1*F/E)) /* regular instance when the lines are parallel */ { printf("There is no intersection because the two lines are parallel"); } else /* instance where the lines coincide */ printf("The lines are coincidental"); } else /* instance when the user entered some number other than 0 for each coefficient */ { /* or when the determinant is not equal to 0 */ printf("The two lines intersect at the point (%1.1f,%1.1f)",X, Y); /* instance of perpendicular lines */ if ((X==-1*C) && (Y==-1*F)) printf("\nThey are perpendicular lines"); if((-1*A)/B==((-1*D)/E)*-1) printf("\nThey are perpendicular lines"); } printf("\n"); }
  6. I see you have a fast computer but I guess you are not able to exploit its full potential because you have only 256 mb of memory. Try to buy more memory OR press CTRL + ALT + DELETE and see if there are any dubious processes eating up your memory. Windows processes, among others, are svchost.exe, explorer.exe. Look up each process on google and you usually get a process information from one of the anti-spyware software websites. You can remove dubious processes by going to the registry and deleting their entries. Assuming that you're using Windows, go to Start >> Run >> type Regedit >> hkey current user >> Software >> microsoft >> windows >> run / runOnce I once had this Zango program eating more than half of my memory and I had to literally fight it by pressing the end task button repeatedly. If that's too tedious for you or if it just doesn't work, I suggest you start formatting your computer and buy yourself a durable firewall. Most of those useless memory eating processes come from the internet you know. Cheers Dude!
  7. Interesting discovery switch. Someone also told me that but I couldn't quite make out what he was saying. I'll work on it when I get back home. Thanks a million!
  8. tried that already. I still get the same result. I have a more complicated program that I already finished. The only thing I havent figured out is this part, asking if the user wants to try again. I wrote a much simpler task before the try again part just to ilustrate that I want the program to do a task then ask if the user wants to try it again. So any more ideas?
  9. Hi guys! I need help with a simple C program I am doing. I want the program to do something then ask the user if it wants to do it again. I used a do-while loop for this but as it comes out it's either a bug or there's something I really need to know. Here is my code btw: #include <stdio.h>main() { char a='y'; int b; do { printf("\nEnter a number: "); scanf("%d",&b); printf("You entered %d\n\n",b); printf("try again? (y/n): "); scanf("%c",&a); printf("\n"); } while (a!='n');} I have a problem with my code and it this is what happens: Enter a number: 5 You entered 5 try again?(y/n): Enter a number: _ <---------- cursor It does not ask if the user tries again. Instead, it goes directly to asking the user too input a new number. Has anyone encountered this problem before? I really need help. Thanks
  10. My dad has a Nokia communicator, that phone which looks like a small laptop, and so I tried to look at my My Webpagewith it. The communicator uses the Opera browser and as it turned out, my javascript, a counter that counts how many days before my birthday and christmas didn't display the number of days correctly. So while I am trying to discover how it will wok in Opera, I would barr people using Opera browsers from my site. Problem is I don't know Opera's appname. Can anybody tell my what it is? My code will looke like this if (navigator.appName="Whatever Opera's app name is") { my code etc etc; } I know internet explorer's appName is Microsoft Internet Explorer and Firefox's is Netscape. Is Opera's appName Opera?
  11. I thought it was 8 hours? Furthermore, sleeping reduces your sleep debt. I learned this in my Psychology 1 class. Whenver you don't get enough sleep everyday that is incremented to a counter called your sleep debt. And the more it accumulates the shorter your life is. Sometimes I have doubts about this but well at least that's my instructor said. It's also not true that those who sleep are lazy. In fact, I have a lot of classmates who while away their time and money playing Online games. I just can't help it. I can't sleep without a night light. My imagination is so wild! Great post. I learned something from it.
  12. I slept at 2 in the morning because of this. Yep. I did too. I was jumping all over my place like hell during the final 15 minutes or so. It was one pulsating encounter. But don't you think Darren Fletcher's goal was a bit lucky? I mean it looked like he wanted to pass the ball to Van Nistelrooy. I don't know. But one thing is for sure, it was a great match. I enjoyed it.
  13. All I can say is that he is a good coach. Good in the sense that he is very humble and judging by the looks of him and how he projects himself he seems really nice (Compare him to Mourinho too see what I mean.) I am little biased of course and I'd say I'd prefer Felix Magath over him.
  14. I agree with Chuya, there is such a thing as attraction at first sight. You meet someone and chack!, then you have a first impression that will most probably determine wheter you're interested in that someone or not. Besides, how can you genuinely love someone when you don't know him/her yet?
  15. I don't mind if the A.I is not that good or if the A.I can't shoot me well enough. What bothers me about realism is how the game runs as a whole. For instance, after clearing a room in the game(I swear I cleared that room and double checked it), a soldier or two spawns from nowhere and begins backstabbing you. That is such a downer if you ask me. I am sure the programmers can program the game to load all the A.I characters before hand or set up multpiple loading events within the game just like what happens in Half-Life where there are many instances within the game where the game program has to load once again. I don't think it will have a an effect on production factors such as budget or number of available Pro programmers.
  16. If I were you my priority ranking would like like this: 1. BS IT - 8 month's more isn't it? Give it all you have. 2a. Office - If you're supporting you're education through working in the office then I guess this would be next. This also includes keeping yourself updated. 2b. BS Computer Science - I assume you're still starting in this degree so the lessons won't be that hard yet. Besides, you can use some of your stock knowledge from BSIT. Don't get me wrong though, you need to have the same level of concentration for those two. 3. Family - look at spending time with your family as your rest period 4. Freelancing - You have a job right? You can leave this thing for a while and get back after you finish BSIT or both your courses. I don't know about you but this is what I am going to do. The way I see your case, you're going to have to push yourself really hard, as in no time should go to waste! The key, as is always and what a lot of people will probably tell you is efficient time management. Studying everyday is a must. But you don't have to study one subject in one sitting. For instance if you have to read 4 chapters for an IT exam two weeks from now. Divide the chapters into days. Spend 3 days each reading one chapter. Then the last two days should be spent to review the whole thing. Remember the 3Rs - Read, Recite, Review. But don't just study when you have an exam. Study even after the lecture and on the days leading towards the exam. Look at your notes or you book at least ten to two minutes everyday and go over the main concepts. This might sound boring and repetitive but you'll get to grasp what you're studying and know them by heart after a while. So when the exam comes you don't have to exert too much effort. Do the "Dividing a task into different time schedules" for all your other tasks (in the office, in BS IT) as well even for your rest time with your family. Always carry a: 1. A calendar for the month detailing all the things you need to do (the tasks) for each day of the month. That you way you know when to relax a little bit or you can accomodate unforseen events such as your friend had a birthday or something. 2. A "TO DO" list everyday even the ones not related to your work or studies like buying grocery or fetching your brother from school. That way you know how to divide the tasks alloted for each day. Always Remember 1. Don't do two things at the same time. Don't study while spending time with your family. Put yourself whole-heartedly in the "feeling" of the moment and relish it (or dread) it while it lasts. It seems you want to have a double degree, do work at the same time and some othe rthings. Then PAY THE PRICE! Yes even intangible things have (figurative) price tags with them. If you want to have them then better work hard to earn them. I know this might be a cliche to you but it always works and without it you don't stand a chance. Always aim for the sun dude and if you don't make it at least you'll find yourself on the moon. You get what I am saying? I don't know if this will help much but I hope it does.
  17. Thanks. I'll try to look it up in one of the stores near my place. I really hope it doesn't dissapoint. After all, I just want to do something to vent all my emotions on after a hectic day at school (I do study a lot). And with Medal of Honor, sometimes it just makes things worse or relatively ruins a good day.
  18. It's funny to see what people are trying to look-up on the internet. Reflects what most of us are up to these days.
  19. You have the lyrics, so I suggest you get some of the more famous lines of the song and look it up on google. It works for me whenever I hear a song that I like on the radio, I get some lines, usually the chorus, and save it on my cellphone or write it on a piece of paper. Then I type it on google's search box. More often than not, I get the lyrics of the song. But there are cases when there is more than one artist who sang the song, the original artist then someone who "revives" using his own rendition. If that happens try looking for song samples(still on google).
  20. I was disheartened because the Pokemon list kept on growing and I couldn't keep up with it anymore much less remember the each Pokemon's weaknesses by heart. Before the Silver-Crystal version, I knew what Pokemon to use for all my opponent's pokemon. For instance, I could beat Gyarados with a Pikachu or another electric type pokemon because I knew Gyradoses(?) were susceptible to electricity. I would always come up with a perfect, consistent lineup for the whole game to counter all the pokemons challengers had with them. Whew! Good old days.... Haha. Call me a pirate or something becasue I actually played most of the Pokemon game series on an emulator. In fact the reason why I started programming(Html etc) was because I wanted ot make my own Pokemon walkthru.
  21. I tried reading it a lot of times already but I never got past the part where he was on a planet and he meets this someone who asks a lot of questions. That's the chapter after the hat-looking or elephant-like boa constrictors he drew. I am postponing it for some other time. I don't think I have the right background to read it as of now and I admire those people who were able to appreciate when they were young.
  22. I was five years ago when I was 12 but I already outgrew it. I played almost all the version from blue to crystal and after that I stopped to doing more productive things like my website. My favorite lineup for the Blue - Yello series would always consist of: Raticate Pidgeot Bulbasur the other three would depend on what I thought would make my lineup better but all three would be present. I adopted the same strategy for the Silver - Crystal series. Only this time bayleef is bulbasur reborn. The lineup would consist of Raticate, Pidgeot and Bayleef. I would always make it a point to catch Red Gyarados so I could have a pokemon that could use Surf. But don't get me wrong Pokemon is an ace in my book and something I would always fondly look back on.
  23. I know this might not be up to date but I wanted to play a first person shooter after getting bored with Half-life 1 and Counter-Strike. So I bought Medal of Honor Allied Assault. I appreciate the graphics and everything else except for one thing, the A.I or whatever you call that thing that controls your enemies(controlled by the computer).Sometimes in the game I just see my A.I opponents pop out from no where. I think that's stupid because the game claims it simulates world war II conditions. Did it happen in the actual war that the Germans just appeared from nowhere in thin air? If EA wantes to make the game harder they should have just placed in more enemy soldiers beforehand while the game is loading and not let them pop out of nowhere from a room where you just killed everyone.
  24. I like the mp5 and the CT pistol although it's risky for me to use the latter because my hands are to shaky and I often press the right mouse button, which means I it will put on the silencer, while I am shooting the CT pistol. I never learned to use the AK effectively. I didn't get the hang of it.
  25. I live in the Philippines where our president popularized the line It is against the law to beg, and give alms." I saw it on one billboard sometime and I had second thoughts.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.