Computer Science Canada Millionaire Project |
| Author: | rto [ Wed Oct 08, 2008 10:39 am ] | ||
| Post subject: | Millionaire Project | ||
By no means is my code going to be flawless but it works as of right now. i have to add in the 3 lifelines but i want it so that once one is used, it will not be available for a second use. Please help if you can, critism (unless constructive) is not helpful
|
|||
| Author: | S_Grimm [ Wed Oct 08, 2008 11:31 am ] |
| Post subject: | RE:Millionaire Project |
int 5050count = 0; int phoneafriendcount = 0; int asktheaudiencecount =0; if (answer.equals("lifeline")){ System.out.println ("What lifeline do you want to use?") answer = input.readLine(); if (answer.equals (5050)) && (5050count == 0) { //code for taking away 2 wrong aswers } //repeat for other 2 lifelines and if counts = 1 then have an error message displayed (ie. you already used that lifeline) |
|
| Author: | chrisbrown [ Wed Oct 08, 2008 12:12 pm ] |
| Post subject: | RE:Millionaire Project |
For your $400 question, its petabyte, not pentabyte. Just pointing that out |
|
| Author: | Insectoid [ Wed Oct 08, 2008 12:27 pm ] |
| Post subject: | RE:Millionaire Project |
Yay! I did it with no errors! Anywho, Would it not be possible to have a class for questions, then make objects of the actual questions? or a method where you sub in the question, answers, and whatever, and just have it do the calculations. Yes, I know, I explained it horridly, but that is because I have forgotten the terminology. |
|
| Author: | S_Grimm [ Thu Oct 09, 2008 7:48 am ] |
| Post subject: | RE:Millionaire Project |
he still wants LIFELINES not questions. |
|
| Author: | rto [ Thu Oct 09, 2008 7:51 am ] |
| Post subject: | RE:Millionaire Project |
thanks methodox your right and insectoid its because your incredible lmao . A\V is correct however, any ideas how to put lifelines in there? i put a comment at the top for my ideas but im not sure if that will work or not |
|
| Author: | Insectoid [ Thu Oct 09, 2008 11:34 am ] |
| Post subject: | RE:Millionaire Project |
Oh, Well, I put that in there because I figured you could shrink the code by...a lot. |
|
| Author: | wtd [ Thu Oct 09, 2008 11:52 am ] |
| Post subject: | RE:Millionaire Project |
Insectoid is right. Especially given that this is Java, you should model the questions as objects, and just have a collection of them. |
|
| Author: | rto [ Fri Oct 10, 2008 7:37 am ] |
| Post subject: | Re: Millionaire Project |
To be quite honest guys, im really new to java. Just trying to self teach myself out of a book right now (Java for AP Computer Science), and i havent quite gotten to the making new classes / methods section |
|
| Author: | jbking [ Fri Oct 10, 2008 9:56 am ] |
| Post subject: | RE:Millionaire Project |
My guess would be to think about how do you want the user to communicate, "I want to use a lifeline," in the program. For example, here are a couple of ideas on how this could be done: 1) Each question comes with 2 parts. The first asks if you want to use a lifeline here and then which one if so. 2) Each answer can take a 1-3 value for the lifeline to use and check against some small array to see if that has been used, e.g. lifeline[0] for 50/50, lifeline[1] for Phone a friend, lifeline[2] for Ask the Audience. Note here that this is slightly different in terms of how the logic is coming in since you may have someone try to use a lifeline just by putting in the same digit repeatedly. My suggestion is to think about how do you want the user to use their lifelines in terms of the input and then figure out the details of what the program has to track. |
|
| Author: | wtd [ Fri Oct 10, 2008 10:54 am ] |
| Post subject: | RE:Millionaire Project |
http://wiki.compsci.ca/index.php?title=Introduction_To_Java This covers creation of classes and methods very early on. |
|
| Author: | S_Grimm [ Fri Oct 10, 2008 11:28 am ] |
| Post subject: | RE:Millionaire Project |
wtd, no offense, but he doesn't want to use methods and classes. He wants to be able to come up with a lifeline option using the existing code. |
|
| Author: | wtd [ Fri Oct 10, 2008 11:50 am ] |
| Post subject: | RE:Millionaire Project |
He needs to, especially if there's no one holding him back. Classes and methods are the very core fundamental way that code in Java is organized. They cannot be an afterthought. |
|
| Author: | S_Grimm [ Sun Oct 12, 2008 12:14 pm ] |
| Post subject: | RE:Millionaire Project |
the teacher really doesn't want us "Jumping the gun" this year. Last year, half the class was so far ahead that he had to stop giving work to us in order for the rest to catch up. this year he wants to explain everything and go through it all with us, instead of us teaching ourselves. but i think that the idea of putting everything in classes and methods is very similar to turings procedures, no? whatever is inside the method can be called later on in the program? |
|
| Author: | wtd [ Sun Oct 12, 2008 12:54 pm ] |
| Post subject: | RE:Millionaire Project |
That's a decent way to start looking at it. |
|
| Author: | rto [ Sun Oct 12, 2008 8:17 pm ] |
| Post subject: | RE:Millionaire Project |
ok im gonna skip ahead and look at the creating methods / classes in my book sometime within the next week |
|