🔒 Closed Pa check naman po ng Java code ko. Thank you po.

Status
Not open for further replies.

PHC - NoName

Honorary Poster
Pa check naman po at pa tama po ayan pong nasa picture yung gagawin po at eto yung code kopo. Ang tanong kopo is pano kopo idadagdag jan yung square at operation class po na sinasabi. Thank you po.

class Operation{
int square(int n){
return n*n;
}
}

class Circle{
Operation op;//aggregation
double pi=3.14;

double area(int radius){
op=new Operation();
int rsquare=op.square(radius);//code reusability (i.e. delegates the method call).
return pi*rsquare;
}



public static void main(String args[]){
Circle c=new Circle();
double result=c.area(5);
System.out.println(result);
}
}

Screenshot_20220413_084440.webp
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 503
    Views
  • 1
    Participants
Last reply from:
PHC - NoName

Trending Topics

Online now

Members online
1,278
Guests online
4,207
Total visitors
5,485

Forum statistics

Threads
2,308,764
Posts
29,186,948
Members
1,191,199
Latest member
Burgir_niPapot
Back
Top