• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

inheritance with static print method

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello i am writing a person tester application with the following functionality

1. user is prompted to enter name, email address and depending on the selection (customer or employee) social sec number or customer number.
2. the data is printed to the console

the application needs to have an abstract person class with an abstract getdisplayText() method and the person class needs to be extended by a customer class and an employee class which will either append a cusotmer number (if customer) or a social security number (if employee).

additionally the application needs to have a static print method that prints said data to the console.

i have build most of the application but am having trouble printing the data to the console, and not sure what im doing wrong please help! i have hit a wall.

this is my code


 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where in your code are you attempting to call the getDisplayText method for the Person instance?
 
vladimir mujakovic
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i wasnt sure which method to call, im new to working with inheritance, i tried calling the toString method with no result. when i tried calling the getDisplayText method i kept getting errors so i stopped trying. im not sure how to use the static print method to print out my data. thats the problem im facing
 
vladimir mujakovic
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need help please im still stuck
 
reply
    Bookmark Topic Watch Topic
  • New Topic