Thread: java help

  1. #1
    Unregistered
    Guest

    java help

    Hi??

    i have a problem in java...and i'm not quite sure how to solve it, and was wandering if anyone would be able to help me out here...

    i have started something but not sure what to do next.
    Here is the problem:

    Problem 1
    A program accepts identification number, first name, last name, and email address of a user. It validates the data as per following specifications:

    .identification number – no blanks, four numerical characters;
    .first name – no blanks, all alphabetical characters;
    .last name – same as for first name;
    .email address–
    .no blanks;
    .only one ‘@’character;
    ,there is at least one word before ‘@’, and at least two words after ‘@’, both words(following ‘@’) joined by ‘.’, no space between the words before and after the ‘.’ character.
    Assume that there are maximum of two words following ‘@’character, and there are maximum of 25 characters in the email address.

    If any of the data item is invalid, program displays an appropriate message to the user and asks for re-entry of that item.
    When all data items entered are valid, program creates a password for the user by joining:
    .first two characters of first name;
    .2nd and 3rd characters of identification
    .last three characters from the last name;
    in above order.
    Password is then relayed back to user. Later then enters this password and program then checks that user has entered the correct password (as created for him/her), and displays the message to the user accordingly.

    You do not need to create any special user interface but must utilize string and array processing functions

    and here is my source code so far.. if any one helpful enough could fix the program for me that would be much appreciated..thanks
    cheers, Atif.

    public class UserValidation {

    //declare variables
    private int id;
    private String firstname;
    private String lastname;
    private String email;

    private BufferedReader input = new BufferedReader // Handles console input
    (new InputStreamReader(System.in));

    public int getId() throws IOException{

    System.out.println("Input UserID:");

    id = Integer.parseInt(input.readLine());

    getId();
    }
    return id;
    }

    public String getfName(){

    return firstname;
    }

    public String getlName(){
    return lastname;
    }

    public String getEmail(){
    return id;
    }

    public void display(){

    System.out.println(" " + getId() + getfName() + getlName() + getEmail());
    }

    public static void main (String args[]){
    UserValidation user = new UserValidation();

    user.display();
    }
    }

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    19

    java help please?

    hello....is anyone going to help me out here????
    ive been waiting for ages...come on its not like im asking you to write the whole code for me, ive made an attempt myself but i want someone to help me out with what to do next..


    Cheers
    Atif

  3. #3
    it's a c/cpp/c# board... not so many java-fans, perhaps?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  2. First Java Class at college
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 09-29-2004, 10:38 PM
  3. The Java language is being expanded
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  4. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  5. C or Java as a first language
    By CorJava in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 10-23-2002, 05:12 PM