how to make a class and methods...and how to use oop.

..i want to learn how to make classes and methods using java

Page 1 of 1

5 Replies - 1859 Views - Last Post: 13 August 2008 - 08:33 PM Rate Topic: -----

#1 smile_myglitz08  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 31-July 08

how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 04:10 AM

hi?
I really want to know how to use OOp and I wanna know how to make classes and how to use methods in java. If u will be given this problem:


problem:
Create a Statistical Program with the following methods:
*enterInput()
*getCount()
*getMean()
*getMinimumNumber()
*getMaximumNumber()
the user can freely enter inputs(integer) but when it hits 0 the program will end its task.
Sample output:
Enter Integer:
1
5
8
0
Display Count: 3 //in count it will not include 0
Mean: 4.666667
Minimum: 1
Maximum: 8


I am just a beginner in java..thanks in advance:)

This post has been edited by smile_myglitz08: 13 August 2008 - 04:13 AM


Is This A Good Question/Topic? 0
  • +

Replies To: how to make a class and methods...and how to use oop.

#2 rgfirefly24  Icon User is offline

  • D.I.C Lover
  • member icon


Reputation: 284
  • View blog
  • Posts: 1,502
  • Joined: 07-April 08

Re: how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 04:19 AM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 smile_myglitz08  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 31-July 08

Re: how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 05:32 PM

View Postrgfirefly24, on 13 Aug, 2008 - 04:19 AM, said:

[rules][/rules]


well, thanks..ahmmnn,..I already had a simple code but am having a hard time in making classes..I'll just post my codes next time..
thanks for the reminder.Sorry if i disobey your policy in posting..
thanks again.
Was This Post Helpful? 0
  • +
  • -

#4 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 08:01 PM

View Postsmile_myglitz08, on 13 Aug, 2008 - 05:32 PM, said:

View Postrgfirefly24, on 13 Aug, 2008 - 04:19 AM, said:

[rules][/rules]


well, thanks..ahmmnn,..I already had a simple code but am having a hard time in making classes..I'll just post my codes next time..
thanks for the reminder.Sorry if i disobey your policy in posting..
thanks again.



I have a tutorial on the subject right here on </d.i.c>!

Designing Object Classes
Designing Static Classes

Beware, there are 2 big errors in my 2nd tutorial, the 3rd and 6th code boxes there, need to be edited. They need to look like this...

class OurMath
{
    // following line is only in the 6th code box
    static int five = 5;

    public static int addition(int first, int second)
    {
        int sum = first + second;

        return sum;
    }
}


And don't sweat about not posting your code the first time. Just be sure to post it when you need help, along with the errors you get. :D

This post has been edited by Locke37: 13 August 2008 - 08:03 PM

Was This Post Helpful? 0
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 08:30 PM

View PostLocke37, on 13 Aug, 2008 - 08:01 PM, said:

Beware, there are 2 big errors in my 2nd tutorial, the 3rd and 6th code boxes there, need to be edited. They need to look like this...


Can we have somebody to fix this ? Locke37 did you email that to an administrator ?
Was This Post Helpful? 0
  • +
  • -

#6 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: how to make a class and methods...and how to use oop.

Posted 13 August 2008 - 08:33 PM

View Postpbl, on 13 Aug, 2008 - 08:30 PM, said:

View PostLocke37, on 13 Aug, 2008 - 08:01 PM, said:

Beware, there are 2 big errors in my 2nd tutorial, the 3rd and 6th code boxes there, need to be edited. They need to look like this...


Can we have somebody to fix this ? Locke37 did you email that to an administrator ?


gabehabe was going to edit it, but he currently doesn't have internet, so he has to go to the library to get internet access, and that's just a hassle! :D

I could PM some admin about it. Depends on how long gabehabe's gonna take...

This post has been edited by Locke37: 13 August 2008 - 08:34 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1