Skip to content
Advertisement

Tag: java.util.scanner

Java validation vehicle registration

I’m trying to do a simple validation for vehicle registration number. It must include “-” Dash/Hyphen symbol. Example: BIR – 5698 It allows Numbers/Letters and Hyphen symbol only. All the other symbols are invalid. ( `~!@#$%^&*()_+=./;,<>”:|[]{} ) My code – Thank you. Your kind help highly appreciated. Answer I’m not sure if what you show as an example registration number

Verifying multiple tokens as Ints with Java

/* My goal is to use the terminal to receive 2 integers and add them together in a Java program. I need to confirm that both terminal entries are ints. If the are, I should proceed to add the ints together. If not, I should print out “Invalid input entered. Terminating…” I am trying to use an if statement with

Scanner for hex-input not working as expected inside loop

I need to solve this problem where i need to convert hexadecimal numbers to decimals. Issue I have compiled it without any errors, but my output came out wrong. Can someone show how to fix these errors? Code Example Input: Expected Output: Output that i got: Answer Your solution is close. Here are changes to make so that it runs

Advertisement