Need help with some code ... Searching a tree and inserting data

I'm trying to write code for the addIterative method below.
My problem is that I also need to search the list or node to see if the word exists.
The method add(word,line,position,iterative) validates the parameters; and, in order to update the tree and/or any relevant linked-list, calls either the incomplete method addIterative(word,line,position) or the incomplete method addRecursive(word,line,position). Note the following: if the word is not contained currently in the tree, then all of the (word,line,position) triplet needs to be added to the data structure; otherwise, only the (line,position) pair needs to be added to the data structure. The result must be the same regardless of the algorithmic strategy employed.
any suggestions would be greatly appreciated, new to java, and very lost.
regards,
Jimmy
* Write a description of class Tree091 here.
* @author (your name)
* @version (a version number or a date)
class Tree091 /*(i.e., WordTree)*/
{ private char[] word=null;
private List091 list=null;
private Tree091 precursor=null; /*(i.e., leftSubTree)*/
private Tree091 successor=null; /*(i.e., rightSubTree)*/
public Tree091(char[] word,
List091 list,
Tree091 precursor, /*(i.e., lexicographically < word)*/
Tree091 successor) /*(i.e., lexicographically > word)*/
{ if (word==null) return;
if (word.length<1) return;
if (list==null) return;
this.word=word;
this.list=list;
this.precursor=precursor;
this.successor=successor;
public void add(char[] word,
int line,
int position,
boolean iterative)
{ if (word==null) return;
if (word.length<1) return;
if (line<0) return;
if (position<0) return;
if (iterative)
this.addIterative(word,line,position);
else
this.addRecursive(word,line,position);
private void addIterative(char[] word,
int line,
int position)
/* something goes here*/
private void addRecursive(char[] word,
int line,
int position)
/* something goes here*/
private int compare(char[] array1,
char[] array2)
{ if (array1==null) return -2;
if (array2==null) return -2;
int length1=array1.length;
if (length1==0) return -2;
int length2=array2.length;
if (length2==0) return -2;
int minLength=length1<length2?length1:length2;
for (int i=0; i<minLength; i++)
{ if (array1[i]<array2) return -1;
if (array1[i]>array2[i]) return 1;
return length1==length2 ? 0 : length1<length2 ? -1 : 1;
public boolean contained(char[] word)
{ int compare=compare(this.word,word);
if (compare==1&&this.precursor!=null)
return this.precursor.contained(word);
if (compare==0) return true;
if (compare==-1&&this.successor!=null)
return this.successor.contained(word);
return false;
public int listNodeCount(boolean iterative)
/* something goes here*/
return 24;
public int maximumWordLength(int currentLength)
/* something goes here*/
return 25;
public String toString()
{ String string="";
if (this.precursor!=null) string+=this.precursor;
string+="\""+(new String(this.word))+"\""+this.list;
if (this.successor!=null) string+=this.successor;
return string;
public int treeNodeCount()
/* something goes here*/
return 26;
public String wordArray(int length)
/* something goes here*/
return "hey hey wordarray";

hey,
ok, wow, that was intense, my brain hurts!!!!
And now I've got to go do a graduate program test, argh!!!
A problem I keep getting is trying to figure out what my lecturer is doing in the start of the Tree091 class,
that is, I can see that he is constructing the list and tree but it appears that he is doing it all at the same time, and I'm getting confused with what actually gets inserted into the list, and do we insert the word, line and position, or just the line and position?
Also, I didnt use a 'while loop', I'm not sure how, but I found a 'for loop' in the text book, what do you think of it? Is it ok for now?
And I'm getting an error at this line:
Tree091 ins = new Tree091(char[] word); // getting error '.class' expected here
any ideas?
heres what I've got so far:
private void addIterative(Comparable char[] word,int line, int position){
// Insert char[] word into the this BST     
     int direction = 0;     
     Tree091 parent = null, curr = root;
     for (;;) {     
          if (curr == null) {
               Tree091 ins = new Tree091(char[] word); // getting error '.class' expected here
               // word found so we call insertList method
               insertList091(line, position, List091 precursor);
               if (root) == null)
                    root = ins;
               else if (direction < 0)     
                    parent.left = ins;
               else // direction > 0
                    parent.right = ins;
               return;
          direction = elem.compareTo(curr.element);
          if (direction == 0)
               return;
          parent = curr;
          if (direction < 0)
               curr = curr.left;
          else // direction > 0
               curr = curr.right;
}And heres an attempt at the insertList method
private void insertList(char[] word, int line, int position, List091 precursor){
// Insert line and position at a given point in this List091, either after the node
// precursor, or before the first node if precursor is null
// Looking at assignment question we may need a double linked list
     List091 ins = new List091 (char[] word, line, position, null);
     if precursor == null) { //insert before first node (if any).
          ins.successor = first;
          first = ins;
     } else {
          ins.successor = precursor.successor;
          precursor.successor = ins;
}How far off am I Joachim?
cheers,
Jimmy
ps. heres the tree091 class again:
class Tree091 /*(i.e., WordTree)*/
{ private char[] word=null;
  private List091 list=null;
  private Tree091 precursor=null; /*(i.e., leftSubTree)*/
  private Tree091 successor=null; /*(i.e., rightSubTree)*/
  public Tree091(char[] word,
                 List091 list,
                 Tree091 precursor, /*(i.e., lexicographically < word)*/
                 Tree091 successor) /*(i.e., lexicographically > word)*/
  { if (word==null) return;
    if (word.length<1) return;
    if (list==null) return;
    this.word=word;
    this.list=list;
    this.precursor=precursor;
    this.successor=successor;
  public void add(char[] word,
                  int line,
                  int position,
                  boolean iterative)
  { if (word==null) return;
    if (word.length<1) return;
    if (line<0) return;
    if (position<0) return;
    if (iterative)
      this.addIterative(word,line,position);
    else
      this.addRecursive(word,line,position);
  private void addIterative(char[] word,
                            int line,
                            int position)
    /* students to complete */
  private void addRecursive(char[] word,
                            int line,
                            int position)
     /* students to complete */
  private int compare(char[] array1,
                      char[] array2)
  { if (array1==null) return -2;
    if (array2==null) return -2;
    int length1=array1.length;
    if (length1==0) return -2;
    int length2=array2.length;
    if (length2==0) return -2;
    int minLength=length1<length2?length1:length2;
    for (int i=0; i<minLength; i++)
    { if (array1<array2[i]) return -1;
if (array1[i]>array2[i]) return 1;
return length1==length2 ? 0 : length1<length2 ? -1 : 1;
public boolean contained(char[] word)
{ int compare=compare(this.word,word);
if (compare==1&&this.precursor!=null)
return this.precursor.contained(word);
if (compare==0) return true;
if (compare==-1&&this.successor!=null)
return this.successor.contained(word);
return false;
public int listNodeCount(boolean iterative)
/* students to complete */
public int maximumWordLength(int currentLength)
/* students to complete */
public String toString()
{ String string="";
if (this.precursor!=null) string+=this.precursor;
string+="\""+(new String(this.word))+"\""+this.list;
if (this.successor!=null) string+=this.successor;
return string;
public int treeNodeCount()
/* students to complete */
public String wordArray(int length)
/* students to complete */
Edited by: allergy01 on Apr 25, 2009 9:19 PM
Edited by: allergy01 on Apr 25, 2009 9:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need Help with some code

    Hello, thanks for helping:
    my problem is that I am creating a "before" and "after" situation between strings. (What a string was before.. and now what it is)
    so here's the sample I created. Basically a display issue. If you run it you'll know the problem.
    Thanks again for helping.
       import javax.swing.*;
       import java.awt.*;
       import java.awt.event.*;
        public class JScrollExample extends JFrame
          JPanel mainpanel = new JPanel();
          JTextArea text = new JTextArea();
          JScrollPane scroll = new JScrollPane(text);
          String[] before, after, other;
          int sda, indexMaxLength;
          int[] ja;
          StringBuilder[] sb;
          String[] name;
           public JScrollExample()
             getContentPane().add(mainpanel, BorderLayout.NORTH);
             setTitle("JScrollExample");
             text.setColumns(100);
             text.setRows(30);
             mainpanel.add(scroll);
             before = new String[]
                   "asdf-asdfasdfasdf-asdf", "asdf-asdfasdfasdf-asdffdsaasdf",
                   "asdf-asdffdsaasdffdssasdfasdf-asdf", "AVDSDFDSasdf-asdfasdfasdf-asdf",
                   "asdsdfsdfsdfsdfsdsdfsdf-asddsffasdsdfsdfasdfvfdvdfvfd-asdf"
             after = new String[]
                   "jkloolkj-iriod-3342", "jsdfsdolkj-iriod-3342", "jkloolkj-fdsfiriod-3342",
                   "jkloolkj-idsfsfsfsdfsdfiod-3sdfds342", "ASXkloolkj-iriod-3342MBW"
             other = new String[]
                   "AAAAAAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                   "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "AAAAAAAAA", "AAAAAAAAAAAAA"
             indexMaxLength = 0;
             sb = new StringBuilder[before.length];
             ja = new int[before.length];
             name = new String[before.length];
             for(int j = 0; j < before.length; j++)
                if(before[j].length() > before[indexMaxLength].length())
                   indexMaxLength = j;
             sda = before[indexMaxLength].length();
             for(int i = 0; i < before.length; i++)
                ja[i] = ((sda - before.length()) + 25);
    for(int j = 0; j < ja.length; j++)
    sb[j] = new StringBuilder("");
    for(int g = 0; g < ja[j]; g++)
    sb[j].append(" -");
    text.append("I'm trying to make it look nice and neat," +
                   "and have each line have same amount of '-' " + "I tried doing it " +
                   "and this is what I got. Basically what i'm doing is finding " +
                   "the longest string, subtracting each string's \nlength with the " +
                   " longest one, then adding 25, to get an equal value, then using " +
                   "that value to put that many '-' in between before and after. But " +
                   "because every character has a different size, it doesn't work\n " +
                   "unless all the characters are the same\n\n");
    for(int i = 0; i < before.length; i++)
    String y = (after[i]);
    text.append(before[i] + sb[i].toString() + "> " + y + "\n");
    indexMaxLength = 0;
    sb = new StringBuilder[before.length];
    ja = new int[before.length];
    for(int j = 0; j < other.length; j++)
    if(other[j].length() > other[indexMaxLength].length())
    indexMaxLength = j;
    sda = other[indexMaxLength].length();
    for(int i = 0; i < other.length; i++)
    ja[i] = ((sda - other[i].length()) + 25);
    for(int j = 0; j < ja.length; j++)
    sb[j] = new StringBuilder("");
    for(int g = 0; g < ja[j]; g++)
    sb[j].append(" -");
    text.append("\n\nWHAT I WANT IS THIS: \n\n");
    for(int i = 0; i < other.length; i++)
    String y = (after[i]);
    text.append(other[i] + sb[i].toString() + "> " + y + "\n");
    public static void main (String[] args)
    JFrame.setDefaultLookAndFeelDecorated(true);
    JScrollExample frame = new JScrollExample();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);          
    frame.setVisible(true);
    frame.pack();

    what methods do you think I should use?I think you should use the monospaced font.
    I went to the font metrics page, and I understand what it does.Well, then you should realize that you can't be guaranteed that your column will line up if you attempt to use the FontMetrics class. All the FontMetrics class can tell you is the width of a String.
    You can calculate the width of your longest String and then calculate the width of 25 " -" to get the total width before the second colum. Lets assume this width is 500. Now lets also assume that each " -" string is 10 pixels.
    If we have "i" as the only text and its width is 3 pixels, then how do you calculate a multiple of " -" which will total to 500 pixels?
    Similiarly if you have a "W" as the text and its width is 7 pixels you will never be able to add characters that will total to 500 pixesl.
    So if you need "- - - - >" between column 1 and column 2 the easiest solution is to use a monospaced font.
    If on the other hand you only care about column two lining up in the same postion each time, then you may be able to use tabs in a JTextPane as you can easily control the placement of text for each tab. This posting will give you an idea:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=585006

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • I need help with my code..

    hi guys. as the subject says I need help with my code
    the Q for my code is :
    write a program that reads a positive integer x and calculates and prints a floating point number y if :
    y = 1 ? 1/2 + 1/3 - ? + 1/x
    and this is my code
       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 2; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             int m;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             do
                m = (int) Math.pow( -1, n)/i;
                System.out.println(m);
                   n++;
                   i++;
             while ( m >= 1/x );
          } // end method main
       } // end class Sh7q2 when I compile it there is no error
    but in the run it tells me to enter a positive integer
    suppose i entered 5
    then the result is 1...
    can anyone tell me what's wrong with my code

       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 1; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             double m;
             int a = 1;
             double sum = 0;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             for ( i = 1; a <= x; i++)
                m =  Math.pow( -1, n+1)/i;
                sum  = sum + m;
                n++;
                a++;
             System.out.print("y = " + sum);
          } // end method main
       } // end class Sh7q2is it right :S

  • Need help with WMI code that will send output to db

    'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
    and talks to our server. I also want the code to:
    * check the users computer and find all installed patches
    * the date the patches were installed
    * the serial number of the users computer
    * the computer name, os version, last boot up time, and mac address
    and then have all this output to a database file. At the command prompt I've tried:
    wmic qfe get description, hotfixid
    This does return the patch information I'm looking for, but how do I combine that line of code with:
    wmic os get version, csname, serialnumber, lastbootuptime
    and
    wmic nicconfig get macaddress
    and then get all this to output to a database file?

    Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
    found lots of good information. I also found a good command that will print information to a text file.
    Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
    I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
    updates enable, that's because we are not allowed to.   
    This is my code so far. 
    #if you want the computer name, use this command
    get-content env:computername
    $computer = get-content env:computername
    #list of installed patches
    Get-Hotfix -ComputerName $computer#create a text file listing this information
    Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
    I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
    SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
    way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)?

  • I need Help with Some CSS

    I am in the process of making a new template for my site.
    I can't really provide any code and here's why, I need help finding the code that I need to change. The new template is actually being designed here.
    If you scroll over the home link you will find a sub-menu pops up, if you scroll over the menu items they get bigger and come 'at" you, if you hover over sub-2 and then hover over sub-3 you will notice there is a wild transition effect, I need to know how to get rid of those, it is a different CSS code from another template link to my site. I can't find out how, if somebody could please help me out it would be wonderful. Thank you a whole bunch in advance.

    Your menu moves for a couple of reasons first, you have a border in the hover, which is going to move all of the text.  You can get rid of the border in the hover or add a border of the same size/style in the active.
    The second reason it appears you have some paddng in the hover that moves the text.
    Find those and you can solve the issue.
    Gary

  • Need help with error code 150:30

    need help with finding out what error code 150:30 is and how to fix it

    See the following:
    Error 150:30 - Error "Licensing has stopped working" | Mac OS :
    http://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html

  • Need help with my iTunes on iPhone 5 and Macbook Pro

    Need help with my iPhone 5 and my Macbook Pro.  I was purchased some music on itunes at my mac. Some reason I deleted those music from both on Mac and iPhone 5.  Today, I went to my iPhone iTunes store inside of iCloud to redownload my puchased. But those song won't able to sync back to my iTunes library on my Mac.  Can anyone help me with that ??....

    You've posted to the iTunes Match forum, which your question does not appear to be related to. You'll get better support responses by posting to either the iTunes for Mac or iTunes for Windows forum. Which ever is more appropriate for your situation.

  • I need help with some simple code! Please read!

    hi everyone.
    I'm having problems with a piece of code, and i'd be extremely greatful if somebody could give me a hand with it. I'm totally new to java and have to make a program for my university degree, but i'm finding it extremely difficult, mainly due to my total lack of apptitude for this type of thing. I know this is easy stuff, but the books I have are no use so any help would be greatly appreciated.
    I have to write a program which uses two class files. I want one with the code to produce a simple button, and one to invoke it several times at different locations. I decided to write the program as one class file at first, and thought i'd be able to split it up at later. The program works fine when it is one class file. My book said that to split the two classes up, all i needed to do was change the second class to public, although this seems to not work at all. I'm at my wits end on this, and if anyone could correct my code I'd be eternally greatful.
    Here is the first class... (sorry about the lack of indentation)
    >>>>>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20);
    >>>>>>>
    This is the second class....
    >>>>>>>
    public class PhoneButton {
    private Button butt;
    public PhoneButton(int a, int b, int c){
    setLayout(null);
    butt = new Button();
    butt.setBounds(a,b,20,20);
    add(butt);
    >>>>>>>>
    My compiler generates errors relating to Button, but i can't do anything to please it.
    Also, could anyone give me some pointers on how to add a different number or symbol to each button. That is what I added int c for, but i couldn't get it to work.
    Cheers in advance.
    Michael Morgan

    I found that there are 5 error in your code.
    1. You should import the "java.awt" package to the PhoneButton.java
    2. The PhoneButton is not a kind of Component. You cannot not add it to the Phone class
    3. the myButton = new PhoneButton(20, 20) does not provide enough parameters to create PhoneButton
    4. You cannot add a Button to a PhoneButton. Becaue the PhoneButton is not a kind of Container
    Fixed code:
    import java.awt.*;
    public class PhoneButton extends Button {
    public PhoneButton(int a, int b, int c){
         setBounds(a, b, 20, 20);
         setLabel(String.valueOf(c));
    ===========================================
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20, 1);
    ======================
    Visual Paradigm for UML - Full Features UML CASE tool
    http://www.visual-paradigm.com/

  • Noob needs help with this code...

    Hi,
    I found this code in a nice tutorial and I wanna make slight
    adjustments to the code.
    Unfortunately my Action Script skills are very limited... ;)
    This is the code for a 'sliding menue', depending on which
    button u pressed it will 'slide' to the appropriate picture.
    Here's the code:
    var currentPosition:Number = large_pics.pic1._x;
    var startFlag:Boolean = false;
    menuSlide = function (input:MovieClip) {
    if (startFlag == false) {
    startFlag = true;
    var finalDestination:Number = input._x;
    var distanceMoved:Number = 0;
    var distanceToMove:Number =
    Math.abs(finalDestination-currentPosition);
    var finalSpeed:Number = .2;
    var currentSpeed:Number = 0;
    var dir:Number = 1;
    if (currentPosition<=finalDestination) {
    dir = -1;
    } else if (currentPosition>finalDestination) {
    dir = 1;
    this.onEnterFrame = function() {
    currentSpeed =
    Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
    distanceMoved += currentSpeed;
    large_pics._x += dir*currentSpeed;
    if (Math.abs(distanceMoved-distanceToMove)<=1) {
    large_pics._x =
    mask_pics._x-currentPosition+dir*distanceToMove;
    currentPosition = input._x;
    startFlag = false;
    delete this.onEnterFrame;
    b1.onRelease = function() {
    menuSlide(large_pics.pic1);
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    b3.onRelease = function() {
    menuSlide(large_pics.pic3);
    b4.onRelease = function() {
    menuSlide(large_pics.pic4);
    I need to adjust five things in this code...
    (1) I want this menue to slide vertically not horizontally.
    I changed the 'x' values in the code to 'y' which I thought
    would make it move vertically, but it doesn't work...
    (2) Is it possible that, whatever the distance is, the
    "sliding" time is always 2.2 sec ?
    (3) I need to implement code that after the final position is
    reached, the timeline jumps to a certain movieclip to a certain
    label - depending on what button was pressed of course...
    I tried to implement this code for button number two...
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    --> sliding still works but it doesn't jump to the
    appropriate label...
    (4) I wanna add 'Next' & 'Previous' buttons to the slide
    show - what would be the code in this case scenario ?
    My first thought was something like that Flash checks which
    'pic' movieclip it is showing right now (pic1, pic2, pic3 etc.) and
    depending on what button u pressed u go to the y value of movieclip
    'picX + 1' (Next button) or 'picX - 1' (Previous button)...
    Is that possible ?
    (5) After implementing the Next & Previous buttons I need
    to make sure that when it reached the last pic movieclip it will
    not go further on the y value - because there is no more pic
    movieclip.
    Options are to either slide back to movieclip 'pic1' or
    simply do nothing any more on the next button...
    I know this is probably Kindergarten for you, but I have only
    slight ideas how to do this and no code knowledge to back it up...
    haha
    Thanx a lot for your help in advance !
    Always a pleasure to learn from u guys... ;)
    Mike

    Hi,
    I made some progress with the code thanx to the help of
    Simon, but there are still 2 things that need to be addressed...
    (1) I want the sliding time always to be 2.2 sec...
    here's my approach to it - just a theory but it might work:
    we need a speed that changes dynamically depending on the
    distance we have to travel...
    I don't know if that applies for Action Scrip but I recall
    from 6th grade, that...
    speed = distance / time
    --> we got the time (which is always 2.2 sec)
    --> we got the disctance
    (currentposition-finaldestination)
    --> this should automatically change the speed to the
    appropriate value
    Unfortunately I have no clue how the action script would look
    like (like I said my action script skills are very limited)...
    (2) Also, one other thing I need that is not implemented yet,
    is that when the final destination is reached it jumps to a certain
    label inside a certain movieclip - every time different for each
    button pressed - something like:
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    that statement just doesn't work when I put it right under
    the function for each button...
    Thanx again for taking the time !!!
    Mike

  • Beginner needs help with simple code.

    I just statrted learnind java, and I need some help with this simple program. For some reason everytime I enter my Farenheit value, the Celsius conversion returns as 0.0. Would really appreciate the help. Thanks.
    Here's the code:
    public class TempConverter
    public static void main(String[] args)
    double F = Double.parseDouble(args[0]);
    System.out.println("Temperature in Farenheit is: " + F);
    double C = 5 / 9;
    C *= (F - 32);
    System.out.println("Temperature in Celsius is: " + C);
    }

    double C = 5 / 9This considers "5" and "9" to be integers and does an integer division, discarding the remainder. The result of that division is 0. Trydouble C = 5.0/9.0;

  • Need help with HTML5 code

    What is wrong with this code?  It does not play. It should play in Windows-7 and XP with IE8.
    Also, on the screen there is a large white area where the <video> code is.  Why?
    How do I get rid of it?
    Thanks.
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>video testing</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <body>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download mp4 </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download">http:// www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download webm </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download ogg </a> button to start video.</p>
    <p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download flv </a> button to start video.</p>
    <video width="480" height="270" controls="controls">
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.mp4"  type='video/mp4; codecs="vp8, vorbis"' />
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.webm" type='video/webm; codecs="avc1.42E01E, mp4a.40.2"' />
    <source media="all" src="rtp:UX-CT-Tour-Short-1024d12dB.ogg" type="video/ogv; codecs=&quot;theora, vorbis&quot;" />
    <object data="id=player1" width="480" height="270">
        <param name="classid" value="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" />
        <param name="movie" value="player.swf" />
        <param name="flashvars" value="UX-CT-Tour-Short-1024d12db.flv & autostart=true" />
        <param name="allowfullscreen" value="false" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="allowscriptaccess" value="always" />
    <embed flashvars="file=UX-CT-Tour-Short-1024d12db.flv & autostart=true" id="player1" src="player.swf"
    allowfullscreen="true" allowscriptaccess="always" width="480" height="270" />
    </object>
    </video>
    <p>here is some more text</p>
    </body>
    </html>

    Data load? Did it pass a syntax check?
    Anyway, maybe this will help:
    DATA: create_date              TYPE sy-datum,
          update_date              TYPE sy-datum,
          number_of_days_closed(4) TYPE c,
          alert_close_flag(1)      TYPE c,
          result                   LIKE number_of_days_closed.
    IF alert_close_flag EQ 'Y'.
      number_of_days_closed = update_date - create_date .
    ELSE.
      CLEAR number_of_days_closed.
    ENDIF.
    result = number_of_days_closed.
    Rob

  • [8i] Need help with some workday calculations

    At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
    Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
    But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
    Note: I'm working with Oracle 8i

    OK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
    CREATE TABLE caln
    (     clndr_dt     DATE          NOT NULL
    ,     clndr_yr     NUMBER
    ,     shop_day     NUMBER
    ,     shop_dt          DATE
    ,     shop_wk          NUMBER
    ,     shop_yr          NUMBER
    ,     shop_days     NUMBER
    ,     clndr_days     NUMBER
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
    INSERT INTO     caln
    VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
    INSERT INTO     caln
    VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
    INSERT INTO     caln
    VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
    INSERT INTO     caln
    VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
    INSERT INTO     caln
    VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
    INSERT INTO     caln
    VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
    INSERT INTO     caln
    VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
    INSERT INTO     caln
    VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
    INSERT INTO     caln
    VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
    INSERT INTO     caln
    VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
    INSERT INTO     caln
    VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
    INSERT INTO     caln
    VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
    INSERT INTO     caln
    VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
    INSERT INTO     caln
    VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
    INSERT INTO     caln
    VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
    INSERT INTO     caln
    VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
    INSERT INTO     caln
    VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
    INSERT INTO     caln
    VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
    INSERT INTO     caln
    VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
    INSERT INTO     caln
    VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
    INSERT INTO     caln
    VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
    INSERT INTO     caln
    VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
    INSERT INTO     caln
    VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
    INSERT INTO     caln
    VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
    INSERT INTO     caln
    VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
    INSERT INTO     caln
    VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
    INSERT INTO     caln
    VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
    INSERT INTO     caln
    VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
    INSERT INTO     caln
    VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
    INSERT INTO     caln
    VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
    INSERT INTO     caln
    VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
    INSERT INTO     caln
    VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
    INSERT INTO     caln
    VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
    INSERT INTO     caln
    VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
    INSERT INTO     caln
    VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
    INSERT INTO     caln
    VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
    INSERT INTO     caln
    VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
    INSERT INTO     caln
    VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
    INSERT INTO     caln
    VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
    INSERT INTO     caln
    VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
    INSERT INTO     caln
    VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
    INSERT INTO     caln
    VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
    INSERT INTO     caln
    VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
    INSERT INTO     caln
    VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
    INSERT INTO     caln
    VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
    INSERT INTO     caln
    VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
    INSERT INTO     caln
    VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
    INSERT INTO     caln
    VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
    INSERT INTO     caln
    VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
    INSERT INTO     caln
    VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
    INSERT INTO     caln
    VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
    CREATE TABLE ords
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     ord_stat     VARCHAR2(2)
    ,     ord_qty          NUMBER
    ,     part_nbr     VARCHAR2(5)
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
    INSERT INTO     ords
    VALUES (1,1,'CL',10,'PART1');
    INSERT INTO     ords
    VALUES (1,2,'CL',5,'PART1');
    INSERT INTO     ords
    VALUES (25,1,'CL',15,'PART2');
    INSERT INTO     ords
    VALUES (14,1,'OP',12,'PART3');
    INSERT INTO     ords
    VALUES (33,1,'CL',25,'PART1');
    INSERT INTO     ords
    VALUES (33,2,'CL',15,'PART1');
    INSERT INTO     ords
    VALUES (33,3,'OP',10,'PART1');
    INSERT INTO     ords
    VALUES (7,1,'PL',18,'PART2');
    INSERT INTO     ords
    VALUES (96,1,'PL',10,'PART3');
    INSERT INTO     ords
    VALUES (31,1,'CL',20,'PART2');
    CREATE TABLE oops
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     op_nbr          VARCHAR2(4)     NOT NULL
    ,     mach_id          VARCHAR2(4)
    ,     oper_stat     VARCHAR2(2)
    ,     plan_start_dt     DATE
    ,     plsu          NUMBER
    ,     plrn          NUMBER
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
    -- NOTE:
    -- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
    -- in more than two operations (though in reality more would be there) since they should be
    -- ignored in the final result anyway
    INSERT INTO     oops
    VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
    INSERT INTO     oops
    VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
    INSERT INTO     oops
    VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
    INSERT INTO     oops
    VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
    INSERT INTO     oops
    VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    CREATE TABLE mach
    (     mach_id          VARCHAR2(4)     NOT NULL
    ,     desc_short     VARCHAR2(9)     
    ,     group          VARCHAR2(7)
         CONSTRAINT ords_pk PRIMARY KEY (mach_id)
    INSERT INTO     mach
    VALUES     ('123A','desc here','GROUPH1');
    INSERT INTO     mach
    VALUES     ('259B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('110C','desc here','GROUPJ1');
    INSERT INTO     mach
    VALUES     ('050C','desc here','GROUPK2');
    INSERT INTO     mach
    VALUES     ('220B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('150G','desc here','GROUPL1');
    INSERT INTO     mach
    VALUES     ('250G','desc here','GROUPL2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');

  • Need Help with this code

    I am very new to java (just started today), and I am trying to do a mortgage calculator in java. I have a class file which I am using but when I try to compile it, I get the error message "Exception in thread "main" java.lang.NoClassDefFoundError: Mortgage Loan". I realize that this means I am missing a public static void somewhere (sounds like I know what I am talking about huh?) The problem is I don't know where to put it or even what to put in it. I got the code from another site and it seems to work fine there. Here is the code for the class file....any help anyone can offer will be greatly appreciated. thx
    import KJEgraph.*;
    import KJEgui.*;
    import java.applet.Applet;
    import java.awt.*;
    import java.io.PrintStream;
    public class MortgageLoan extends CalculatorApplet
    public MortgageLoan()
    RC = new MortgageLoanCalculation();
    cmbPREPAY_TYPE = new KJEChoice();
    lbLOAN_AMOUNT = new Label("");
    lbINTEREST_PAID = new Label("");
    lbTOTAL_OF_PAYMENTS = new Label("");
    lbMONTHLY_PI = new Label("");
    lbMONTHLY_PITI = new Label("");
    lbPREPAY_INTEREST_SAVINGS = new Label("");
    public double getPayment()
    calculate();
    return RC.MONTHLY_PI;
    public void initCalculatorApplet()
    tfINTEREST_RATE = new Nbr("INTEREST_RATE", "Interest rate", 1.0D, 25D, 3, 4, this);
    tfTERM = new Nbr("TERM", "Term", 0.0D, 30D, 0, 5, this);
    tfLOAN_AMOUNT = new Nbr("LOAN_AMOUNT", "Mortgage amount", 100D, 100000000D, 0, 3, this);
    tfPREPAY_STARTS_WITH = new Nbr("PREPAY_STARTS_WITH", "Start with payment", 0.0D, 360D, 0, 5, this);
    tfPREPAY_AMOUNT = new Nbr("PREPAY_AMOUNT", "Amount", 0.0D, 1000000D, 0, 3, this);
    if(getParameter("PAYMENT_PI") == null)
    tfPAYMENT_PI = new Nbr(0.0D, getParameter("MSG_PAYMENT_PI", "Payment"), 0.0D, 10000D, 0, 3);
    else
    tfPAYMENT_PI = new Nbr("PAYMENT_PI", "Payment", 0.0D, 10000D, 0, 3, this);
    tfYEARLY_PROPERTY_TAXES = new Nbr("YEARLY_PROPERTY_TAXES", "Annual property taxes", 0.0D, 100000D, 0, 3, this);
    tfYEARLY_HOME_INSURANCE = new Nbr("YEARLY_HOME_INSURANCE", "Annual home insurance", 0.0D, 100000D, 0, 3, this);
    super.nStack = 1;
    super.bUseNorth = false;
    super.bUseSouth = true;
    super.bUseWest = true;
    super.bUseEast = false;
    RC.PREPAY_NONE = getParameter("MSG_PREPAY_NONE", RC.PREPAY_NONE);
    RC.PREPAY_MONTHLY = getParameter("MSG_PREPAY_MONTHLY", RC.PREPAY_MONTHLY);
    RC.PREPAY_YEARLY = getParameter("MSG_PREPAY_YEARLY", RC.PREPAY_YEARLY);
    RC.PREPAY_ONETIME = getParameter("MSG_PREPAY_ONETIME", RC.PREPAY_ONETIME);
    RC.MSG_YEAR_NUMBER = getParameter("MSG_YEAR_NUMBER", RC.MSG_YEAR_NUMBER);
    RC.MSG_PRINCIPAL = getParameter("MSG_PRINCIPAL", RC.MSG_PRINCIPAL);
    RC.MSG_INTEREST = getParameter("MSG_INTEREST", RC.MSG_INTEREST);
    RC.MSG_PAYMENT_NUMBER = getParameter("MSG_PAYMENT_NUMBER", RC.MSG_PAYMENT_NUMBER);
    RC.MSG_PRINCIPAL_BALANCE = getParameter("MSG_PRINCIPAL_BALANCE", RC.MSG_PRINCIPAL_BALANCE);
    RC.MSG_PREPAYMENTS = getParameter("MSG_PREPAYMENTS", RC.MSG_PREPAYMENTS);
    RC.MSG_NORMAL_PAYMENTS = getParameter("MSG_NORMAL_PAYMENTS", RC.MSG_NORMAL_PAYMENTS);
    RC.MSG_PREPAY_MESSAGE = getParameter("MSG_PREPAY_MESSAGE", RC.MSG_PREPAY_MESSAGE);
    RC.MSG_RETURN_AMOUNT = getParameter("MSG_RETURN_AMOUNT", RC.MSG_RETURN_AMOUNT);
    RC.MSG_RETURN_PAYMENT = getParameter("MSG_RETURN_PAYMENT", RC.MSG_RETURN_PAYMENT);
    RC.MSG_GRAPH_COL1 = getParameter("MSG_GRAPH_COL1", RC.MSG_GRAPH_COL1);
    RC.MSG_GRAPH_COL2 = getParameter("MSG_GRAPH_COL2", RC.MSG_GRAPH_COL2);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_NONE);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_MONTHLY);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_YEARLY);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_ONETIME);
    cmbPREPAY_TYPE.select(getParameter("PREPAY_TYPE", RC.PREPAY_NONE));
    CheckboxGroup checkboxgroup = new CheckboxGroup();
    cbPRINCIPAL = new Checkbox(getParameter("MSG_CHKBOX_PRINCIPAL_BAL", "Principal balances"), checkboxgroup, true);
    cbAMTS_PAID = new Checkbox(getParameter("MSG_CHKBOX_TOTAL_PAYMENTS", "Total payments"), checkboxgroup, false);
    CheckboxGroup checkboxgroup1 = new CheckboxGroup();
    cbYEAR = new Checkbox(getParameter("MSG_CHKBOX_BY_YEAR", "Report amortization schedule by year"), checkboxgroup1, true);
    cbMONTH = new Checkbox(getParameter("MSG_CHKBOX_BY_MONTH", "Report amortization schedule by Month"), checkboxgroup1, false);
    cbYEAR.setBackground(getBackground());
    cbMONTH.setBackground(getBackground());
    setCalculation(RC);
    cmbTERM = getMortgageTermChoice(getParameter("TERM", 30));
    public void initPanels()
    DataPanel datapanel = new DataPanel();
    DataPanel datapanel1 = new DataPanel();
    DataPanel datapanel2 = new DataPanel();
    int i = 1;
    datapanel.setBackground(getColor(1));
    boolean flag = getParameter("SHOW_PITI", false);
    boolean flag1 = getParameter("SHOW_PREPAY", true);
    datapanel.addRow(new Label(" " + getParameter("MSG_LOAN_INFORMATION", "Loan Information") + super._COLON), getBoldFont(), i++);
    datapanel.addRow(tfLOAN_AMOUNT, getPlainFont(), i++);
    bAllTerms = getParameter("SHOW_ALLTERMS", false);
    if(bAllTerms)
    datapanel.addRow(tfTERM, getPlainFont(), i++);
    else
    datapanel.addRow(getParameter("MSG_TERM", "Term") + super._COLON, cmbTERM, getPlainFont(), i++);
    datapanel.addRow(tfINTEREST_RATE, getPlainFont(), i++);
    if(flag)
    datapanel.addRow(tfYEARLY_PROPERTY_TAXES, getPlainFont(), i++);
    datapanel.addRow(tfYEARLY_HOME_INSURANCE, getPlainFont(), i++);
    if(flag)
    datapanel.addRow(getParameter("MSG_MONTHLY_PAYMENT", "Monthly payment (PI)") + " " + super._COLON, lbMONTHLY_PI, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_PITI", "Monthly payment (PITI)") + " " + super._COLON, lbMONTHLY_PITI, getPlainFont(), i++);
    } else
    datapanel.addRow(getParameter("MSG_MONTHLY_PAYMENT", "Monthly payment") + " " + super._COLON, lbMONTHLY_PI, getPlainFont(), i++);
    if(!flag || !flag1)
    datapanel.addRow(getParameter("MSG_TOTAL_PAYMENTS", "Total payments") + " " + super._COLON, lbTOTAL_OF_PAYMENTS, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_TOTAL_INTEREST", "Total interest") + " " + super._COLON, lbINTEREST_PAID, getPlainFont(), i++);
    datapanel.addRow("", new Label(""), getTinyFont(), i++);
    if(flag1)
    datapanel.addRow(new Label(" " + getParameter("MSG_PREPAYMENTS", "Prepayments") + " " + super._COLON), getBoldFont(), i++);
    datapanel.addRow(getParameter("MSG_PREPAYMENT_TYPE", "Type") + " " + super._COLON, cmbPREPAY_TYPE, getPlainFont(), i++);
    datapanel.addRow(tfPREPAY_AMOUNT, getPlainFont(), i++);
    datapanel.addRow(tfPREPAY_STARTS_WITH, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_PREPAYMENT_SAVINGS", "Savings") + " " + super._COLON, lbPREPAY_INTEREST_SAVINGS, getPlainFont(), i++);
    Panel panel = new Panel();
    panel.setBackground(getColor(1));
    panel.setLayout(new BorderLayout());
    panel.add("Center", datapanel);
    panel.add("East", new Label(""));
    cbPRINCIPAL.setBackground(getColor(2));
    cbAMTS_PAID.setBackground(getColor(2));
    datapanel2.setBackground(getColor(2));
    datapanel1.addRow("", cbYEAR, "", cbMONTH, getPlainFont(), 1);
    datapanel2.addRow("", cbPRINCIPAL, "", cbAMTS_PAID, getPlainFont(), 1);
    gGraph = new Graph(new GraphLine(), imageBackground());
    gGraph.FONT_TITLE = getGraphTitleFont();
    gGraph.FONT_BOLD = getBoldFont();
    gGraph.FONT_PLAIN = getPlainFont();
    gGraph.setBackground(getColor(2));
    gGraph.setForeground(getForeground());
    Panel panel1 = new Panel();
    panel1.setLayout(new BorderLayout());
    panel1.add("North", datapanel2);
    panel1.add("Center", gGraph);
    panel1.setBackground(getColor(2));
    addPanel(panel);
    addDataPanel(datapanel1);
    addPanel(panel1);
    public void refresh()
    gGraph._bUseTextImages = false;
    if(cbAMTS_PAID.getState())
    gGraph.setBackground(getColor(2));
    gGraph.removeAll();
    gGraph._legend.setVisible(true);
    gGraph._legend.setOrientation(14);
    gGraph._titleXAxis.setText("");
    gGraph._titleGraph.setText("");
    gGraph._axisX.setVisible(true);
    gGraph._axisY.setVisible(true);
    gGraph.setGraphType(new GraphStacked());
    gGraph.setGraphCatagories(RC.getAmountPaidCatagories());
    try
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL, RC.MSG_PRINCIPAL, getGraphColor(1)));
    gGraph.add(new GraphDataSeries(RC.DS_INTEREST, RC.MSG_INTEREST, getGraphColor(2)));
    gGraph._axisY._bAutoMinimum = false;
    gGraph._axisY._axisMinimum = 0.0F;
    gGraph._axisY._bAutoMaximum = false;
    gGraph._axisY._axisMaximum = (float)(RC.TOTAL_OF_PAYMENTS / (double)RC.iFactor2);
    catch(Exception _ex)
    System.out.println("Huh?");
    gGraph._titleYAxis.setText("");
    gGraph._titleGraph.setText(RC.getAmountLabel2());
    gGraph.dataChanged(true);
    } else
    gGraph.setBackground(getColor(2));
    gGraph.removeAll();
    gGraph._legend.setVisible(true);
    gGraph._legend.setOrientation(4);
    gGraph._titleXAxis.setText(RC.MSG_PAYMENT_NUMBER);
    gGraph._titleGraph.setText("");
    gGraph._titleYAxis.setText(RC.MSG_PRINCIPAL_BALANCE);
    gGraph._axisX.setVisible(true);
    gGraph._axisY.setVisible(true);
    gGraph.setGraphType(new GraphLine());
    gGraph.setGraphCatagories(RC.getCatagories());
    try
    if(cmbPREPAY_TYPE.getSelectedItem().equals(RC.PREPAY_NONE))
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL_BAL, RC.MSG_NORMAL_PAYMENTS, getGraphColor(1)));
    } else
    gGraph.add(new GraphDataSeries(RC.DS_PREPAY_PRINCIPAL_BAL, RC.MSG_PREPAYMENTS, getGraphColor(2)));
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL_BAL, RC.MSG_NORMAL_PAYMENTS, getGraphColor(1)));
    gGraph._axisY._bAutoMinimum = false;
    gGraph._axisY._bAutoMaximum = true;
    gGraph._axisY._axisMinimum = 0.0F;
    catch(Exception _ex)
    System.out.println("Huh?");
    gGraph._titleYAxis.setText(RC.getAmountLabel());
    gGraph._titleGraph.setText("");
    gGraph.dataChanged(true);
    gGraph._titleXAxis.setText(RC.MSG_YEAR_NUMBER);
    lbMONTHLY_PITI.setText(Fmt.dollars(RC.MONTHLY_PITI, 2));
    lbMONTHLY_PI.setText(Fmt.dollars(RC.MONTHLY_PI, 2));
    lbLOAN_AMOUNT.setText(Fmt.dollars(RC.LOAN_AMOUNT));
    lbTOTAL_OF_PAYMENTS.setText(Fmt.dollars(RC.PREPAY_TOTAL_OF_PAYMENTS, 2));
    lbINTEREST_PAID.setText(Fmt.dollars(RC.PREPAY_INTEREST_PAID, 2));
    lbPREPAY_INTEREST_SAVINGS.setText(Fmt.dollars(RC.PREPAY_INTEREST_SAVINGS, 2));
    setTitle("Fixed Mortgage Loan Calculator");
    public void setValues()
    throws NumberFormatException
    RC.PREPAY_TYPE = cmbPREPAY_TYPE.getSelectedItem();
    RC.PREPAY_AMOUNT = tfPREPAY_AMOUNT.toDouble();
    RC.PREPAY_STARTS_WITH = tfPREPAY_STARTS_WITH.toDouble();
    RC.INTEREST_RATE = tfINTEREST_RATE.toDouble();
    RC.YEARLY_PROPERTY_TAXES = tfYEARLY_PROPERTY_TAXES.toDouble();
    RC.YEARLY_HOME_INSURANCE = tfYEARLY_HOME_INSURANCE.toDouble();
    if(bAllTerms)
    RC.TERM = (int)tfTERM.toDouble();
    else
    RC.TERM = getMortgageTerm(cmbTERM);
    RC.LOAN_AMOUNT = tfLOAN_AMOUNT.toDouble();
    if(cbYEAR.getState())
    RC.BY_YEAR = 1;
    else
    RC.BY_YEAR = 0;
    RC.MONTHLY_PI = tfPAYMENT_PI.toDouble();
    if(RC.MONTHLY_PI > 0.0D)
    RC.PAYMENT_CALC = 0;
    else
    RC.PAYMENT_CALC = 1;
    MortgageLoanCalculation RC;
    Nbr tfINTEREST_RATE;
    Choice cmbTERM;
    Nbr tfTERM;
    boolean bAllTerms;
    Nbr tfLOAN_AMOUNT;
    Nbr tfPREPAY_AMOUNT;
    Nbr tfPREPAY_STARTS_WITH;
    Nbr tfPAYMENT_PI;
    Nbr tfYEARLY_PROPERTY_TAXES;
    Nbr tfYEARLY_HOME_INSURANCE;
    KJEChoice cmbPREPAY_TYPE;
    Label lbLOAN_AMOUNT;
    Label lbINTEREST_PAID;
    Label lbTOTAL_OF_PAYMENTS;
    Label lbMONTHLY_PI;
    Label lbMONTHLY_PITI;
    Label lbPREPAY_INTEREST_SAVINGS;
    Checkbox cbPRINCIPAL;
    Checkbox cbAMTS_PAID;
    Graph gGraph;
    Checkbox cbYEAR;
    Checkbox cbMONTH;
    }

    There are imports that aren't available to us, so no. nobody probaly can. Of course maybe someon could be bothered going through all of your code, and may spot some mistake. But I doubt they will since you didn't bother to use [c[b]ode] tags.

  • Need help with some encoding stuff

    Hi guys!
    i have a problem: i hava some string which contains 0 or 1 (bit sequence), now i want to write it to file but in encoded way: i take first 7 bits and write to file the char that that this sequence mean in unicode. but when i read from the necoded file and turn the chars back to bit sequence( i dont forget to put some 0) to complete to 7 bit) i get not the original String:
    i have string se which is bit sequences:
    PrintWriter out = new PrintWriter(new FileWriter("t.txt"));
    while(se.length()>=7)
    parsed = Integer.parseInt(se.substring(0,7), 2);
         ch2=(char)parsed;
         out.print(ch2);
         se=se.substring(7);
    BufferedReader in = new BufferedReader(new FileReader("t.txt"));
    while (line != null)
         for(int i=0;i<line.length();i++)
              ch=line.charAt(i);
              j=(int)ch;
              file=file+lineup(Integer.toBinaryString(j),7);
         line = in.readLine();
    private String lineup(String b, int a)
         String s="";
         for(int i=0;i<(a-b.length());i++)
              s=s+"0";
         s=s+b;
         return s;
    please help me. if i explained something and it's unclear ask me. thanx in advance!!!!

    Encode(String se)
         try
              char ch,ch2;
              int index, parsed;
              String buffer="";
              BufferedReader in = new BufferedReader(new FileReader("in.txt"));                                    PrintWriter out = new PrintWriter(new FileWriter("transmit.txt"));
              while(se.length()>=7)
                   parsed = Integer.parseInt(se.substring(0,7), 2);
                   ch2=(char)parsed;
                   out.print(ch2);
                   se=se.substring(7);
              }then it checks if there are any bits left and makes something with it.
    readFile(String file)
                          String file="";
         char ch;
         int j;
         try
              BufferedReader in = new BufferedReader(new FileReader("transmit.txt"));
              String line = in.readLine();
              while (line != null)
                   for(int i=0;i<line.length();i++)
                        ch=line.charAt(i);
                        j=(int)ch;
                        file=file+lineup(Integer.toBinaryString(j),7);
                   line = in.readLine();
              System.out.println(file.substring(0,13));
              in.close();
    [/Code]
    [Code]
    lineup(String a, int b)
                          String s="";
                          for(int i=0;i<(a-b.length());i++)
         s=s+"0";
                          s=s+b;
         return s;
    }[/Code]
    like  i said it works perfect with small strings, it has problems when it encodes some special char like cr and then it makes problems and i want to know how can i treat it that it will work!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Cannot run workbook from desktop

    Greetings All, Discoverer version 10.1.2.0.2, Disco Admin has created business areas and workbooks. Admin has also shared workbook with a user. When user tried to run workbook user is not prompted for parameters. WHen user refreshes worksheet still n

  • FrameMaker 10 Online Training Courses

    I am new to FrameMaker and am looking for a good quality online course to cover the use of FrameMaker and development of structured documents. Any recommendations would be appreciated. I prefer something video based with ongoing access to review as n

  • How to set profit ctr for AR clearing difference

    How could I change the default profit center for customer clearing differences? I have set the account in clearing differences correctly but it automatically posted to BS default profit center. How can I define the profit center for this automatic cl

  • Info button on playback

    I have modified one of the playback toolbars so the info button is not displayed, (works well), but I want to add an info button in order to show a popup info window of my own design. all i have managed to do so far (less desirable option), is add a

  • Weird kernel panics all the time. All debugging information provided...

    Mac mini Core Duo 1,66Ghz. 2x256Mb 3rd party memory. Tested in Hardware Test and memtest (8 times, from single user mode). All tests passed ok. Also, permissions fixed and partition verified Tried with Mac OS 10.4.8 and then after "Archive & install"