3 Replies - 1740 Views - Last Post: 29 September 2005 - 07:17 PM Rate Topic: -----

#1 SWhockey98  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-September 05

How do I create/define my own class?

Posted 29 September 2005 - 09:37 AM

I am trying to create/define my own Java class for my Java course in school. I am not asking anyone here to write it for me, I am asking just to explain to me the basic template for writing it. I've already had 2 assignments using the JOptionPane, System, and scanner class. I'm somewhat familar with Int, Double, Long, and Short.

Our instructor wrote MainCoffee.java and our job is to write our own class to compute the total price of coffee bags ordered and cost of shipping the boxes. What do I need to declare to get going?


From looking at his code, he's got numLgBoxes, numMedBoxes, numSmBoxes, and totalPrice. I'm sure I'm going to need to incorporate these methods somehow in the code but I'm not sure. He told us to use the Math class (ceil) and using the mod (%) in our computations.


Any help would be much appreciated!

Thanks,

Sean

Attached File(s)


This post has been edited by SWhockey98: 29 September 2005 - 09:38 AM


Is This A Good Question/Topic? 0
  • +

Replies To: How do I create/define my own class?

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: How do I create/define my own class?

Posted 29 September 2005 - 10:14 AM

My apologies, but are you looking for the mechanics of creating a class in general, or one specifically for this assignment?
Was This Post Helpful? 0
  • +
  • -

#3 SWhockey98  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-September 05

Re: How do I create/define my own class?

Posted 29 September 2005 - 10:58 AM

I'm sorry I should have specified. I'm looking for the basic template for this particular assignment.



Sean
Was This Post Helpful? 0
  • +
  • -

#4 Fame Commeth  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 13-August 05

Re: How do I create/define my own class?

Posted 29 September 2005 - 07:17 PM

Well, I think the best way for you to learn would be to find a book, but you can follow some good examples here, and another, just for basic introduction to java and the syntax of the language here.

If you could be more specific about what you need to learn perhaps we could help you understand what you need to do a little better.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1