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.

Similar Messages

  • 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, accessors and mutators

    Hi all...
    Can anyone give me a code for the following problem with the use of constructors, accessors and mutators ?
    Programme is :
    Create a class called Stock that has the following attributes:
    STKID : integer
    DESC : STRING
    COSTPRICE : float
    SALEPRICE : float
    QTY : integer
    Create constructors, accessors and mutators for the above class.
    Create an array of object that can store up to 100 of the above objects.
    Implement the following functionalities:
    Add new Stock Record
    Search Stock Record
    Delete Stock Record
    Update Stock Record
    Its quite urgent, since I got to submit this for my interview tomorrow. So if anyone knows the code please do reply. Thanks in advance.
    Thanks and Regards,
    Jayanth.

    @jayanth: Ignore these guys - they're just sour and don't understand the value of helping each other out. Besides, I'm bored, and this was an easy write-up. I can send the code to your email ([email protected]) if you'd like. Just let me know.

  • Help with Sum using FormCalc in Livecycle

    Hello. I'm stuck. I've been doing searches, readings, and all that on how to sum up certain cells in Livecycle. I have tried examples and tutorials and I get stuck when the application says "Error: Accessor ' ' Unknown".
    I'm such a novice in using Livecycle and I'm not a programmer. So, if someone can help me on why it does this, that would be awesome!

    Here you go.  I rename it.  Couple of things.  Too many subforms (unless you intend to do something else with this).  Also, make sure you save your forms as "dynamic" if you intend to have user enter info.  I couldn't tell if you were importing/exporting to a spreadsheet.  Note the formcalc.  Your fields need to be named the same.  In my example they are: ExpCosts.
    I'm not very good with the formcalc/java and variables but am more than willing to help with what I can

  • Need help with session using dreamweaver

    have created a login page (php/mysql) with username and
    password boxes. when the form is submitted the mainpage loads up.
    i want the main page to be specific to that user, so i want
    their name to appear in the first line. eg.. Welcome back 'David'
    I read a tutorial in the past that tought me to send the
    users id in the URL and then create a record set on the mainpage
    that was filtered by the URL parameter.
    I have forgotten how to do this and the tutorial is no longer
    available on Adobe's site.
    I tried that with
    $_SESSION['MM_Username'] = $loginUsername; \\ in first page
    then
    echo $_SESSION["MM_username"]; \\in second page, but the
    problem is that is not showing user name.
    i need help with that please!
    can anyone tell me how to do this? Thanks in advance,
    AM

    IN the second page, you have to make sure that the session
    has been started.
    Put this at the very top of the page -
    <?php if (!isset($_SESSION)) session_start(); ?>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Alidad" <[email protected]> wrote in
    message
    news:g184i4$jgf$[email protected]..
    > have created a login page (php/mysql) with username and
    password boxes.
    > when
    > the form is submitted the mainpage loads up.
    >
    > i want the main page to be specific to that user, so i
    want their name to
    > appear in the first line. eg.. Welcome back 'David'
    >
    > I read a tutorial in the past that tought me to send the
    users id in the
    > URL
    > and then create a record set on the mainpage that was
    filtered by the URL
    > parameter.
    >
    > I have forgotten how to do this and the tutorial is no
    longer available on
    > Adobe's site.
    >
    > I tried that with
    > $_SESSION['MM_Username'] = $loginUsername; \\ in first
    page then
    > echo $_SESSION["MM_username"]; \\in second page, but
    > the
    > problem is that is not showing user name.
    >
    > i need help with that please!
    >
    > can anyone tell me how to do this? Thanks in advance,
    >
    > AM
    >

  • Need help with constructors

    Here is my InventoryMain.java, Inventory.java, and Maker.java.
    I am having trouble with my constructors in Maker.java. Here is the line (this line is at the bottom of my Maker.java)
    Maker r = new Maker(txtfield1[1].getText(),txtfield1[4].getText(), 0.05, Integer.parseInt(txtfield1[2].getText()), txtfield1[3].getText(), Integer.parseInt(txtfield1[5].getText()),
                   Double.parseDouble(txtfield1[6].getText()));here is my error when compiling:
    symbol : constructor Maker(java.lang.String,java.lang.String,double,int,java.lang.String,int,double)
    location: class inventorymain.Maker
    Maker r = new Maker(txtfield1[1].getText(),txtfield1[4].getText(), 0.05, Integer.parseInt(txtfield1[2].getText()), txtfield1[3].getText(), Integer.parseInt(txtfield1[5].getText()),
    1 error
    BUILD FAILED (total time: 0 seconds)
    I have tried all kinds of different orders trying to match my constructors for Inventory(). Nothing seems to work. Can anyone help????
    InventoryMain.java
    package inventorymain;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import javax.swing.JFrame;
    public class InventoryMain
        // main method begins execution of java application
        public static void main(String[] args)
            //variables
            double restockFee = 0.05;
            //create array for products in inventory
            //enter elements into array
            Maker p = new Maker( 5186521, "pens", 1.59, 346, "Bic", restockFee);
            Maker q = new Maker( 9486452, "pencils", .59, 487,"Mead", restockFee);
            Maker r = new Maker( 6317953, "markers", 1.29, 168,"Sharpie", restockFee);
            Maker s = new Maker( 5152094, "paperclips", 1.19, 136,"Dennison", restockFee);
            Maker t = new Maker( 4896175, "glue", .79, 72,"Elmer's", restockFee);
            Maker u = new Maker( 5493756, "tape", .49, 127,"3m", restockFee);
            Maker v = new Maker( 6537947, "paper", 1.79, 203,"Mead", restockFee);
            Maker w = new Maker( 7958618, "staples", 1.19, 164,"Pentech", restockFee);
            Maker x = new Maker( 5679139, "folders", .49, 238,"Mead", restockFee);
            Maker y = new Maker( 7689110, "rulers", .17, 123,"Stanley", restockFee);       
            p.ShowInventory();
         p.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         p.setVisible(true);
         p.setSize(520, 490);
          }//end main
    }//end class Inventory____________________________
    Inventory.java
    package inventorymain; //file assigned to inventorymain package
    import javax.swing.JFrame;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.NumberFormat;
    import javax.swing.border.*;
    import java.net.*;
    import java.util.StringTokenizer;
    public class Inventory extends JFrame
            // set variables
            private Container cp = getContentPane();
            private static int itemNum[] = new int[100];
            private static String name[] = new String[100];
            private static int units[] = new int[100];
            private static double price[] = new double[100];      
            private static int i = 0;
            public Inventory()
                setLayout(new FlowLayout());
            public Inventory(int _itemNum, String _name, double _price, int _units)//varibles for constructor
                itemNum[i] = _itemNum;//variable initialized
                name[i] = _name;//variable initialized
                units[i] = _units;//variable initialized
                price[i] = _price;//variable initialized
                i = i + 1;
            // All setters and getters
            public static int getItemNum(int k)
                return itemNum[k];
            public static String getItemName(int k)
                return name[k];
            public static int getItemUnits(int k)
                return units[k]; 
            public static double getItemPrice(int k)
                return price[k];
            public static void setItemNum(int k, int value)
                itemNum[k] = value;
            public static void setItemName(int k, String value)
                name[k] = value;
            public static void setItemUnits(int k, int value)
                units[k] = value;
            public static void setItemPrice(int k, double value)
                price[k] = value;
            public static void DeleteItem(int k)
                for(int j=k; j<getCount()-1; j++)
                    setItemNum(j, getItemNum(j + 1));
                    setItemName(j,getItemName(j+1));
              setItemUnits(j,getItemUnits(j+1));
              setItemPrice(j,getItemPrice(j+1));
                }//end for
                i-=1;
            }//end DeleteItem
            public static int SearchItem(String value)
                int k = -1;
                for(int j=0;j<getCount();j++)
              if(getItemName(j).equals(value))
                        k = j;
                }//end for
                return k;
         }//end SearchItem
            public  static double totalOfInventory(double p, int u)//computes value of all merchandise in inventory
                return p * u;
            }//end method totalOfInventory
            public static void swap(int j, int min)
                String tmp;
                tmp = name[j];
                name[j] = name[min];
                name[min] = tmp;
                int temp = itemNum[j];
                itemNum[j] = itemNum[min];
                itemNum[min]= temp;
                temp = units[j];
                units[j] = units[min];
                units[min] = temp;
                double temp1 = price[j];
                price[j] = price[min];
                price[min]= temp1;
            }//ends swap method
            public double showTotalOfInventory()
                double totalValue = 0;
                for (int j = 0; j < getCount(); j++)
                    totalValue = totalValue + totalOfInventory(price[j], units[j]);
                return totalValue;
            }//end showTotalOfInventory
            public static int getCount()
                return i;
    }// end class Inventory
    class Products
        public static double totalOfInventory(double p, double u, double rf)
            double tOfI = (p * u) + (p * u * rf);
            return (tOfI);
        public static double totalOfRestockFee(double p, double rf)
            double percent = 0;
            percent = (p * 5) / 100;
            return percent;       
    }//end class Products_______________________________
    Maker.java
    package inventorymain;
    import javax.swing.JFrame;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.NumberFormat;
    import javax.swing.border.*;
    import java.net.*;
    import java.util.StringTokenizer;
    class Maker extends Inventory implements ActionListener
    {//begins Class Maker
        static String manufact[] = new String[100];
        static double restockingFee[] = new double[100];
        static int i;
        static double TotalVal;
        static int navItem;
        static Boolean isRecordLoadedFromFile = false;
        private Container cp = getContentPane();
        GridBagConstraints c;
        GridBagConstraints cconstraint;
        Border titledborder;
        JPanel pan;
        String labels[] = {"Product Name:", "Manufacturer:", "Product ID Number:", "Units in Stock:", 
                           "Price Per Unit:                                                      $",
                           "Restocking Fee:                                                   $",
                           "Value of Product in Stock:                                $",
                           "Value of All Merchandise Plus Restocking: $"};
        int len1 = labels.length;
        JLabel lbl[] = new JLabel[len1];
        JTextField txtfield1[] = new JTextField[len1];
        String blabels[] = {"First", "Previous", "Next", "Last"};
        int blen = blabels.length;
        JButton navigate[] = new JButton[blen];
        String cmdlabels[] ={"Load File", "Add", "Modify", "Delete", "Search", "Save","Cancel" };
        int cmdlen = cmdlabels.length;
        JButton cmdbutton[] = new JButton[cmdlen];
        JLabel lblImg;
        File file;
        public String FileName;
        public Maker(int Item_Number, String Item_Name, double Item_Price, int Items_in_Stock, String manufact, double restockingFee)// Constructor for varibles
            super(Item_Number, Item_Name, Item_Price, Items_in_Stock);
            this.manufact[i] = manufact;
            this.restockingFee[i] = restockingFee;
            i = i + 1;
        public static void setManufact(int k, String value)
            manufact[k] = value;
        public static double getRestockFee(int val)
            return restockingFee[val];
        public void ShowInventory()
            setLayout(new FlowLayout());
            GridBagLayout contlayout = new GridBagLayout();//layout for container
            GridBagConstraints cconstraint = new GridBagConstraints();//constraint for container
            GridBagLayout gblayout = new GridBagLayout();//layout for panel
            GridBagConstraints gbconstraint = new GridBagConstraints();
            FileName = "C://dat//inventory.dat";
            try
                String strDirectoy = "C://dat";
                boolean success = (new File(strDirectoy)).mkdir();
                file = new File(FileName);
                success = file.createNewFile();
                //ADD SAVE CANCEL DELETE EXIT
                pan = new JPanel();
                gblayout = new GridBagLayout();
                gbconstraint = new GridBagConstraints();
                pan.setLayout(gblayout);
                gbconstraint.gridwidth = 1;
                gbconstraint.gridheight = 1;
                gbconstraint.gridy = 0;
                for (int i = 0; i < cmdlen; i++)
                    cmdbutton[i] = new JButton(cmdlabels);
              cmdbutton[i].addActionListener(this);
              gbconstraint.gridx = i;
              pan.add(cmdbutton[i], gbconstraint);
    }//end for
    titledborder = BorderFactory.createTitledBorder("Confirmation");
    pan.setBorder(titledborder);
    //ADD PANEL TO CONTAINER
    cconstraint.gridwidth = 4;
    cconstraint.gridheight = 1;
    cconstraint.gridx = 0;
    cconstraint.gridy = 2;
    cp.add(pan, cconstraint);
    //ADDITION COMPLETE
    //first panel
    pan = new JPanel();
    gblayout = new GridBagLayout();
    gbconstraint = new GridBagConstraints();
    pan.setLayout(gblayout);
    for (int i = 0; i < 2; i++)
    for (int j = 0; j < len1; j++)
    int x = i;
    int y = j;
    if (x == 0)
    lbl[j] = new JLabel(labels[j]);
    lbl[j].setHorizontalAlignment(JLabel.LEFT);
    lbl[j].setPreferredSize(new Dimension(250, 15));
    gbconstraint.insets = new Insets(10, 0, 0, 0);
    gbconstraint.gridx = x;
    gbconstraint.gridy = y;
    pan.add(lbl[j], gbconstraint);
    }//end if
    else
    txtfield1[j] = new JTextField(15);
    txtfield1[j].setPreferredSize(new Dimension(300, 15));
    txtfield1[j].setHorizontalAlignment(JLabel.LEFT);
    txtfield1[j].setEnabled(false);
    lbl[j].setLabelFor(txtfield1[j]);
    gbconstraint.gridx = x;
    gbconstraint.gridy = y;
    pan.add(txtfield1[j], gbconstraint);
    }//end else
    }//end for
    }//end for
    Border titledborder = BorderFactory.createTitledBorder("Current Inventory Records");
    pan.setBorder(titledborder);
    //adds panel to container
    cconstraint.gridwidth = 1;
    cconstraint.gridheight = 1;
    cconstraint.gridx = 0;
    cconstraint.gridy = 0;
    cp.add(pan, cconstraint);
    //add icon to display
    pan = new JPanel();
    gblayout = new GridBagLayout();
    gbconstraint = new GridBagConstraints();
    pan.setLayout(gblayout);
    gbconstraint.gridwidth = 1;
    gbconstraint.gridheight = 1;
    gbconstraint.gridy = 0;
    lblImg = new JLabel((new ImageIcon(getClass().getResource("logo111.jpg"))));
    lblImg.setPreferredSize(new Dimension(70, 70));
    pan.add(lblImg);
    cconstraint.gridwidth = 1;
    cconstraint.gridheight = 1;
    cconstraint.gridx = 0;
    cconstraint.gridy = 1;
    cp.add(pan, cconstraint);
    //ends icon insert
    //navigation panel
    pan = new JPanel();
    gblayout = new GridBagLayout();
    gbconstraint = new GridBagConstraints();
    pan.setLayout(gblayout);
    gbconstraint.gridwidth = 1;
    gbconstraint.gridheight = 1;
    gbconstraint.gridy = 1;
    for (int i = 0; i < blen; i++)
    navigate[i] = new JButton(blabels[i]);
    gbconstraint.gridx = i;
    pan.add(navigate[i], gbconstraint);
    navigate[i].addActionListener(this);
    }//end for
    titledborder = BorderFactory.createTitledBorder("Navigation Panel");
    pan.setBorder(titledborder);
    //add panel to container
    cconstraint.gridwidth = 4;
    cconstraint.gridheight = 1;
    cconstraint.gridx = 1;
    cconstraint.gridy = 1;
    cp.add(pan, cconstraint);
    }//end try
    catch (Exception e)
    e.printStackTrace();
    }//end catch
    }//end showInventory
    public void setContents(File aFile, String aContents)
    BufferedWriter output = null;
         try
    //use buffering
    //FileWriter always assumes default encoding is OK!
    output = new BufferedWriter(new FileWriter(aFile, true));
    output.write(aContents);
    String newLine = System.getProperty("line.separator");
    output.write(newLine);
    }//end try
    catch (Exception ex)
    ex.printStackTrace();
    }//end catch
    finally
    try
    //flush and close both "output" and its underlying FileWriter
              if (output != null) output.close();
    }//end try
    catch (java.io.IOException e)
    e.printStackTrace();
    }//end catch
    public void AddModifyInventory(String Mode)
    if (Mode.equals("Insert"))
    String Content = txtfield1[1].getText() + "\t"
    + txtfield1[2].getText() + "\t" + txtfield1[3].getText()
    + "\t" + txtfield1[4].getText();
    setContents(file, Content);
    JOptionPane.showMessageDialog(null, "Record Successfully Inserted");
    }//end if
    }//end AddModifyInventory
    public void ShowInventory(int ItemNo)
    txtfield1[0].setText(Integer.toString(ItemNo));
    txtfield1[0].setText(Inventory.getItemName(ItemNo));
    txtfield1[1].setText(manufact[ItemNo]);
    txtfield1[2].setText(Integer.toString(Inventory.getItemNum(ItemNo)));
    txtfield1[3].setText(Integer.toString(Inventory.getItemUnits(ItemNo)));
    txtfield1[4].setText(Double.toString(Inventory.getItemPrice(ItemNo)));
    txtfield1[5].setText(String.format("%3.2f",
    Products.totalOfRestockFee(Inventory.getItemPrice(ItemNo),
    getRestockFee(ItemNo))));
    txtfield1[6].setText(String.format("%3.2f",
    Products.totalOfInventory(Inventory.getItemPrice(ItemNo),
    Inventory.getItemUnits(ItemNo), getRestockFee(ItemNo))));
    txtfield1[7].setText(String.format("%3.2f", GetTotalInvVal()));
    }//end ShowInventory(int ItemNo)
    public void EnableFields(boolean bflag)
    txtfield1[1].setEnabled(bflag);
    txtfield1[2].setEnabled(bflag);
    txtfield1[3].setEnabled(bflag);
    txtfield1[4].setEnabled(bflag);
    txtfield1[5].setEnabled(bflag);
    }//end EnableFields
    public double GetTotalInvVal()
    TotalVal = 0;
    for(int j = 0; j < Inventory.getCount(); j++)
    TotalVal += Products.totalOfInventory(Inventory.getItemPrice(j),
    Inventory.getItemUnits(j), getRestockFee(j));
    return TotalVal;
    }//end GetTotalInvVal
    public Integer GetRecordCount()
         FileReader fr;
         BufferedReader br;
         LineNumberReader lnr;
         String line;
         int lno = 0;
         try
    lnr = new LineNumberReader(new BufferedReader(new FileReader(FileName)));
    while ((line = lnr.readLine()) != null)
              lno = lnr.getLineNumber();
         lnr.close();
         }//end try
         catch (IOException ioErr)
    System.out.println(ioErr.toString());
    System.exit(100);
         return lno;
    public void showInventory(int itemNo)
    int i;
    FileReader fr;
    BufferedReader br;
    LineNumberReader lnr;
    StringTokenizer st;
    String line;
    int item = itemNo + 1;
    int ItemNo = 0;
    int Units = 0;
    String ItemGenre = "";
    String ItemName = "";
    String ItemRating = "";
    double UnitPrice = 0;
    double Total = 0;
    Integer rFee = 0;
    int lno;
    try
              lnr = new LineNumberReader(new BufferedReader(new FileReader(FileName)));
              while ((line = lnr.readLine()) != null)
    lno = lnr.getLineNumber();
    String s1[];
    if (item == lno)
                   s1 = new String[lno];
                   s1[0] = line;
                   st = new StringTokenizer(s1[0]);
                   //ItemNo = lno;
                   ItemGenre = st.nextToken();                         
                   ItemNo = Integer.parseInt(st.nextToken());
                   ItemName = st.nextToken();
                   ItemRating = st.nextToken();
                   Units = Integer.parseInt(st.nextToken());
                   UnitPrice = Double.parseDouble(st.nextToken());
                   //rFee = Integer.parseInt(st.nextToken());
    }//end if
    s1 = new String[lno];
    s1[0] = line;
    st = new StringTokenizer(s1[0]);
    st.nextToken();
    st.nextToken();
    st.nextToken();
    st.nextToken();
    Integer units = Integer.parseInt(st.nextToken());
    Double price = Double.parseDouble(st.nextToken());
    Total += Products.totalOfInventory(price, units, 0.05);
    }//end while
    lnr.close();
    }//end try
    catch (IOException ioErr)
              System.out.println(ioErr.toString());
              System.exit(100);
    }//end catch
    txtfield1[0].setText(Integer.toString(itemNo));
    txtfield1[0].setText(ItemName);
    txtfield1[1].setText(manufact[ItemNo]);
    txtfield1[2].setText(Integer.toString(ItemNo));
    txtfield1[3].setText(Integer.toString(Units));
    txtfield1[4].setText(Double.toString(UnitPrice));
    txtfield1[5].setText(String.format("%3.2f", Products.totalOfRestockFee(UnitPrice, 0.05)));
    txtfield1[6].setText(String.format("%3.2f", Products.totalOfInventory(UnitPrice, Units, 0.05)));
    txtfield1[7].setText(String.format("%3.2f", Total));          
         }//end showInventory
    public void actionPerformed(ActionEvent e)//button actions
    String btnClicked = ((JButton)e.getSource()).getText();
    if(btnClicked.equals("First"))
    EnableFields(false);
    if (isRecordLoadedFromFile)
              navItem = 0;
              showInventory(navItem);
    }//end if
    else
              navItem = 0;
              ShowInventory(navItem);
    }//end else
         }//end if
         if (btnClicked.equals("Next"))
    EnableFields(false);
    if (isRecordLoadedFromFile)
              if (navItem == GetRecordCount() - 1)
    navItem = 0;
              }//end if
    else
    navItem += 1;
              }//end else
              if ((GetRecordCount() - 1) >= navItem)
    showInventory(navItem);
    else
    showInventory(GetRecordCount() - 1);
    }//end if
    else
    if (navItem == getCount() - 1)
    navItem = 0;
    }//end if
    else
    navItem += 1;
    }//end else
    ShowInventory(navItem);
    }//end else
         }//end if
    if (btnClicked.equals("Previous"))
    EnableFields(false);
    if (isRecordLoadedFromFile)
    if (navItem == 0)
    navItem = GetRecordCount() - 1;
              }//end if
    else
    navItem = navItem - 1;
              }//end else
    showInventory(navItem);
    }//end if
    else
              if (navItem == 0)
    navItem = getCount() - 1;
              }//end if
    else
    navItem = navItem - 1;
              }//end else
    ShowInventory(navItem);
    }//end else
         }//end if
    if (btnClicked.equals("Last"))
    EnableFields(false);
    if (isRecordLoadedFromFile)
    navItem = GetRecordCount() - 1;
              showInventory(navItem);
    }//end if
    else
              navItem = getCount() - 1;
              ShowInventory(navItem);
    }//end else
         }//end if
    if (btnClicked.equals("Save"))
    AddModifyInventory("Insert");
         }//end if
    if (btnClicked.equals("Load File"))
    isRecordLoadedFromFile = true;
    if (GetRecordCount() == 0)
              JOptionPane.showMessageDialog(null, "No Records Found in the File");                    
    }//end if
    else
              showInventory(0);
    }//end else
    if (btnClicked.equals("Cancel"))
              EnableFields(false);
              cmdbutton[4].setText("Search");
              cmdbutton[2].setText("Modify");
              cmdbutton[1].setText("Add");
    if(isRecordLoadedFromFile)
    showInventory(navItem);
              else
    ShowInventory(navItem);
    }//end if
    if(btnClicked.equals("Delete"))
              Inventory.DeleteItem(Integer.parseInt(txtfield1[0].getText()));
              navItem = getCount() -1;
              JOptionPane.showMessageDialog(null, "Record Successfully deleted");
              ShowInventory(navItem);
    }//end if
    if(btnClicked.equals("Search"))
              cmdbutton[4].setText("GO!");
              txtfield1[3].setEnabled(true);     
    }//end if
    if(btnClicked.equals("GO!"))
              boolean valid = true;
    if (txtfield1[3].getText().trim().length() == 0)
    JOptionPane.showMessageDialog(null, "Product Name Required");
    valid = false;
              }//end if
    if(valid)
    int k = Inventory.SearchItem(txtfield1[3].getText().trim());
    if(k>=0)
                   txtfield1[0].setText(Integer.toString(k));
                   txtfield1[0].setText(Inventory.getItemName(k));
    txtfield1[1].setText(manufact[k]);
    txtfield1[2].setText(Integer.toString(Inventory.getItemNum(k)));
                   txtfield1[3].setText(Integer.toString(Inventory.getItemUnits(k)));
                   txtfield1[4].setText(Double.toString(Inventory.getItemPrice(k)));
                   txtfield1[5].setText(String.format("%3.2f", Products.totalOfRestockFee(Inventory.getItemPrice(k), getRestockFee(k))));
                   txtfield1[6].setText(String.format("%3.2f", Products.totalOfInventory(Inventory.getItemPrice(k ), Inventory.getItemUnits(k), getRestockFee(k))));
                   txtfield1[7].setText(String.format("%3.2f",GetTotalInvVal()));
                   EnableFields(false);
                   cmdbutton[4].setText("Search");                              
    }//end if
    else
    JOptionPane.showMessageDialog(null, "No Matches found");     
    cmdbutton[4].setText("Search");     
    EnableFields(false);
    }//end else
              }//end if               
    }//end if
    if(btnClicked.equals("Modify"))
              EnableFields(true);                         
              cmdbutton[2].setText("Click to Modify!");
    }//end if
    if(btnClicked.equals("Click to Modify!"))
              Boolean valid = true;
    if (txtfield1[1].getText().trim().length() == 0)
    JOptionPane.showMessageDialog(null, "Genre Required");
    valid = false;
              }//end if
    try
    Integer.parseInt(txtfield1[2].getText());
              }//end try
              catch (Exception ex)
    JOptionPane.showMessageDialog(null, "Invalid Item Number (Only Numbers allowed)");
    txtfield1[2].setText("");
    valid = false;
              }//end catch
              if (txtfield1[3].getText().trim().length() == 0)
    JOptionPane.showMessageDialog(null, "Product Name Required");
    valid = false;
              }//end if
              if (txtfield1[4].getText().trim().length() == 0)
    JOptionPane.showMessageDialog(null, "Rating Required");
    valid = false;
              }//end if
              try
    Integer.parseInt(txtfield1[5].getText());
              }//end try
    catch (Exception ex)
    JOptionPane.showMessageDialog(null, "Invalid Units in Stock (Only Numbers allowed)");
    txtfield1[4].setText("");
    valid = false;
              }//end catch
    try
    Double.parseDouble(txtfield1[6].getText());
              }//end try
    catch (Exception ex)
    JOptionPane.showMessageDialog(null, "Invalid Price (Only Numbers allowed)");
    txtfield1[5].setText("");
    valid = false;
              }//end catch
              if (valid)
    //setItemNum,setItemName,setItemUnits,setItemPrice
    Inventory.setItemNum(navItem,Integer.parseInt(txtfield1[1].getText()));
    Inventory.setItemName(navItem,txtfield1[2].getText());
    Inventory.setItemUnits(navItem,Integer.parseInt(txtfield1[4].getText()));
    Inventory.setItemPrice(navItem,Double.parseDouble(txtfield1[5].getText()));     
    txtfield1[6].setText(String.format("%3.2f", Products.totalOfRestockFee(Inventory.getItemPrice(navItem), getRestockFee(navItem))));
    txtfield1[7].setText(String.format("%3.2f", Products.totalOfInventory(Inventory.getItemPrice(navItem ), Inventory.getItemUnits(navItem), getRestockFee(navItem))));
    txtfield1[8].setText(String.format("%3.2f",GetTotalInvVal()));
    EnableFields(false);
    cmdbutton[2].setText("Modify");
              }//end if
    }//end if
    if (btnClicked.equals("Add"))
              EnableFields(true);
              txtfield1[0].setText(Integer.toString(getCount()));
              txtfield1[1].setText("");
              txtfield1[2].setText("");          
              txtfield1[3].setText("0");
              txtfield1[4].setText("0.00");
              cmdbutton[1].setText("Click to Add!");
    }//end if
    if (btnClicked.equals("Click to Add!"))
    Boolean valid = true;
    try
    Integer.parseInt(txtfield1[2].getText());
              }//end try
    catch (Exception ex)
    JOptionPane.showMessageDialog(null, "Invalid Item Number (use numbers only)");
    txtfield1[2].setText("");
    valid = false;
              }//end catch
              if (txtfield1[0].getText().trim().length() == 0)
    JOptionPane.showMessageDialog(null, "Product Name Required");
    valid = false;
              }//end if
              try
    Integer.parseInt(txtfield1[3].getText());
              }//end try
    catch (Exception ex)
    JOptionPane.showMessageDialog(null, "Invalid Units in Stock (use numbers only)");
    txtfield1[3].setText("");
    valid = false;
              }//end catch
    try

    You do not need to post that massive amount of code to ask about a compile-time error.
    I (and many others here) won't even consider looking at it. Create a small example that demonstrates what you're having trouble with.

  • Need Help With Query Using Aggregation

    If I have a table, defined like this:
    CREATE TABLE range_test
    range_id NUMBER(20) NOT NULL,
    grade CHAR(1) NOT NULL,
    lower_bound_of_range NUMBER(5,2) NOT NULL,
    upper_bound_of_range NUMBER(5,2) NOT NULL,
    received_date_time_stamp TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
    And I wanted to query the table to find the range associated with the last inserted row for each 'grade' (e.g. 'A', 'B', 'C', etc), how would I go about that?
    I want something like the following, but I know that this won't work right:
    SELECT
    grade,
    lower_bounding_of_range,
    upper_bounding_of_range,
    max(received_date_time_stamp)
    FROM
    range_test GROUP BY received_date_time_stamp;
    Thanks for your help. . .I'm frustrating myself with this one and I think it should be possible without having to use PL/SQL (i.e. SQL aggregate functions or sub-queries should work).

    Perhaps something along the lines of...
    SQL> ed
    Wrote file afiedt.buf
      1  select deptno, empno, ename, hiredate
      2  from emp
      3* order by deptno, empno
    SQL> /
        DEPTNO      EMPNO ENAME      HIREDATE
            10       7782 CLARK      09-JUN-1981 00:00:00
            10       7839 KING       17-NOV-1981 00:00:00
            10       7934 MILLER     23-JAN-1982 00:00:00
            20       7369 SMITH      17-DEC-1980 00:00:00
            20       7566 JONES      02-APR-1981 00:00:00
            20       7788 SCOTT      19-APR-1987 00:00:00
            20       7876 ADAMS      23-MAY-1987 00:00:00
            20       7902 FORD       03-DEC-1981 00:00:00
            30       7499 ALLEN      20-FEB-1981 00:00:00
            30       7521 WARD       22-FEB-1981 00:00:00
            30       7654 MARTIN     28-SEP-1981 00:00:00
            30       7698 BLAKE      01-MAY-1981 00:00:00
            30       7844 TURNER     08-SEP-1981 00:00:00
            30       7900 JAMES      03-DEC-1981 00:00:00
    14 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  select deptno, empno, ename, hiredate
      2  from (
      3        select deptno, empno, ename, hiredate
      4              ,row_number() over (partition by deptno order by hiredate desc) as rn
      5        from emp
      6       )
      7  where rn = 1
      8* order by deptno, empno
    SQL> /
        DEPTNO      EMPNO ENAME      HIREDATE
            10       7934 MILLER     23-JAN-1982 00:00:00
            20       7876 ADAMS      23-MAY-1987 00:00:00
            30       7900 JAMES      03-DEC-1981 00:00:00
    SQL>

  • Need Help with timing using multiple clips

    I am in need of some help. I am trying to have a total of 16 video clips appear to slide across the screen from the right to the left, all while being equally spaced apart, going the same speed without them crossing over one another. I am using the center and anchor point in the motion tab, but once i get the the third clip i just cant seem to get the time right. I basically want them to come into the screen from the left and out of the screen from the right, all while scrolling acrossed. Please let me know if you have any suggestions.
    I even trued manipulating idvd and imovie themes in Quartz Composer, ended up starting fresh and new, and then again got into the mess with timing. Please help!!!!
    Thanks so much,

    Try this:
    Copy one clip that works OK and use Paste Attributes on the shonky one.
    Al

  • Need help with IQ02 - using a FM do update a value in this transaction

    Hi,
    I am trying to change the Aquisition value (as in transaction  IQ02) using either of following FM:
    ITOB_SERIALNO_MODIFY_SINGLE
    SERIALNUMBER_LIST_UPDATE
    However the changed value of field (ANSWT) is not getting reflected in database.
    I tried ABAP4_COMMIT_WORK, but it didnt work.
    I also tried, BAPI_TRANSACTION_COMMIT but getting a express document message 'Update was terminated.'
    Kindly help me with this. The only thing I need to do is to change the ANSWT (Aquisition value) field.
    Thanks.
    Sanjay
    PS: Help will be rewarded

    It's a bit dangerous to use SAP function modules that are not released to the user to update SAP data because they may not be a complete LUW. IE you may have to run other FMS either before or after. Try to find a BAPI. Maybe BAPI_MATERIAL_MAINTAINDATA_RT is what you need.
    Rob

  • Help with Europe Use - Galaxy Note II

    I'm looking for specifics on how to unlock my Galaxy Note II to allow it to use prepaid SIMs for data and voice service in Europe.  I'm looking to do this maybe in Austria and the Czech Republic.
    Can I get some help from a knowledgeable Verizon rep, please?  Thanks in advance!

        Hey JPHBucks!
    Travelling Europe sounds great right about now. But, I guess I'll just have to live vicariously through you at this point. Still, you've got some great questions here about the use of your Note II abroad and I'm happy to get you some proper information.
    For checking out your eligibility for the services requested, I do recommend getting in touch with our Global Support team at 908-559-4899. But no worries, I'm not going to just leave you hanging without a little added value here. After all, some of our rates abroad may suit what your looking for. With that said, you can visit our global services page at http://vz.to/z0d6MI . Please let me know if you have any questions or concerns about this. Thanks!
    EvanO_VZW
    VZW Support
    Follow Us On Twitter @VZWSupport

  • Need Help with Formula using SQL maybe

    I need help!  I work with Crystal reports XI and usually manage just fine with the Formula editor but his one I think will require some SQL and I am not good at that.
    We are running SQL 2000 I think (Enterprise Manager 8.0)  Our sales people schedule activities and enter notes for customer accounts.  Each is stored in a separate table.  I need to find activities that are scheduled 240 days into the future and show the most recent note that goes with the account for which that activity is scheduled.
    The two tables, Activities and History, share the an accountID field in common that links them to the correct customer account.   I want to look at dates in the Startdate.Activities field more than 240 days in the future and show the most recent note from the History table where the accountid's match. I figure my query will contain a join on AccountID.Activities and AccountID.History used with Max(completedate.History) but I do not understand how to word it.
    I would like to perform all this in crystal if possible.  I humbly request your help.
    Membery

    You SQL would look something like this...
    SELECT
    a.AccountID,
    a.BlahBlahBlah, -- Any other fields you want from the Activities table
    h.LastComment
    FROM Activities AS a
    LEFT OUTER JOIN History AS h ON a.AccountID = h.AccountID
    WHERE (a.ActivityDate BETWEEN GetDate() AND DateAdd(dd, 240, GetDate()))
    AND h.HistoryID IN (
         SELECT MAX(HistoryID)
         FROM History
         GROUP BY AccountID)
    This method assumes that the History table has a HistoryID that increments up automatically each time a new comment is added... So a comment made today would always have a higher HistoryID that one made yesterday.
    If I'm wrong and there is no HistoryID or the HistoryID doesn't increment in a chronological fashion, it can still be done but the code is a bit more complex.
    HTH,
    Jason

  • Help with Constructors

    I know I'm missing something but I can't find it. I keep getting an error in the main method that is can't find the variables. I've been beating on this for two days with no luck. can anyone help?
    * @(#)Employee2.java
    * Employee2 application
    * @author
    * @version 1.00 2009/7/17
    import java.*;
    public class Employee2 {
        static String title = "Spanish Inquisitor, 3rd level";
        private String      name;
        private int      ID_num;
        private int          salary;
        private int      age;
             Employee2 (String nm, int ID, int sl, int ag){
             name      = nm;
             ID_num      = ID;
             salary      = sl;
             age      = ag;}
          int getFedTax (){
          int FedTax = (salary-800)*17/100;
          return FedTax;}
    int getSsTax(int rate){//Amount of SS tax paid
          int SsTax = salary*rate/100;
          return SsTax;}
    int getHealthFee(int rate){//health insurnce paid
          int HealthFee = salary*rate/100;
          return HealthFee;}
    int getInsurance()     {//life insurance paid depends on age
         if (age<40)     {
               return salary*3/100;
         else     {     
              if (age>=40 && age<50)     {
                    return salary*4/100;
              else     {     
                   if (age>=50 && age<60)     {
                         return salary*5/100;
                   else      {
                         return salary*6/100;
         //double getNetPay(){//Pay after taxes and fees
              //return salary-getFedTax-getSsTax-getHelthFee-Employee.getInsurance;}
    class employees {
         public static void main(String[] args) {
              Employee2 Smith = new Employee2("Filipe Smith", 121, 55000, 35);//Hello Mr. Smith
              Employee2 Chenlo = new Employee2("Sven Chenlo", 212, 90000, 56);//Hello Mr. Chenlo
         //printing requested data
         System.out.print ("Name  ");System.out.println (Smith.nm);
         System.out.print ("ID Number  ");System.out.println (Smith.ID);
         System.out.print ("Salary  ");System.out.println (Smith.sl);
         System.out.print ("Age  ");System.out.println (Smith.ag);
         System.out.print ("Job Title  ");System.out.println (Smith.title);
         System.out.print ("Federal Tax With held  ");System.out.println (Smith.getFedTax());          
         System.out.print ("Social Security With held  ");System.out.println (Smith.getSsTax(3));
         System.out.print ("Health insurance With held  ");System.out.println (Smith.getHealthFee(5));
         System.out.print ("Life insurance With held  ");System.out.println (Smith.getInsurance());
         //System.out.print ("Net Pay after Withholdings  ");System.out.println (Smith.getNetPay());
         System.out.println ();
         System.out.println ();
         System.out.println ();
         System.out.print ("Name  ");System.out.println (Chenlo.nm);
         System.out.print ("ID Number  ");System.out.println (Chenlo.ID);
         System.out.print ("Salary  ");System.out.println (Chenlo.sl);
         System.out.print ("Age  ");System.out.println (Chenlo.ag);
         System.out.print ("Job Title  ");System.out.println (Chenlo.title);
         System.out.print ("Federal Tax With held  ");System.out.println (Chenlo.getFedTax());          
         System.out.print ("Social Security With held  ");System.out.println (Chenlo.getSsTax(3));
         System.out.print ("Health insurance With held  ");System.out.println (Chenlo.getHealthFee(5));
         System.out.print ("Life insurance With held  ");System.out.println (Chenlo.getInsurance());
    //     System.out.print ("Net Pay after Withholdings  ");System.out.println (Chenlo.getNetPay());
    }

    Hi......
    You are doing two mistakes.
    1. In Employee2 Class all varible that you are accesing are defind as private access spcifier. so these variable would not be accessible outside of class. Make it public or default or anything but not private.
    2. You are accessing right side variable for printing content while you should access left hand side variables to access its value. For e.g name      = nm; Use Smith.name to print name. Do not use Smith.nm.
    So change variables of Employee2 class to public or default and access left side variable instead of right variable.
    check it out....!!!!!
    AJ09.

  • Help with constructor

    Hello, Im trying for hours and Im having trouble understanding why my code is not working. I added a private instance variable called birthDate that uses a class called Date(3 private int var. for day, month, year). I adjusted the constructor to have 3 more integer arguments to add in the Date. I would like to return the birth month of a person when i run it. This is what I have...any help is very much appreciated.
    public abstract class Employee {
       private String firstName;
       private String lastName;
       private String socialSecurityNumber;
       private Date birthDate;     //private instance variable birthDate(class Date)
       // constructor
       public Employee( String first, String last, String ssn, int bMonth, int bDay, int bYear)
          firstName = first;
          lastName = last;
          socialSecurityNumber = ssn;
              birthDate.day = bDay;
           birthDate.month = bMonth;
           birthDate.year = bYear;
    // public method getBirthMonth() - return the birth month of person.
       public int getBirthMonth()
         return bMonth;
       }As well, i would like to add a method that will check the persons month against the calender month and return either 0 or 100 to get a bonus.
    This is what i tried but not sure if it is correct...
    // method to calculate bonus
         public double bonus(int month)
              Calendar now = Calendar.getInstance();               // declare local system date
              int thisMonth = now.get(Calendar.MONTH);          // get this month, 0 for January
              System.out.print("This month is: " + thisMonth);      // print this month
              g.drawString("This month is: " + thisMonth, 25, 25); // print this month as used in applets
              if ( thisMonth == month)    // validate the month
              {  return 100;  }
              else { return 0; }
         }Can anyone help me solve this...Thank you and have a good day. :)

    this is my date class:
    public class Date {
       private int month;  // 1-12
       private int day;    // 1-31 based on month
       private int year;   // any year
       // constructor: call checkMonth to confirm proper value for month;
       // call checkDay to confirm proper value for day
       public Date( int theMonth, int theDay, int theYear )
          month = checkMonth( theMonth ); // validate month
          year = theYear;                 // could validate year
          day = checkDay( theDay );       // validate day
          System.out.println( "Date object constructor for date " +
             toDateString() );
       } // end Date constructor
       // utility method to confirm proper month value
       private int checkMonth( int testMonth )
          if ( testMonth > 0 && testMonth <= 12 )  // validate month
             return testMonth;
          else { // month is invalid
             System.out.println( "Invalid month (" + testMonth +
                ") set to 1." );
             return 1;  // maintain object in consistent state
       } // end method checkMonth
       // utility method to confirm proper day value based on month and year
       private int checkDay( int testDay )
          int daysPerMonth[] =
             { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
          // check if day in range for month
          if ( testDay > 0 && testDay <= daysPerMonth[ month ] )
             return testDay;
          // check for leap year
          if ( month == 2 && testDay == 29 && ( year % 400 == 0 ||
               ( year % 4 == 0 && year % 100 != 0 ) ) )
             return testDay;
          System.out.println( "Invalid day (" + testDay + ") set to 1." );
          return 1;  // maintain object in consistent state
       } // end method checkDay
       // return a String of the form month/day/year
       public String toDateString()
          return month + "/" + day + "/" + year;
    } // end class Date

  • Help with buying used printer, please!

    I have 5 - 15AHP Laserjet Print Cartridges (my sister closed her office) .....  I have a LaserJet 4000 and the 15A doesn't fit of course.
    I am thinking of buying a used printer so I could use these cartridges.  15A fits HP Laserjet 1000; 1005; 1200; 1220; 3300; and 3380.  Can I get some suggestions on which one to buy and where?  I really just need straight printing and don't want to spend a lot.
    thanks
    LK - Denver

    While it is true that Canon does take some time to release official driver for the new OS, the reality with ML is that the current 10.7 drivers do install and function on 10.8.
    For the iR2016, here is a link to the UFR2 v2.41 driver from Canon Australia.
    Also, with the iR2016 supporting the PCL printer language, you could use the Generic PCL Laser driver included with ML. Although I am not sure about this Generic driver supporting A3 printing, so I would have to confirm this.

  • I need help with Lightning using Exchange and Postbox

    Hello,
    I have Postbox for Mac v 3.0.11 and I would like to use Lightning for Exchange.
    I cannot find any support for v 3.0.11.
    Can anyone help?
    Regards
    SD

    Did you see Coq Rouge's reply in your original thread? Which thread are you going to continue?

Maybe you are looking for