Inheritance Help

Hello,
I am extremely new to java and this is my first project!
I am working on an auction system that composes of 2 types of auction - Style 1 and Style 2.
The only real difference in the 2 styles is the Database Insert statement.
I would like an auction Super class with Style 1 and Style 2 inheritting features but am unable to achieve this,
Is anyone able to offer my and help/advice on this??
Thanks
//Create An Auction Style 1
  public Vector createStyle1(String itemName, String description,
                                     String reservePrice, String buyOutPrice,
                                     String startPrice, String auctionType, String userID, int timeLimit) throws
      ClassNotFoundException, SQLException, RemoteException {
    dbConnect();
    AuctionTimer timer  = new AuctionTimer();
      ResultSet results = null;
      String auctionID = new String();
      Statement statement = link.createStatement();
      Statement statement2 = link.createStatement();
      String startTime = new String();
       String finTime = new String();
       String finDate = new String();
  //Insert items into database (minus start / end time)
      statement.executeUpdate("INSERT INTO auction (ItemName, Description, AuctionType, CurrentPrice, BuyItNowPrice, StartPrice, SellerID, HighestBid, ReservePrice, AuctionComplete, HighestBidderID, SecondHighestBid) VALUES ('"+itemName+"','"+description+"','"+auctionType+"','"+startPrice+"','"+buyOutPrice+"','"+startPrice+"','"+userID+"',1,'"+reservePrice+"',0,0,1)");
      results = statement2.executeQuery("SELECT MAX(AuctionID) FROM auction");
      //get AuctionID
      while (results.next())
    auctionID = results.getString(1);
    //Start Timer for AuctionID + get start / end time
    try {
         timer.timer(auctionID, timeLimit);
         startTime = timer.getStartTime();
         finTime = timer.getFinTime();
         finDate = timer.getFinDate();
       catch (Exception ex) {
         System.out.println("Timer Error");
       //Insert Start / end time into Database for AuctionID
       statement.executeUpdate("UPDATE auction SET StartTime = '" + startTime +
                               "' WHERE AuctionID = " + auctionID);
       statement.executeUpdate("UPDATE auction SET EndTime = '" + finTime +
                               "' WHERE AuctionID = " + auctionID);
       statement.executeUpdate("UPDATE auction SET EndDate = '" + finDate +
                               "' WHERE AuctionID = " + auctionID);
       //get full auction back from database to display for user
       results = statement.executeQuery("SELECT * FROM auction WHERE AuctionID = " +
                                        auctionID);
      Vector row = new Vector<Object>();
      while (results.next())
          row.addElement(results.getString(1));
          row.addElement(results.getString(2));
          row.addElement(results.getString(3));
          row.addElement(results.getString(4));
          row.addElement(results.getTime(5));
          row.addElement(results.getTime(6));
          row.addElement(results.getString(7));
          row.addElement(results.getString(8));
          row.addElement(results.getString(9));
          row.addElement(results.getString(10));
          row.addElement(results.getString(11));
          row.addElement(results.getString(12));
          row.addElement(results.getString(13));
          row.addElement(results.getString(14));
          row.addElement(results.getString(15));
          row.addElement(results.getString(16));
      closeDown();
      return row;
//Create a Auction Style 2
  public Vector createStyle2(String itemName, String description,
                                     String reservePrice, String startPrice, String auctionType, String userID, int timeLimit) throws
      ClassNotFoundException, SQLException, RemoteException {
      dbConnect();
      AuctionTimer timer  = new AuctionTimer();
       ResultSet results = null;
       String auctionID = new String();
       Statement statement = link.createStatement();
       Statement statement2 = link.createStatement();
       String startTime = new String();
       String finTime = new String();
       String finDate = new String();
       //Insert items into database (minus start / end time)
       statement.executeUpdate("INSERT INTO auction (ItemName, Description, AuctionType, CurrentPrice, BuyItNowPrice, StartPrice, SellerID, HighestBid, ReservePrice, AuctionComplete, HighestBidderID, SecondHighestBid) VALUES ('"+itemName+"','"+description+"','"+auctionType+"','"+startPrice+"',0,'"+startPrice+"','"+userID+"','"+startPrice+"','"+reservePrice+"',0,0,'"+startPrice+"')");
       results = statement2.executeQuery("SELECT MAX(AuctionID) FROM auction");
     //get AuctionID
       while (results.next())
     auctionID = results.getString(1);
       //Start The Timer
       try {
         timer.timer(auctionID, timeLimit);
         startTime = timer.getStartTime();
         finTime = timer.getFinTime();
         finDate = timer.getFinDate();
       catch (Exception ex) {
         System.out.println("Error With Timer");
     //Insert Start / end time into Database for AuctionID
       statement.executeUpdate("UPDATE auction SET StartTime = '" + startTime +
                               "' WHERE AuctionID = " + auctionID);
       statement.executeUpdate("UPDATE auction SET EndTime = '" + finTime +
                               "' WHERE AuctionID = " + auctionID);
       statement.executeUpdate("UPDATE auction SET EndDate = '" + finDate +
                               "' WHERE AuctionID = " + auctionID);
       //get full auction back from database to display for user
     results = statement.executeQuery("SELECT * FROM auction WHERE AuctionID = " +auctionID);
       Vector row = new Vector<Object>();
       while (results.next())
           row.addElement(results.getString(1));
           row.addElement(results.getString(2));
           row.addElement(results.getString(3));
           row.addElement(results.getString(4));
           row.addElement(results.getTime(5));
           row.addElement(results.getTime(6));
           row.addElement(results.getString(7));
           row.addElement(results.getString(8));
           row.addElement(results.getString(9));
           row.addElement(results.getString(10));
           row.addElement(results.getString(11));
           row.addElement(results.getString(12));
           row.addElement(results.getString(13));
           row.addElement(results.getString(14));
           row.addElement(results.getString(15));
           row.addElement(results.getString(16));
       closeDown();
       return row;
  }

In order go get full inheritance, you have to have direct ancestry--If you have A extends B and C extends B and D extends B, then there is not a direct inheritance path from A, C, and D--in other words D is not guaranteed to contain all elements of A and C, but if A extends B, and C extends A, and D extends C: then C must contain all of the elements of A and C, further more, C contains all of the elements of A... as you requested in your topic to your OP.

Similar Messages

  • How to get the child class in inheritance?

    hi,
    if I have a store for renting videos .. and I have Video class (parent) and two (child) classes DVD and Cassete which they are extend the video class.
    And the user wants to rent a DVD which is the child, how do I do that? can I write just getDVD() as simple as that or maybe I need to use a keyword like "getinstance of DVD " or something I don't know how to do this.
    class Video have attributes like title, date of production and director.
    I'm not good in inheritance help please.
    thanks

    georgemc wrote:
    DrLaszloJamf wrote:
    Post a SSCCE: http://mindprod.com/jgloss/sscce.html
    You're not the boss of me ;-)Actually, I haven't stopped to count, but most of the time the poster never bothers to write a sample program. If fact, if I weren't such a softie, I would make that an absolute requirement for any further help. Too often, you are just shooting in the dark and 50 replies later the question is still vague.

  • Inheritance in BPEL

    Hi
    I would like to develop a BPEL process and customize is to several clients. It would be very helpful if there was a way to override some behavior in the derived process. Of course people will argue about:
    (1) Use functional decomposition. That is not the same as inheritance where you can override a small portion of something that already exists. I agree you still need foresight in order to make inheritance help you.
    (2) BPEL is based on XML and XML does not have inheritance. Again the software industry needs to solve this.
    Any comments ? Does anyone know whether future versions of BPEL will make things easier for handling such a scenario ?
    Thanks

    afaik: inherentance is not part of the BPEL standards, or even XML. I can not predict the future, but i would not expect inherentance on short term in BPEL.

  • I just inherited a 64GB ipad. I have passwords for the deceased person but would like to sync it with my mac osx.  Know nothing about ipads. Help please

    I just inherited a 64 GB ipad.  I have passwords for the deceased person but would like to reset everything and start new. I use a mac/0SX but know nothing about an ipad other than turning it on.  I am in the same household as the deceased person but does not seem to be recognizing the wireless setup.  Any help would be appreciated. Any recommendations as to where to start.

    That's really enough information. You can update this iPad to iOS 6.1.2. If there is a microphone icon next to the space bar on the keyboard, you have an iPad 3. But if you are saying that it hasn't been touched for over a year, it probably is not the iPad 3. The iPad 3 is one year old this week IIRC.
    If you want, you can go to Settings >General>About>Model to find the model number and it you Google that, you can find out which version of the iPad it is.
    I just wanted to see what iOS you would be able to update to. I'm not sure what else to tell you other than what we've already stated. You should set this up as new, update the iOS and then start all over again with you own iTunes content.
    The link that Eric posted would be a good place to start so that you can get an idea of what the iPad can do. If you want to restore the iPad back to factory settings, you will need to do this with iTunes on your Mac. You must be running OS X 10.6.8 at minimum and must be using iTunes 10.6.3 (I think) in order to syn with iTunes on the Mac.
    This explains how to restore to factory settings.
    http://support.apple.com/kb/ht1414
    if you are that uncomfortable trying to do this on your own, and if there is an Apple Store near you, make an appointment at an Apple Store Genius Bar and ask an Apple tech to help you with it. That is what they do. There is no charge for an Apple Store Genius Bar visit. The stores also offer classes for the iPad that you might find useful as well.

  • Help, how do i find out the host server for a website i have inherited

    hi i inherited responcibilty for a website, simply because
    there was noone else avalable. i have dreamweaver cs3, but only
    about 2 weeks worth of knowledge and experience. I was given info
    ie. ftp address and username etc, so have been able to download the
    website to my home computer, and have been making updates, now
    however i need to find out more about setting up a test server so i
    can use dynamic pages, specifically for collecting form
    information, collecting donations and selling art work. i will need
    some information from the host server to start with, but am unsure
    as how to identify and contact them, can anyone help me please. I
    am sure it is rudimentary, but the information is essential.
    also as a side note, could anyone tell me how to find out
    where the websites domain name is regestered ( other than
    contacting the original designer, as that seem quite impossible)
    because i get the feeling that if all else fails i may be able to
    move the website to another host ( not that i now how yet, or even
    how to select or find a host) please let me know if any of my
    assumptions are wrong.
    Thanking you in advance
    J
    volunteer.

    Hi,
    To find out about the host, go to register.com and look up
    the domain name.
    When it gives you results, it'll say that the name is already
    taken, but it
    will let you do a 'whois' on it.
    Those results can give you some info such as the server DNS.
    That may let
    you figure out the host.
    Sometimes the technical contact in the whois, is the host as
    well.
    "nsfwebnewbie" <[email protected]> wrote in
    message
    news:fmo8cf$3l5$[email protected]..
    > hi i inherited responcibilty for a website, simply
    because there was noone
    > else
    > avalable. i have dreamweaver cs3, but only about 2 weeks
    worth of
    > knowledge and
    > experience. I was given info ie. ftp address and
    username etc, so have
    > been
    > able to download the website to my home computer, and
    have been making
    > updates,
    > now however i need to find out more about setting up a
    test server so i
    > can use
    > dynamic pages, specifically for collecting form
    information, collecting
    > donations and selling art work. i will need some
    information from the host
    > server to start with, but am unsure as how to identify
    and contact them,
    > can
    > anyone help me please. I am sure it is rudimentary, but
    the information is
    > essential.
    > also as a side note, could anyone tell me how to find
    out where the
    > websites
    > domain name is regestered ( other than contacting the
    original designer,
    > as
    > that seem quite impossible) because i get the feeling
    that if all else
    > fails i
    > may be able to move the website to another host ( not
    that i now how yet,
    > or
    > even how to select or find a host) please let me know if
    any of my
    > assumptions
    > are wrong.
    >
    >
    > Thanking you in advance
    >
    > J
    > volunteer.
    >
    >

  • HT1386 Help, I can't sync my apps on my 3GS phone to the newest iTunes software. On top of that, my purchased apps under my apple ID seem to have disappeared! I want to transfer them to an iPhone 4S I just inherited, but I can't!

    Help, I can't sync my apps on my 3GS phone to the newest iTunes software. On top of that, my purchased apps under my apple ID seem to have disappeared! I want to transfer them to an iPhone 4S I just inherited, but I can't! Thanks!

    How did you get iOS 6 with an iPhone 3GS?  I need help updating my software on my iPhone I have iOS 4 and can't figure out what to do.

  • Java inheritance and interface code help required

    please help me I need your 30 mins only,,, working on assignment and I am trying to understand interface and inheritance might not need even 30 mins, please add me on skype *[deleted by moderator]*
    Or add me on
    yahoo msgr *[deleted by moderator]*
    waiting for your help.
    I have no single person friend or I can ask help from who knows java or programming. pretty much want to learn need a friend who can guide me in java.
    unfortunately have to submit assignment tomorrow.
    Thank you in advance for your time and consideration.
    Akee
    *Edited by moderator: EJP on 10/11/2012 10:38: removed your private contact details. This is a public forum, not a personal help desk. Ask your questions here or not at all.*

    Hi,
    there are lot of thread alredy posted please serach
    check following link
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/1d753cab14a909e10000000a11405a/frameset.htm
    XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    Links of blogs on java mapping...
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    blog
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping(file to xslt mapping)
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners(xslt with java enhancement function)
    Regards,
    Amit

  • Help with RMI using inheritance program

    Hi all, im having trouble starting (and finding info on how to) to convert this program to use RMI. I have just completed re-structuring the program to use extended inheritance along with a Access Database.
    Whats the first step i need to take.
    Any help will be much appreciated. THANKS ALL
    import java.sql.*;
    import javax.swing.*;
    import java.util.*;
    public class Database {
       public java.sql.Connection connection;
       public void connect() 
          String url = "jdbc:odbc:groupTask2";  
          String username = "admin";   String password = "teama";
          // Load the driver to allow connection to the database
          try {
             Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
             connection = java.sql.DriverManager.getConnection(url, username, password );
          catch ( ClassNotFoundException cnfex ) {
             System.err.println("Failed to load JDBC/ODBC driver->"  + cnfex);
          catch ( SQLException sqlex ) {
             System.err.println( "Unable to connect->" + sqlex );
       public void showTeams()
          java.sql.Statement statement;
          java.sql.ResultSet resultSet;
          try {
             String query = "SELECT Team_name FROM Team_class";
             statement = connection.createStatement();
             resultSet = statement.executeQuery( query );
             displayResultSet( resultSet );
             statement.close();
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void showPlayers()
          java.sql.Statement statement;
          java.sql.ResultSet resultSet;
          String team = null;
          try {
             String s = JOptionPane.showInputDialog("Please select Team: \n\n1. Panthers \n2. Quails \n3. Bears \n4. Nevils \n ");
             int a = Integer.parseInt(s);
             switch (a){
                 case 1: team = "Panthers";
                         break;
                 case 2: team = "Quails";
                         break;
                 case 3: team = "Bears";
                         break;
                 case 4: team = "Nevils";
                         break;
             String query = "SELECT player_id, First_name, Last_name FROM Player_class WHERE Team_name LIKE '"+team+"'";
             statement = connection.createStatement();
             resultSet = statement.executeQuery( query );
             displayResultSet( resultSet );
             statement.close();
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void update()
          java.sql.Statement statement;
          java.sql.Statement statement2;
          java.sql.ResultSet resultSet;
          String field = null;
          try {
             String a = JOptionPane.showInputDialog("Please Enter the player ID:");
             int id = Integer.parseInt(a);
             String b = JOptionPane.showInputDialog("Which field would you like to update? \n\n1. First name \n2. Last name \n3. Address \n ");
             int choice = Integer.parseInt(b);
             switch (choice){
                 case 1: field = "First_name";
                         break;
                 case 2: field = "Last_name";
                         break;
                 case 3: field = "address";
                         break;
             String val = JOptionPane.showInputDialog("Please enter new " +field);
             String query = "UPDATE Player_class SET "+field+" = '"+val+"' WHERE player_id = "+id;
             statement = connection.createStatement();
             statement.executeQuery( query );
             statement.close(); 
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void displayResultSet( ResultSet rs )
          throws SQLException
          // position to first record
          boolean moreRecords = rs.next();  
          // If there are no records, display a message
          if ( ! moreRecords ) {
                System.out.println( "ResultSet contained no records" );
                return;
          System.out.println( "" );
          try {
             java.sql.ResultSetMetaData rsmd = rs.getMetaData(); 
             // Get column heads
             for ( int i = 1; i <= rsmd.getColumnCount(); ++i ) {
                 System.out.print(rsmd.getColumnName( i ) + "\t");
             System.out.println();
             do {// get row data
                  displayNextRow( rs, rsmd );
             } while ( rs.next() );
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void displayNextRow( ResultSet rs, 
                                  ResultSetMetaData rsmd )
           throws SQLException
          for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
             switch( rsmd.getColumnType( i ) ) {
                case java.sql.Types.VARCHAR:
                      System.out.print (rs.getString( i )+"\t\t" );
                   break;
                case java.sql.Types.INTEGER:
                      System.out.print ( rs.getLong( i ) + "\t\t") ;
                   break;
                default: 
                   System.out.println( "Type was: " + 
                      rsmd.getColumnTypeName( i ) );
             System.out.println();
       public void shutDown()
          try {
             connection.close();
          catch ( SQLException sqlex ) {
             System.err.println( "Unable to disconnect->" + sqlex );
       public static void main( String args[] ) 
           int sel = 0;
           Menu M = new Menu();
           Database app = new Database();
           sel = M.mainmenu(sel);
           while (sel > 0 && sel < 5){
           switch (sel){
               case 1: app.connect();
                       app.showTeams();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
               case 2: app.connect();
                       app.showPlayers();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
               case 3: app.connect();
                       app.update();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
    class Menu{ 
        int choice = 0;
        int temp = 0; 
        public Menu(){
        public int mainmenu(int val){ 
            String a = JOptionPane.showInputDialog("TEAM MENU \n\nPlease select an option by entering " + 
                    "the corresponding number: \n\n1. Display Teams \n2. Show Players \n3. Update a Player \n4. Search \n "); 
            val= Integer.parseInt(a); 
            return val; 
        public int setChoice(int val){
            choice = val;
            return choice;

    Well, I'd say a starting point is to split the functionality into "client" and "server". This will wind up as two programs, the client making - remote - requests of the server.
    A fairly natural way would be to assign viewing/display to the client, direct access to the database to the server. So then you have to figure out
    o what kinds of requests can go acrross the divide.
    o what kind of data will be returned.
    This may not be that easy, because things that the server can do easily (like I/O) cnnot be carried back and forth in RMI calls.)

  • Help with constructors using inheritance

    hi,
    i am having trouble with contructors in inheritance.
    i have a class Seahorse extends Move extends Animal
    in animal class , i have this constructor .
    public class Animal() {
    public Animal (char print, int maxage, int speed) {
    this.print = print;
    this.maxage = maxage;
    this.speed = speed;
    public class Move extends Animal {
    public Move(char print, int maxage, int speed)
    super(print, maxage, speed); //do i even need this here? if i dont i
    //get an error in Seahorse class saying super() not found
    public class Seahorse extends Move {
    public Seahorse(char print, int maxage, int speed)
    super('H',10,0);
    please help

    It's not a problem, it's how Java works. First, if you do not create a constructor in your code, the compiler will generate a default constructor that does not take any arguments. If you do create one or more constructors, the only way to construct an object instance of the class is to use one of the constructors.
    Second, when you extend a class, your are saying the subclass "is a" implementation of the super class. In your case, you are saying Move is an Animal, and Seahorse is a Move (and an Animal as well). This does not seem like a good logical design, but that's a different problem.
    Since you specified that an Animal can only be constructed by passing a char, int, and int, that means that a Move can only be constructed by calling the super class constructor and passing a char, int, and int. Since Move can only be constructed using a char, int and int, Seahorse can only be constructed by calling super(char, int, int);.
    It is possible for a subclass to have a constructor that does not take the same parameters as the super class, but the subclass must call the super class constructor with the correct arguments. For example, you could have.
    public Seahorse() {
       super('S',2,5);
    }The other problem is, Move does not sound like a class. It sounds like a method. Perhaps you might have MobileAnimal, but that would only make sense if there was a corresponding StationaryAnimal. Your classes should model your problem. It's hard to image a problem in which a Seahorse is a Move, and a Move is an Animal. It makes more sense for Animals to be able to move(), which allows a Seahorse to move differently compared to an Octopus.

  • Help with my Project - Includes Arrays, Inheritance and Polymorphism

    COMP 1900 CS1: Introduction to Programming
    Programming Assignment 4
    Objectives:
    * To work with superclasses and subclasses
    * To work with an abstract class
    * To gain experience working with an array of objects
    Requirements:
    * Understanding of arrays (Sections 7.1-7.3)
    * Understanding of inheritance (Chapter 8)
    * Understanding of polymorphism (Sections 9.1-9.2)
    Assignment:
    Write a Java application for a company payroll that has three different types of employees: secretary, junior salesman and senior salesman.
    * Design an employee superclass that contains an instance variable for the employee name. In addition, there should be an (abstract) method to compute the yearly bonus that employees receive in the month of December.
    * Design subclasses for each type of employee. The secretary subclass should have two instance variables: one corresponding to the initial year of employment and the other representing the salary. The junior salesman class has instance variables for base salary, total sales, and commission rate. The senior salesman class has one instance variable representing the total sales.
    * Design get and set methods for each class. Each class should also have a toString method.
    * Design a computeCommission method for each of the salesman classes as follows:
    o For a junior salesman, the commission rate is set.
    o For a senior salesman, the commission rate is variable based on total sales.
    For sales < $10,000,000: the commission rate is 0.1%;
    For sales between 10 and 25 million inclusive, the commission rate is .2%;
    For sales over 25 million, the commission rate is .25%.
    * Design a computeBonus method for all employee classes as follows:
    o For secretarial staff, bonuses are dependent on the number of years that an employee has worked for the company. If an employee has worked less than 5 years, the bonus is $50; for 5 to 10 years, inclusive, the bonus is $75; for over 10 years, the bonus is $100.
    o For junior salesman, the bonus is .01% times the sum of the yearly salary and the total commission for the year.
    o For senior salesman, the bonus is .025% of the total sales.
    * Design a class EmployeePayroll that has an instance variable that is an array of Employee objects.
    * Design methods addEmployee and toString.
    * Design a method that computes the average of all employee bonuses.
    * Design the method that counts how many employees received a bonus bigger than the number sent in as parameter.
    * Design a method that finds the employee that has earned the biggest bonus.
    * Design a class TestEmployeePayroll that creates an array with 9 Employee objects (3 of each type) and tests each of the methods that you wrote. Initially, for testing purposes you can hardcode the values for Employee objects being created, but when completed you need to ask for interactive input from the user.
    I am having trouble with how to write an abstract method to compute the yearly bonus inside of the employee superclass.
    I am also having a lot of trouble with the EmployeePayroll class. I can't think of the best way to do the addEmployee method. I am just getting stuck and very frustrated. Help would be greatly appreciated. Thanks.

    This is all I have so far.
    public class Employee
        protected String name;
        public void setName(String name)
            this.name = name;
        public String getName()
            return name;
    public class Secretary extends Employee
        private int initialYear = 0000;
        private double salary = 0.0;
        public void setInitialYear(int initialYear)
            this.initialYear = initialYear;
        public int getInitialYear()
            return initialYear;
        public void setSalary(double salary)
            this.salary = salary;
        public double getSalary()
            return salary;
        public double computeBonus()
            double bonus = 0.0;
            if(2007 - initialYear < 5)
                bonus = 50.00;
            else if(2007 - initialYear >= 5 && initialYear <= 10)
                bonus = 75.00;
            else if(2007 - initialYear > 10)
                bonus = 100.00;
            return bonus;
        public String toString()
            return "Initial Year: " + initialYear + ". Salary: " + salary + ". Bonus: " + computeBonus() + ".";
    public class JuniorSalesman extends Employee
        private double baseSalary = 0.0;
        private double commissionRate = 0.0;
        private double totalSales = 0.0;
        public void setBaseSalary(double baseSalary)
            this.baseSalary = baseSalary;
        public double getBaseSalary()
            return baseSalary;
        public void setCommisionRate(double commissionRate)
            this.commissionRate = commissionRate;
        public double commissionRate()
            return commissionRate;
        public void setTotalSales(double totalSales)
            this.totalSales = totalSales;
        public double getTotalSales()
            return totalSales;
        public double computeBonus()
            return .001 * (baseSalary + commissionRate);
        public String toString()
            return "Base Salary: " + baseSalary + ". Total Sales: " + totalSales + ". Commission Rate: " + commissionRate + ". Bonus: " + computeBonus() + ".";
    public class SeniorSalesman extends Employee
        double totalSales = 0.0;
        public void setTotalSales(double totalSales)
            this.totalSales = totalSales;
        public double getTotalSales()
            return totalSales;
        public double computeCommission()
            double commissionRate = 0;
            if(totalSales < 10000000)
                commissionRate = 0.001;
            else if(totalSales >= 10000000 && totalSales <= 25000000)
                commissionRate = 0.002;
            else if(totalSales > 25000000)
                commissionRate = 0.0025;
           return commissionRate;
        public double computeBonus()
            return totalSales * .0025;
        public String toString()
            return "Total Sales: " + totalSales + ". Commission Rate: " + computeCommission() + ". Bonus: " + computeBonus() + ".";
    }

  • I have just inherited my husbands ipad, all transferred well except my hotmail account will not set up, I have read all forums but none have helped, keep getting "can not verify" when I try set it up. I have removed email and re added, turn

    I have just inherited my husbands ipad, all transferred well except my hotmail account will not set up, I have read all forums but none have helped, keep getting "can not verify" when I try set it up. I have removed email and re added, turned on off iPad and iPhone but neither will set up, I have given up and forwarded all new emails from hotmail to icloud until I sort this out. Please help it's doing my brain in!!!! Thanks

    You need to turn off find my ipad in settings
    Then restore to factory settings ipad will then be
    as new then enter you Apple ID and password
    bsydd uk

  • I inherited an iphone 4 about 1 month ago.  Updated to ios 7 and lost the ability to send MMS to phones other than iphones.   HELP !

    I inherited an iphone 4 from my daughter 1 month ago.  I updated, upon prompt on phone, to ios 7 and lost the ability to send MMS to any phone other than an iphone.    
    I have been to Apple, AA & T, and our no contract carrier and NO ONE knows what happened or how to help.
    HELP !!!
    lfdhays10

    By the way, this is not a jail broken phone.  It is an AT & T phone using a no conract service that uses AT & T towers.
    lfdhays10

  • Help with JPA Inheritance Relationship Mapping

    Perhaps someone can help with this. I'm trying to figure out how to map what seems like a simple data model using JPA. But it is not working.
    @Entity
    public class Account {
        @OneToOne(cascade=CascadeType.ALL)
        private AbstractPaymentMethod paymentMethod;
    @Entity
    @MappedSuperClass
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("AbstractPaymentMethod")
    public abstract class AbstractPaymentMethod {
    @Entity
    @Table(name="payment_method")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("CreditCardPaymentMethod")
    @SuppressWarnings("serial")
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public class CreditCardPaymentMethod extends AbstractPaymentMethod {
        @Column
        private String expirationDate;
    }The problem is, when I add a CreditCardPaymentMethod to an account like this...
    Account account = new Account();
    CreditCardPaymentMethod m = new CreditCardPaymentMethod();
    account.setPaymentMethod(m);
    em.persiste(account);... The entity manager attempts to save account.creditCardPaymentMethod as an AbstractPaymentMethod.
    Surely I'm doing something horribly wrong. Is there something I'm missing here?
    Thanks for any help.

    Thank you! You saved my life. After removing @MappedSuperClass, all is well.
    The entity manager is now saving my CreditCardPaymentMethod objects as CreditCardPaymentMethod classes instead of AbstractPaymentMethod classes.

  • I inherited an 2003 ipod from my daughter. The controls will not work when it is plugged into a power source. Can anyone help?

    I inherited a 2003 ipod from my daughter. The controls will not work when it is plugged into a power source. Can anyone help?

    But they work normally when not plugged in?  What kind of power source are you plugging it into? It maybe outputting more than what the iPod can handle.  I had this happen to an iPod I plugged into a powerstrip that was plugged into the cigarette lighter in a vehicle an experienced the same thing.
    B-rock

  • Question regarding Inheritance.Please HELP

    A question regarding Inheritance
    Look at the following code:
    class Tree{}
    class Pine extends Tree{}
    class Oak extends Tree{}
    public class Forest{
    public static void main(String args[]){
      Tree tree = new Pine();
      if( tree instanceof Pine )
      System.out.println( "Pine" );
      if( tree instanceof Tree )
      System.out.println( "Tree" );
      if( tree instanceof Oak )
      System.out.println( "Oak" );
      else System.out.println( "Oops" );
    }If I run this,I get the output of
    Pine
    Oak
    Oops
    My question is:
    How can Tree be an instance of Pine.? Instead Pine is an instance of Tree isnt it?

    The "instanceof" operator checks whether an object is an instance of a class. The object you have is an instance of the class Pine because you created it with "new Pine()," and "instanceof" only confirms this fact: "yes, it's a pine."
    If you changed "new Pine()" to "new Tree()" or "new Oak()" you would get different output because then the object you create is not an instance of Pine anymore.
    If you wonder about the variable type, it doesn't matter, you could have written "Object tree = new Pine()" and get the same result.

Maybe you are looking for

  • DVD-Drive is too slow on Satellite A100-507

    the dvd-drive mat****a dvd-ram uj-841s of my satelite a100-507 is too slow. (~1000 Kb/s - much too slow to watch a movie - and it dosn't depend on the player.) the technical specifications of the manufacturer is 8x read + write for DVDs, even i can w

  • Hard drive screw broke - Where do I get a new one?

    Hello, When I tried to update my hard drive, the screw broke. I somehaow managed to get it screwed out, but I'll need a new one. Does anybody know, where I'd get it? LeonitoVII

  • Marketing Campiagn and Sales order integration

    Hello, one can create and launch a marketing campaign. Its successs is measured with the number of sales orders generated (in my scenario). Here I have some very basic questions: 1. How do we create a link between a campaign and sales order. Where do

  • How do I Deploy a single HTML file that is part of a project without redeploying the project?

    We have an HTNL file that we load dynamically into our web page.  This file contains ToolTips and by making it an external file to the build it allows us to modify the tool-tips as the processes the tooltips describe change (government processes that

  • Load balancing in Weblogic Server

    Hi Team, As per the Oracle WLS documentation,web logic cluster provides load balancing. I want to know,how it can achieved in web logic server for clusters. Any suggestions regarding the query is appreciated. Thanks and Regards, Arun K M