I somehow managed to pass my Computer Science class with a C despite my grade being a 51. Magic. So now I have the privilege of taking another CS class. Look what I learned to do!
Quote//the reciept for a coffee sale
class Coffee {
String kind;
int price; // cents per pound
int weight; // pounds
Coffee(String kind, int price, int weight){
this.kind = kind;
this.price = price;
this.weight = weight;
}
}
I am unstoppable. wariodood;
window.alert("yes sam i'm proud of you n_u");
Er... well congrats again on passing. I have no idea what you learned to do though
Your professor must have liked you? n_u
You learned to initialize null variables and create a constructor? akudood;
Quote from: Ensign Halibar on October 27, 2009, 09:42:46 AM
You learned to initialize null variables and create a constructor? akudood;
yes? n_u
how do I create instances for this? I am lost. baddood;
Quote from: Sam on October 27, 2009, 10:15:16 AM
yes? n_u
how do I create instances for this? I am lost. baddood;
uh i haven't really worked with classes in c but in java ou'd do something like
Coffee espresso = new Coffee("Espresso", 15, 1);
then if you had other methods in that class you could do like
espresso.addDiscount(10);
or
espresso.addFlavor("Hipster Deluxe");
Also you might have get or set methods idklol
espresso.getPrice();
inwich you have a function like
getPrice()
{
return price;
}
its like you guys are speaking another language baddood;
anyways grats on getting a c instead of an f
Quote from: Ensign Halibar on October 27, 2009, 10:27:32 AM
uh i haven't really worked with classes in c but in java ou'd do something like
Coffee espresso = new Coffee("Espresso", 15, 1);
then if you had other methods in that class you could do like
espresso.addDiscount(10);
or
espresso.addFlavor("Hipster Deluxe");
Also you might have get or set methods idklol
espresso.getPrice();
inwich you have a function like
getPrice()
{
return price;
}
That's what I've been trying to do but it doesn't work.
BAH.
Quote from: Sam on October 27, 2009, 10:55:11 AM
That's what I've been trying to do but it doesn't work.
BAH.
Are you using actual C or C#/C++ because iirc c isn't really greatly supportive of oop.
do you have a link to a lesson or anything
Quote from: Ensign Halibar on October 27, 2009, 11:08:54 AM
Are you using actual C or C#/C++ because iirc c isn't really greatly supportive of oop.
do you have a link to a lesson or anything
wait, what? I'm using java, sillycakes.
I remember when I understood basic Java. Ah, to be young again.
OH HEY I FIGURED OUT WHAT I WAS TRYING TO DO.
//collect examples of coffee sales
class CoffeeExamples {
Coffee kona = new Coffee("Kona",2095,100);
Coffee ethi = new Coffee("Ethiopian",800,1000);
Coffee colo = new Coffee("Colombian",950,20);
CoffeeExamples(){
}
}
i don't know a god damn thing about programming
Quote from: Sam on October 27, 2009, 11:10:27 AM
wait, what? I'm using java, sillycakes.
oh i read the grade c as the language.
Quote from: Sam on October 27, 2009, 11:13:36 AM
OH HEY I FIGURED OUT WHAT I WAS TRYING TO DO.
//collect examples of coffee sales
class CoffeeExamples {
Coffee kona = new Coffee("Kona",2095,100);
Coffee ethi = new Coffee("Ethiopian",800,1000);
Coffee colo = new Coffee("Colombian",950,20);
CoffeeExamples(){
}
}
yayyyyyyyyyyyyyyyyyy
where's your constructor
Quote from: Travis on October 27, 2009, 11:14:26 AM
i don't know a god damn thing about programming
i have a barely basic grasp of visual basic .NET :D
also james for my homework it was n.toFixed(2) fuck you :'(
Quote from: Nyerp on October 27, 2009, 01:05:06 PM
i have a barely basic grasp of visual basic .NET :D
:D
Quote from: Nyerp on October 27, 2009, 01:05:06 PM
i have a barely basic grasp of visual basic .NET :D
I don't even know what you're talking about! :D
I actually thought about being a computer science major for a few days. Then I woke up and remembered that I hate math.
Quote from: Ensign Halibar on October 27, 2009, 11:50:35 AM
oh i read the grade c as the language. yayyyyyyyyyyyyyyyyyy
where's your constructor
um
you tell me
Quote from: Sam on October 28, 2009, 07:23:25 AM
um
you tell me
idk did you not show me it where is the entire code of that file akudood;
//dicks; 8=====D;,()}
}
}