January 14, 2025, 02:33:18 PM

1,531,385 Posts in 46,736 Topics by 1,523 Members
› View the most recent posts on the forum.


aren't you proud of me Boyah?

Started by Sam, October 27, 2009, 09:24:37 AM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Go Down

Sam

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;
1.8mb is too huge for a sig nigga

Thyme

Code Select
window.alert("yes sam i'm proud of you n_u");

YPrrrr

Er... well congrats again on passing. I have no idea what you learned to do though

ME##

Your professor must have liked you?  n_u

Daddy

You learned to initialize null variables and create a constructor?  akudood;

Sam

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;
1.8mb is too huge for a sig nigga

Daddy

October 27, 2009, 10:27:32 AM #6 Last Edit: October 27, 2009, 10:34:35 AM by Ensign Halibar
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;
}

Andria

its like you guys are speaking another language baddood;

anyways grats on getting a c instead of an f

Sam

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.
1.8mb is too huge for a sig nigga

Daddy

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

Sam

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.
1.8mb is too huge for a sig nigga

Mando Pandango

I remember when I understood basic Java. Ah, to be young again.
Quote from: Magyarorszag on August 22, 2018, 10:27:46 PMjesus absolute shitdicking christ, nu-boyah

Sam

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(){
  }                         
}
1.8mb is too huge for a sig nigga

Travis

i don't know a god damn thing about programming

Daddy

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

Go Up