Results 1 to 4 of 4

Thread: Person Help

  1. #1
    fwolfe2011 is offline Member
    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Default Person Help

    enter code here Looking at code// If anyone can give me that proper coding that would be greatly appreciated --- I am having trouble with
    It doesn't ask if I want to enter employee or customer. C/E. after c or e is selected and then after entered it should repeat "" you entered
    First name
    Last name
    Email cust # - believe that should be random. enter code here

    enter code here

    Return for employee
    You entered
    First name
    Last name
    Email
    Social.

    Continue y or n.



    `enter code here`
    import java.util.Scanner;

    public class Practice {


    public static void main (String[] args) {

    System.out.println("Welcome to the Person Tester Application");
    System.out.println();

    Scanner sc = new Scanner(System.in);

    //See if user wants to continue.
    String choice = "y";
    while (choice.equalsIgnoreCase("y")){

    System.out.println("Create customer or employee (c/e): ");


    String menu = "c";
    if (menu.equalsIgnoreCase("c")){
    }

    System.out.println("Enter name: ");
    String fName = sc.next();
    System.out.println("Enter last name: ");
    String lName = sc.next();
    System.out.println("Enter Email");
    String eMail = sc.next();
    System.out.println("Enter Customer Number: ");
    String Number = sc.next();



    }}
    public static print();{

    }
    }



    abstract class Person{

    private String fName;
    private String lName;
    private String eMail;

    public String getfName() {
    return fName;
    }

    public void setfName(String fName) {
    this.fName = fName;
    }

    public String getlName() {
    return lName;
    }

    public void setlName(String lName) {
    this.lName = lName;
    }

    public String geteMail() {
    return eMail;
    }

    public void seteMail(String eMail) {
    this.eMail = eMail;
    }

    public String toString()


    {
    return "First Name: " + fName + "\n" +
    "Last Name: " + lName + "\n" +
    "emailAddress: " + eMail + "\n";
    }

    abstract void getDisplayText(String Number);
    }

    class Customer extends Person{
    private String Number;

    public String getNumber() {
    return Number;
    }
    public void setNumber(String Number) {
    this.Number = Number;
    }
    public Customer()
    {
    super();
    }
    public void getDisplayText(String Number)
    {
    Number = "";
    }
    public String toString()
    {
    return super.toString() + "Customer Number; ";
    }



    class Employee extends Person{

    private String Number;

    public String getNumber() {
    return Number;
    }
    public void setNumber(String Number) {
    this.Number =Number;
    }
    public Employee()
    {
    super();
    }
    public void getDisplayText(String Number)
    {
    Number = "";
    }
    public String toString()
    {
    return super.toString() + "Social Security Number; ";
    }
    }

    class Validator{
    }

    }

  2. #2
    LetsG0Blue is offline Member
    Join Date
    Feb 2013
    Posts
    68
    Rep Power
    0

    Default Re: Person Help

    You might be able to help me... How do you get the 'Continue y or n.' working? I just need to be able to have the user input y or n and then have the program repeat if the user puts 'y' or terminate if they put 'n'

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Person Help

    Quote Originally Posted by LetsG0Blue View Post
    You might be able to help me... How do you get the 'Continue y or n.' working? I just need to be able to have the user input y or n and then have the program repeat if the user puts 'y' or terminate if they put 'n'
    Please do not hijack someone else's question. Consider this a first warning of this type.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Person Help

    Quote Originally Posted by fwolfe2011 View Post
    enter code here Looking at code// If anyone can give me that proper coding that would be greatly appreciated --- I am having trouble with
    It doesn't ask if I want to enter employee or customer. C/E. after c or e is selected and then after entered it should repeat "" you entered
    Please clarify your question. Tell us the details about exactly what is and/or isn't working and what you're trying to do. Also, please use [code] [/code] tags when posting code so that it retains its formatting and is easier to read.

Similar Threads

  1. Why the program only display the first person name?
    By yyKHOR_1021@live.com in forum New To Java
    Replies: 2
    Last Post: 11-03-2012, 01:53 PM
  2. [Free] Looking for a skilled person
    By JohnnyL in forum Jobs Offered
    Replies: 0
    Last Post: 02-08-2011, 02:55 PM
  3. Replies: 1
    Last Post: 08-07-2007, 07:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •