Mga lods baka pede patulong sa java

Status
Not open for further replies.

Alieson09

Forum Guru
pano gumawa ng random number??
1633231607478.webp
 
Madami ka pang aaralin niyan,

Yung concept ng try catch basic lang naman halos pareho lang naman sa concept ng if else.

Java Exceptions: You do not have permission to view the full content of this post. Log in or register now.
User-Defined Exceptions: You do not have permission to view the full content of this post. Log in or register now.

Based sa instruction kailangan mo gumawa ng 2 exceptions, one for too high and one for too low. At least 3 class ang kailangan mo sa activity na to.
 
Madami ka pang aaralin niyan,

Yung concept ng try catch basic lang naman halos pareho lang naman sa concept ng if else.

Java Exceptions: You do not have permission to view the full content of this post. Log in or register now.
User-Defined Exceptions: You do not have permission to view the full content of this post. Log in or register now.

Based sa instruction kailangan mo gumawa ng 2 exceptions, one for too high and one for too low. At least 3 class ang kailangan mo sa activity na to.
oww okie gets pero ako ba gaagawa ng tamang sagot??
 
mukang mahirap to huhuhu parang uml to maraming class??
Hindi naman, kailangan mo lang naman ng class para sa main at yung user-defined exception, pwede din naman iseparate sa ibang class yung pag gawa ng random number at pag check ng input, pero yung pinakakailangan lang naman talaga yung para sa exception and main class.
 
Hindi naman, kailangan mo lang naman ng class para sa main at yung user-defined exception, pwede din naman iseparate sa ibang class yung pag gawa ng random number at pag check ng input, pero yung pinakakailangan lang naman talaga yung para sa exception and main class.
lods baka pede ako makahingi ng hint tas dagdagan kona lang diko kasi masyado gets talaga magegets ko siya pag may code na dun kana malalaman kung ano maidagdag ko :(
 
lods baka pede ako makahingi ng hint tas dagdagan kona lang diko kasi masyado gets talaga magegets ko siya pag may code na dun kana malalaman kung ano maidagdag ko :(
Ano na ba yung nagawa mo? Yung pag gawa ng custom expection madali lang naman, yung pag generate ng random number madali din, ang problema mo lang naman ay yung pag implement nung exception. At least gawin mo muna yung kaya mong gawin.
 
Ano na ba yung nagawa mo? Yung pag gawa ng custom expection madali lang naman, yung pag generate ng random number madali din, ang problema mo lang naman ay yung pag implement nung exception. At least gawin mo muna yung kaya mong gawin.
san ko ilalaga lods ung random ?? medj diko talaga gets
 
Okie lods bali ung binigay mo na code kanina yun yong ilalagay??
Oo mag gegenerate na yun ng whole number from 1 to 50. Kailangan mo nalang gumawa ng custom exception to handle out of range input then yung para sa letter or non-numerical value may built in ng exception si Java which is InputMismatchException.

You need two more variables, one for attempt count and one to trigger a loop.

You also need while loop to keep the program running when you enter the wrong value.

You need try-catch to handle exceptions. Two catch blocks for two exceptions.

Yan lang kailangan mo then tapos na activity mo.

 
Oo mag gegenerate na yun ng whole number from 1 to 50. Kailangan mo nalang gumawa ng custom exception to handle out of range input then yung para sa letter or non-numerical value may built in ng exception si Java which is InputMismatchException.

You need two more variables, one for attempt count and one to trigger a loop.

You also need while loop to keep the program running when you enter the wrong value.

You need try-catch to handle exceptions.

Yan lang kailangan mo then tapos na activity mo.

View attachment 1649611
Ayun salamat lods may pag babasehan nako pede ako makahinhi nung simula ng code?? Kahit yung unang system.out lang lods tas try ko kumpletuhin lang yung may kasama sana na variables
 
Ayun salamat lods may pag babasehan nako pede ako makahinhi nung simula ng code?? Kahit yung unang system.out lang lods tas try ko kumpletuhin lang yung may kasama sana na variables
Gawin mo lang base sa instruction magagawa mo yan.

(Assuming you already have the custom exception.)

1. Create a random number. (Binigay ko na.)
2. Declare variables for attempt count and loop trigger.
3. Create while loop.
4. Inside while loop create try-catch block.
5. Inside try block ask the user for input, then use if else-if to match the needed exceptions. If input is out of range throw an exception, if input is invalid throw an exception.
6. Inside catch block display the relevant message depending on the exception. (You need two catch block.)

Hinimay ko na kaya mo na yan. Effort, use google, use youtube. Mas rewarding pag na solve mo na alam mo na pinaghirapan mo.
 
Status
Not open for further replies.

About this Thread

  • 20
    Replies
  • 835
    Views
  • 3
    Participants
Last reply from:
Alieson09

Online now

Members online
1,005
Guests online
721
Total visitors
1,726

Forum statistics

Threads
2,276,959
Posts
28,973,344
Members
1,229,665
Latest member
hellowwolrd
Back
Top