From: Ember Kata <ember.kata_at_gmail.com>

Date: Sun, 13 May 2007 03:11:24 -0700 (PDT)

Date: Sun, 13 May 2007 03:11:24 -0700 (PDT)

My task is to create an object class for triangles. I have made a function:

triangle<- function(a,b,gamma) {

c <- sqrt (a^2+b^2-2*a*b*cos(gamma/180*pi))
beta <- (acos((a^2+c^2-b^2)/(2*a*c)))/pi*180
alfa <- 180-(beta+gamma)

T <- (a*b*sin(gamma/180*pi))/2

K <- a+b+c

cat ('side of triangle: ',a,b,c,'\n',

'degree of triangle: ',alfa,beta,gamma,'\n',
'perimeter: ',K,'area:', T)}

But this is only a simple function without object or class. Can you help me, how I can make an object class for triangles from this?

Thanks,

Ember Kata

-- View this message in context: http://www.nabble.com/object-class-for-triangles-tf3734550.html#a10453594 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help_at_stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.Received on Sun 13 May 2007 - 10:13:58 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Sun 13 May 2007 - 13:31:31 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*