Course Solutions Uncategorized (Solved) : Hi Written Program Run Difficulties Produce Error Message Input Letters Example User Key 9 Q34744437 . . . .

(Solved) : Hi Written Program Run Difficulties Produce Error Message Input Letters Example User Key 9 Q34744437 . . . .

 

<Java – validate data input>

Hi, I have written a program, it can run.

But I have difficulties to produce an error messageif the input are not letters, for example, if user key in”999999999″ or “995$&*”, how to show an errormessage?

Here is the program:

package assignment

import java.util.Scanner;

public class Assignment {

    public static void main(String[] args) {

     Scanner input = new Scanner(System.in);

    

       

     String phoneLetter; //accept phonenumber to key in as letters

     int i, mark, len; //’mark’ stores thelocation where a hyphen will be placed

     char c;

     Scanner kb = new Scanner (System.in);//taking input from keyboard

   

     do { //use do-while loop to accept thephoneNo with

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post