|
![]() |
Yani Abela wrote:1) I have set the ID as an integer
2) an invalid input has been entered when a negative number or a decimal number is entered
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Yani Abela wrote:if the user enters 5.5 as the ID number, the program gives an error that the input is invalid.
Yani Abela wrote:thanks for your reply
to be honest I did not understand your reply very well.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Campbell Ritchie wrote:Don’t use an if else statement. Use a while loop.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:Oops. I put wrong code
![]()
Here is the one:
Yani Abela wrote:BUT id has to initalised. Is it good if I do it --> int id = sc.nextInt;
It’s a standard technique which people have to learn.Anayonkar Shivalkar wrote: . . .
That was elegant.
You’re welcomeThanks
This guy is skipping without a rope. At least, that's what this tiny ad said:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
|