🔒 Closed Paano po pagsamahin yung scanner at inheritance sa isang program?

Status
Not open for further replies.

najamjam

Fanatic
Paano ko po ma-aapply yung scanner habang gumagamit rin ng inheritance? Mostly po kasi nakikita ko may given na, eh dito need mag add yung 10, 100, 1000 sa user input like diyan for example 20 yung input, tapos lalabas yung 20 plus 10 is 30 and so on.. sinubukan ko na yung mga nakita ko and meron din ako nakita dito na sinagutan 'tong same activity kaso walang inheritance na ginamit so gusto ko po malaman kung paano ginagawa pag may scanner at inheritance.

comprog 2 labexer1b.webp
 
gawa ka lng ng method sa main class.
ex.
showNumberPlus10(Int a, int b , int c) {
// do your operation & return/print result.
c = a + b
}

di naman sinabi na gumawa ka ng classes kya simplify lng. tatawagin mo lng yung showNumberPlus10 pra ma perform ang operation.

How to use?
showNumberPlus10(1, 2, 3);
prang ganito lng.
 
gawa ka lng ng method sa main class.
ex.
showNumberPlus10(Int a, int b , int c) {
// do your operation & return/print result.
c = a + b
}

di naman sinabi na gumawa ka ng classes kya simplify lng. tatawagin mo lng yung showNumberPlus10 pra ma perform ang operation.

How to use?
showNumberPlus10(1, 2, 3);
prang ganito lng.
hindi ko pa rin po maintindihan kung paano yung gagawin huhu
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 1K
    Views
  • 3
    Participants
Last reply from:
vhin le

Trending Topics

Online now

Members online
988
Guests online
1,305
Total visitors
2,293

Forum statistics

Threads
2,272,300
Posts
28,941,855
Members
1,237,133
Latest member
dijdjsjdnxbf
Back
Top