Need a little help with this method

this is what i need to do:
Add a static method Account consolidate(Account acct1, Account acct2) to your Account class that creates a new
account whose balance is the sum of the balances in acct1 and acct2 and closes acct1 and acct2. The new account should
be returned. Two important rules of consolidation:
? Only accounts with the same name can be consolidated. The new account gets the name on the old accounts but a
new account number (a random number).
? Two accounts with the same number cannot be consolidated. Otherwise this would be an easy way to double your
money!
right now i have this code but im not too positive i did it right (and i know its not done, but i just need some tips on what to do)
     public static Account AccountConsolidate(Account acct1, Account acct2)
          String name1 = acct1.getName();
          String name2 = acct2.getName();
          if(name1.equals(name2));
          newAccount = acct1.getBalance() + acct2.getBalance();
          newAccount = newAccount.getAcctNum();
          close acct2;
          return newAccount;
     }

1. "close" is not a Java keyword.
2. "newAccount" is being assigned twice.
Not that there's anything wrong with that but what's
the first assignment doing?
3. "newAccount" seems to be an int but your
method signature says to return an Account
object.this is my entire code, and i made some changes in the consolidateAccount method
// Account.java
// A bank account class with methods to deposit to, withdraw from,
// change the name on, and get a String representation
// of the account.
public class Account
     private double balance;
     private String name;
     private long acctNum;
     private static int numAccounts;
     private double newAccount;
//Constructor -- initializes balance, owner, and account number
     public Account(double initBal, String owner, long number)
          balance = initBal;
          name = owner;
          acctNum = number;
          numAccounts++;
// Checks to see if balance is sufficient for withdrawal.
// If so, decrements balance by amount; if not, prints message.
     public void withdraw(double amount)
          if (balance >= amount)
          balance -= amount;
          else
          System.out.println("Insufficient funds");
// Adds deposit amount to balance.
     public void deposit(double amount)
          balance += amount;
// Returns balance.
     public double getBalance()
          return balance;
//Returns number of accounts created
     public static int getNumAccounts()
          return numAccounts;
// Returns name on the account
     public String getName()
          return name;
// Returns account number
     public long getAcctNum()
          return acctNum;
// Close the current account.
     public void close()
          if (balance == 0)
          numAccounts--;
          System.out.println("CLOSED");
// Consolidates two accounts into one account.
     public static Account AccountConsolidate(Account acct1, Account acct2)
          String name1 = acct1.getName();
          String name2 = acct2.getName();
          if(name1.equals(name2));
          newAccount = acct1.getBalance() + acct2.getBalance();
          newAccount = newAccount.getAcctNum();
          Account consolidated = new Account(balance, name, newNumber);
          return consolidated;
// Returns a string containing the name, account number, and balance.
     public String toString()
          return "Name:" + name +
          "\nAccount Number: " + acctNum +
          "\nBalance: " + balance;
     

Similar Messages

  • Need a little help with this factory pattern thing..

    Evening all,
    I have an assignment to do over easter, before i start i will say i dont want any code or anything so this isnt 'cheating' or whatever..
    This was the brief:
    A vending machine dispenses tea and coffee, to which may be added milk, and 0, 1 or 2 doses of sugar. When the machine is loaded it initially contains 100 doses of tea, 100 doses of coffee 50 doses of milk and 70 doses of sugar. After it has been in use for a while it may run out one or more items. For example, it may run out of sugar, in which case it would continue to vend tea, coffee, tea with milk, and coffee with milk. Periodically, an attendant recharges the machine to full capacity with doses of coffee, tea, milk and sugar. A user selects the required beverage, selects the required amount of sugar, and selects milk if required. The machine responds with a message telling the user the cost of the drink (coffee is 30P, tea 20P, milk 10P, and sugar 5P per dose). The user inserts coins (the machine accepts 10P and 5P coins), and when the required sum or more has been inserted, the machine dispenses the beverage, and possibly some change.
    You are to write a program that simulates the above vending machine. Your solution must use the class factory pattern, and make use of the code templates provided. The user interface should be constructed with a Swing JFrame object.
    We were suppled with code for all of the classes required except for the JFrame.. They are as follows:
    public abstract class Beverage
      int sugar;
      boolean milk;
      public String getMessage()
        String name = this.getClass().getName();
        String sugarMessage = "";
        if (sugar == 1) sugarMessage = "one sugar";
        if (sugar == 2) sugarMessage = "two sugars";
        if (sugar == 0) sugarMessage = "";
        return  "Vended 1 " + name  +  (milk ? " with milk " : "") + (sugar==1 || sugar == 2 ? (milk ? "and " + sugarMessage : " with " + sugarMessage) : "");
    public class Coffee extends Beverage
      public Coffee( int sugar, boolean milk)
        this.sugar = sugar;
        this.milk = milk;
    public class Tea extends Beverage
      public Tea(int sugar, boolean milk)
        this.sugar = sugar;
        this.milk = milk;
    public class SugarButtonsGroup
      private JRadioButton jRadioButton0Sugar = new JRadioButton();
      private JRadioButton jRadioButton1Sugar = new JRadioButton();
      private JRadioButton jRadioButton2Sugar = new JRadioButton();
      private ButtonGroup sugarButtons = new ButtonGroup();
      public SugarButtonsGroup()
        jRadioButton0Sugar.setText("No sugar");
        jRadioButton1Sugar.setText("1 sugar");
        jRadioButton2Sugar.setText("2 sugars");
        sugarButtons.add(this.jRadioButton0Sugar);
        sugarButtons.add(this.jRadioButton1Sugar);
        sugarButtons.add(this.jRadioButton2Sugar);
      public int numberOfSugars()
        if (this.jRadioButton1Sugar.isSelected()) return 1;
        if (this.jRadioButton2Sugar.isSelected()) return 2;
        return 0;
      public ButtonGroup getButtonGroup()
        return sugarButtons;
      public JRadioButton getJRadioButton0Sugar()
        return jRadioButton0Sugar;
      public JRadioButton getJRadioButton1Sugar()
        return jRadioButton1Sugar;
      public JRadioButton getJRadioButton2Sugar()
        return jRadioButton2Sugar;
    public class BeverageButtonsGroup
      private JRadioButton jRadioButtonTea = new JRadioButton();
      private JRadioButton jRadioButtonCoffee = new JRadioButton();
      private ButtonGroup buttonGroup = new ButtonGroup();
      public BeverageButtonsGroup()
        buttonGroup.add(jRadioButtonTea);
        buttonGroup.add(jRadioButtonCoffee);
        jRadioButtonTea.setText("Tea");
        jRadioButtonCoffee.setText("Coffee");
        jRadioButtonCoffee.setSelected(true);
      public String getBeverageName()
        if (jRadioButtonTea.isSelected()) return "tea";
        if (jRadioButtonCoffee.isSelected()) return "coffee";
        return "";
      public ButtonGroup getBeverageButtonGroup()
        return buttonGroup;
      public JRadioButton getJRadioButtonTea()
        return jRadioButtonTea;
       public JRadioButton getJRadioButtonCoffee()
        return jRadioButtonCoffee;
    public class MilkCheck
      private JCheckBox jCheckBoxMilk = new JCheckBox();
      public MilkCheck()
        this.jCheckBoxMilk.setText("Milk");
      public JCheckBox getJCheckBoxMilk()
        return jCheckBoxMilk;
      public boolean withMilk()
        return this.jCheckBoxMilk.isSelected();
    public class CoinMechanism
      private JButton jButton5P = new JButton();
      private JButton jButton10P = new JButton();
      private JTextField jTextFieldTotal = new JTextField();
      private BeverageFactory b;
      public CoinMechanism (BeverageFactory b)
        this.b = b;
        reset();
        jTextFieldTotal.setEditable(false);
        jButton5P.setText("Insert 5 pence");
        jButton5P.addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent e)
              jButton5P_actionPerformed(e);
        jButton10P.setText("Insert 10 pence");
        jButton10P.addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent e)
              jButton10P_actionPerformed(e);
      private void jButton5P_actionPerformed(ActionEvent e)
        // to be completed
      private void jButton10P_actionPerformed(ActionEvent e)
        // to be completed
      private void notifyVend()
        b.getCoinCurrentTotal(jTextFieldTotal.getText());
      public void reset()
         this.jTextFieldTotal.setText("0");
      public JButton getJButton5P()
        return this.jButton5P;
      public JButton getJButton10P()
        return this.jButton10P;
      public JTextField getJTextFieldTotal()
        return this.jTextFieldTotal;
    public class BeverageFactory
      private int coffees;
      private int teas;
      private int milks;
      private int sugars;
      public BeverageButtonsGroup beverageButtons = new BeverageButtonsGroup();
      public SugarButtonsGroup sugarButtons = new SugarButtonsGroup();
      public MilkCheck milkCheck = new MilkCheck();
      public CoinMechanism slots = new CoinMechanism(this);
      public void setUIState()
        // sets the states of the widgets on the frame accoording to the
        // quantities of supplies in the machine
        // to be finished
      public void getCoinCurrentTotal (String o)
        // this is should be executed whenever a user puts a coin into the machine
        int foo = Integer.parseInt(o);
        // to be finished
      private int cost()
        // returns the cost of the currently selected beverage
        // to be finished
      public BeverageFactory( int coffees, int teas, int milks, int sugars)
        this.coffees = coffees;
        this.teas = teas;
        this.milks = milks;
        this.sugars = sugars;
      public void refill(int coffees, int teas, int milks, int sugars)
        // to be completed
      public Beverage makeBeverage(String name, boolean milk, int sugar)
        if (name.compareTo("coffee") == 0)
          coffees--;
          if (milk) milks--;
          sugars = sugars - sugar;
          return new Coffee(sugar,milk);
        if (name.compareTo("tea") == 0)
          teas--;
          if (milk) milks--;
          sugars = sugars - sugar;
          return new Tea(sugar, milk);
        return null;
    }Okay, well if you read through all that, blimey thanks a lot!.
    My question relates to this method in the BeverageFactory class:
    public void getCoinCurrentTotal (String o)
        // this is should be executed whenever a user puts a coin into the machine
        int foo = Integer.parseInt(o);
        // to be finished
      }I don't understand what the heck its supposed to be for..
    I can obtain the current amount of coins inserted from the textbox in the CoinMechanism class. The only thing i could think of, would be for this to enable the 'Vend' button, but it doesnt have access anyway..
    Any suggestions would be hugely appreciated, I have tried to contact the lecturer but he isnt around over easter i guess..
    Many thanks.

    I'm not going to read all that, and I don't do GUIs, so this is just a guess, but it looks like the CoinMechanism class is intended to be just a dumb processor to accept coins and determine what each coin's value is, but no to keep a running total.
    That in itself is an arguably acceptable design--one class, one job and all that. But I don't know that it makes sense to have the BeverageFactory keep the running total.
    Overall, I gotta say, I'm not impressed with your instructor's framework. Maybe it's just because I didn't look at it closely enough, or maybe it's more of a naming problem than a design problem, but it seems to me he's mixing up GUI code with business logic.
    Good luck.

  • I need a little help with this MS-6380E

    Hi my name is AttA.  Im trying to help out a friend get hism PC back up and running.  He is a new user type and has generaly screwd his pc up just being a newbie.  He asked me to Format his PC And reinstall his OS, and now here i am wonering what the heck is going on.  
    I first tried to install Win XP pro on his PC with all the hardware in it, just like it came to him when he got it.
    When the XP pro setup gets to the Copying files section it locks up.  There is no specific file it locks on up, sometimes it will do it at 3% sometimes at 17%.  It has never made it through coping the files.  At this point i decided to return the PC to minimum spec and try it out.  Ive removed all of the expansion cards, replaced the AGP GEforce TI 4600 with an old 8 meg PCI card, removed the front USB from the board, ive taken out all but 1 stick of RAM that i know to be good.  Ive also loaded Bios Defaults.
    At this point the Specs on the PC are as follows.
    Athalon 1150 CPU  (As reported by the Bios)
    MSI MS-6380E  (although the pic of the board contained in the instruction manual looks nothing like the real thing,)
    IBM Deskstar 40 Gb
    Floppy Drive
    1 Yamaha CD-RW 20/10/40  (yes ive tried other known working non writing drives.)
    1 stick DDR 2700 256mb
    Keyboard and mouse ive tried 4 sets both USB and PS/2
    Alliedc Pwr Supply  300W
    I have scanned for Viri as well as tried the drive on both busses.
    Im hoping some1 can give me a clue as to what is happening.
    Thanx for your help in advance.
    AttA
    PS pls excuse typos my keyboard at work is not the natural im used too.

    Ok so ive done more.  mabey this will help.
    Ive tried changing the RAM.  
    Ive tried A CMOS reset.
    Ive tried A new CD-ROM as CS on the secondary and slave to the HDD on the primary
    Here is the one i dont get.  Ive tried installing Win98.  and it worked.  the disk my frind has is near pristine one scratch and not nearly enough to account for multiple lockups while dealing with random files.  i suppose is possible, so im gonna try XP with a different disk if i can find one.
    I even thought well mabey its got some kind of strange super virus and its surving the format fdisk and fdisk /mbr.  So i put the HDD in a G4, knowing that a mac would erase the complete drive with out any care for boot records or any other PC crap.  nothing still locked up, although that time i copied 56% of the files before it locked up.  thats the best run yet ;(
    Thank you for the reply Mrplow that is one thing i definatly did not try that one.  Ill make sure to do that tomorrow and see what happens.  When your FSB reverts to 100, do you have problems like this?
    AttA

  • Hello, need a little help with this program

    i have this program and i cant see whats wrong with it. but when i run it the error "Exception in thread 'main' java.lang.NoSuchMethodError: main"
    anyone know what wrong?
    class Assignment2
       public final
       void main( String[] argv )
           Script sc = new Script ("Assignment2.txt");
           KeyboardReader kb = new KeyboardReader();
         System.out.println( "Enter Time In 24hr Mode (use -999 to quit) : " );
         int time = kb.getInt();
         if (time == -999) {     System.out.println( "EXIT" );}
         System.out.println( "" );
         System.out.println( "Enter The Distance Of The Call (use -999 to quit) : " );
         int distance = kb.getInt();
         if (distance == -999) {     System.out.println( "EXIT" );}
           System.out.println( "" );
         System.out.println( "Enter Length Of Call In Minutes (use -999 to quit) : " );
         double length = kb.getDouble();
         if (length == -999) {System.out.println( "EXIT" );}     
           System.out.println( "" );
           Calculation (time, distance, length);
       }// end main
    public void Calculation (int time, int distance, double length)
              while (time != -999 || distance != -999 || length != -999)
                   if (700 <= time && time <= 1900 && distance <= 100)
                          System.out.println( "Cost of call is $0.60 per minute" );
                          double cost = 0.60 * length;
                          System.out.println( "That call will cost $ " + cost );
                     if  (700 <= time && time <= 1900 && distance > 100)
                          System.out.println( "Cost of call is $1.10 per minute" );
                          double cost = 1.10 * length;
                          System.out.println( "That call will cost $ " + cost );
                     if  (700 <= time && time <= 1900 && distance > 100)
                          System.out.println( "Cost of call is $1.10 per minute" );
                          double cost = 1.10 * length;
                          System.out.println( "That call will cost $ " + cost );
                System.out.println( "EXIT" );            
      }//end calculation
    }//end class
    //----------------------------------------------------------------------------------------------------

    i have this program and i cant see whats wrong with
    it. but when i run it the error "Exception in thread
    'main' java.lang.NoSuchMethodError: main"
    anyone know what wrong?When you get exceptions you also get a stack trace pointing you at the exact line where the exception occured in your code.

  • Need a little help with this code

    Hi,
    right now I'm going through the xmlmenu tutorial, which I've
    found at kirupa.com. It's pretty much clear to me. Then I decided
    to try to import a blur filter. And as soon as I wright the import
    flash.filter line, I get a syntax error. Where is the problem? How
    do I get button's blurx/y = 0 onRollover? I was thinking to apply
    the filter to menuitem mc (see the code)
    Here's the code

    yes, you are right - flash.filters. Another "syntax error"
    ;-). I did manage to get it work (the import line part). My next
    question is to which MC must I apply the blur filter to get next
    result:
    by default the buttons are blured. OnRollOver the button gets
    cleared of blur. Here's my blur code:
    var myBlur = new flash.filters.BlurFilter(20,20,2);
    var myTempFilters:Array = _root.mainmenu_mc.filters;
    ->which MC must be here to get the wanted result??????
    myTempFilters.push(myBlur);
    _root.mainmenu_mc.filters = myTempFilters;
    curr_item.onRollOut = function() {
    myBlur.blurX = 20;
    myBlur.blurY = 20;
    this.filters = new Array(myBlur);
    curr_item.onRollOver = function() {
    myBlur.blurX = 0;
    myBlur.blurY = 0;
    this.filters = new Array(myBlur);
    THX for your help

  • Need a little Help with my new xfi titanium

    +Need a little Help with my new xfi titanium< A few questions here.
    st question? Im using opt out port on the xfi ti. card and using digital li've on a windows 7 64 bit system,? I would like to know why when i use 5. or 7. and i check to make sure each speakear is working the rear speakers wont sound off but the sr and sl will in replace of the rear speakers. I did a test tone on my sony amp and the speaker are wired correctly becasue the rear speakers and the surrond? left and right sound off when they suppose too. Also when i try to click on? the sl and sr in the sound blaster control panel they dont work but if i click on the rear speakers in the control panel the sl and sr sound off. Do anyone know how i can fix this? So i would like to know why my sl and sr act like rears when they are not?
    2nd question? How do i control the volume from my keyboard or from windows period when using opt out i was able to do so with my on board? sound max audio using spidf? Now i can only control the audio using the sony receiver.
    Thank you for any help..

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • Need a little help with syncing my iPod.

    I got a new macbook pro for cristmas and a few cds. After i tried to sync my ipod to itunes i put a symbol next to each song that i got from other cds saying that they were downloading but they werent. Also the cds i downloaded to my ipod for the first time didnt appear at all. Need help.

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • I need advise and help with this problem . First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product . At the present time I'm having lots of problems with the router so I was looking in to

    I need advise and help with this problem .
    First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product .
    At the present time I'm having lots of problems with the router so I was looking in to some info , and come across one web site regarding : port forwarding , IP addresses .
    In my frustration , amongst lots of open web pages tutorials and other useless information , I come across innocent looking link and software to installed called Genieo , which suppose to help with any router .
    Software ask for permission to install , and about 30 % in , my instinct was telling me , there is something not right . I stop installation . Delete everything , look for any
    trace in Spotlight , Library . Nothing could be find .
    Now , every time I open Safari , Firefox or Chrome , it will open in my home page , but when I start looking for something in steed of Google page , there is
    ''search.genieo.com'' page acting like a Google . I try again to get raid of this but I can not find solution .
    With more research , again using genieo.com search eng. there is lots of articles and warnings . From that I learn do not use uninstall software , because doing this will install more things where it come from.
    I do have AppleCare support but its to late to phone them , so maybe there some people with knowledge , how to get this of my computer
    Any help is welcome , English is my learned language , you may notice this , so I'm not that quick with the respond

    Genieo definitely doesn't help with your router. It's just adware, and has no benefit to you at all. They scammed you so that they could display their ads on your computer.
    To remove it, see:
    http://www.thesafemac.com/arg-genieo/
    Do not use the Genieo uninstaller!

  • Need a little help with dial setup on CME

    I've got a CME I'm using for testing and I think I need a little help figuring out the proper config to get the system to accept numbers I dial and have those numbers be passed on to an Avaya system (including the leading 9 for ARS in Avaya) via H.323 IP trunks.   I have it working well for internal 5 digit extension calls across the H.323 trunks and I also have it working well for some types of outside calls that gets passed on to the Avaya and then the Avaya dials the call out to the PSTN.   My only real problem is, I can't figure out how to correctly configure CME to examine the digits I'm dialing and only send the digits once I'm finished dialing....not as soon as it sees an initial match.
    What's happening is this.  I can dial local numbers in my area as 7 digits or 10 digits.  The phone company doesn't yet force us to dial area code and number for local calls (10 digits).  I can still dial 7 digits.   But...if I put an entry in CME that looks like this....
    (by the way, the 192.168.1.1 IP is not the real IP address, that's just an example, but the rest of this entry is what I really have entered in CME)
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...Then it will always try to dial out immediately after seeing the first 8 digits I dial (9 plus the 7 digit number I called)...even though I have a speicifc entry in the system that accounts for calls to 9 plus area code 513.  I would have assumed that if I put the specific entry in for 9513....... it would see that and wait to see if I was actually dialing something to match 9513....... instead of 9.......   Understand what I mean?   Because 9513....... is more specific than 9....... but it still tries to send the call out immediately after seeing the first 8 digits I dialed.
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...BUT...here's the interesting thing.  If I trace the 10 digit call in Avaya, I see that the number being presented to the Avaya PBX is only the first 7 digits of the number....not the full 10 digits...BUT I see a few more of the digits I dialed (like the 8th and 9th digits) after the call is already setup and sent to the PSTN.  It's like the CME is trying to send the rest of the 10 digits I dialed, but at that point it's already too late.   It setup the call as a 7 digit call (9 plus 7 digits), not 10 digit like I wanted.
    I'm more familiar with how to setup dialing in the Avaya via ARS.  My background is Avaya, not Cisco, so this dial-peer config is a little difficult for me until I understand the reasoning of how it examines the numbers and what I should do to make it wait for me to finish dialing....or to tell the system that what I'm dialing will be a minimum or a certain amount of digits and maximum of a certain amount of digits, like the Avaya does.  I just need some pointers and examples to look at :-)   I think I've almost got it....but I'm just missing something at the moment.
    Just so you understand, the call flow should be like this:  Cisco phone registered to CME > CME to Avaya via H.323 trunks > Avaya to PSTN via ISDN PRI trunks connected to Avaya.  I have to be sure I send the 9 to the Avaya also, because 9 triggers ARS in the Avaya. 
    Thanks for your help

    Here is a good document that explains how dial-peers are matched in the Cisco world:
    http://www.cisco.com/en/US/tech/tk652/tk90/technologies_tech_note09186a008010fed1.shtml#topic7
    In your case, it is variable length dial plan you are trying to implenent. To fix it, you need to add a T to force the system to wait for more digits to be entered if there is any.
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......T
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    You can also configure the inter-digits timeout using the command timeouts interdigit under telephony-service.
    Please rate helpful answers!

  • Need a little help with Slimbox (Lightbox clone) and Spry data sets

    Hello guys!
    First of all let me say that I'm not a programmer in any way,
    shape or form, and somehow I managed to build me a dynamic
    thumbnail gallery that reads data from an XML file and displays it
    on my webpage using a Spry data set and a slider widget (yay!)
    This is of course only thanks to the many great examples
    provided by the Adobe Spry team, and me being stubborn enough to
    keep at it, even though I don't really understand what I'm doing :D
    But I got to this point where I have basically everything
    working, except that I can't get the Slimbox (Lightbox clone)
    script to work with the Spry-generated thumbnail gallery.
    From what I could understand from other threads on this
    forum, is that I need to add an observer somewhere, only that I'm
    not sure where and how (those threads are pretty old and the
    examples aren't available anymore).
    I'm sure you guys know what I'm talking about, anyway, here's
    what I got so far:
    http://www.riotdesign.com.ar/misc/gallery/test1.html
    I have the thumbnail gallery populated from the external XML
    file, a basic page navigation using the Sliding Panels widget, and
    the Slimbox script which works only on the static test image.
    Okay I guess that's it for now, sorry for the long post and
    of course any help with this will be GREATLY appreciated :)
    Thanks & bye!

    Kev,
    Where exactly does the .evalScripts = true; text need to go?
    Does it go in the href call?
    <a href="ManageNotes.asp" title="Manage Notes" onClick="this.blur();
    Modalbox.show(this.href, {title: 'Manage Notes', width: 575}); return false;">View your notes.</a>
    Thanks for any assistance.
    J Bishop

  • I need help with this method, i don't know how to call it correct.

    public void method397(byte byte0, int i)
            if(byte0 != 6)
                for(int j = 1; j > 0; j++);
            aByteArray1405[anInt1406++] = (byte)(i + cacheMod.method246());
        }This code is for a Game client im making for a 2dmmorpg, the method was refactored by a friend but he isn't online at the moment because his on holiday; This method sends a packet to the server, i have handled it in the server;
    So i would think you would call it like this;
    super.engineStream.method397((byte)6, 103);But that gives me a huge exception, so please could someone explain how i could fix?
    Thanks
    Ill get the error in a second.

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
            at Gui.ClientStreamLoader(Gui.java:328)
            at Gui.actionPerformed(Gui.java:323)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
            at javax.swing.AbstractButton.doClick(Unknown Source)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
            at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknow
    Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at javax.swing.JComponent.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)

  • Need a Little Help with Understanding How Layers Work in PSE

    I have PSE version 5 and I am using it on a PC with Windows XP.
    As I get more into editing photos, I am enjoying it, but confusion is also starting to set in.  My question is about layers.  When I go to edit a photo for web/email use only, I start by resizing it to 72 ppi and then reducing the pixel dimensions quite a bit.  Then after that I normally go through this process of editing the photos by using normally about three different commands.  One is Levels, then I may go to Shadows/Highlights, and then my last command is always sharpening.  I used to do this all on one layer, but then finally learned to put each one of these editing features on their own layer so I can make changes/deletions without too much trouble.
    When I started doing the separate layers, I was just making a copy of the background layer each time and then touching that particulay layer up with Levels, Sharpen or Shadows/Highlights.  But I noticed that depending on the order in which the layers were placed, some changes would be obscured.  If I put the Levels layer on top, and then the Sharpen layer and the Shadows/Highlight layer below that, the sharpen effect and the shadows/highlights effects were no longer there.  I could only see the levels effect.  The photo was still not sharp and so on.  If I put the Sharpen level on top, then the photo showed the sharpen effects, but now the Levels and Shadows/Highlights effects were no longer visible.
    So then I started to make a copy of the background initially, do a levels adjustment here, then, instead of making a copy of the original background layer again, I would make a copy of the layer that now has the levels changes on it.  Then do the sharpen effect on this layer.  This way I had all the changes on one layer as long as I put that layer as the top layer.  But then I realized that I once again fI didn't have a layer with only one fix on it.   Finally, I started to use an adjustment layer for Levels, put this as the top layer, make a copy of the background layer, do shadows/highlights, copy background layer again, do sharpen, and this seems to work a little better.  But even with this way, depending on what order I place the sharpen and shadows/Highlights layers, one of them still seems to get obscured by the layer above it.
    Can someone help me to understand how layers work in this regard.  I am obviously a little confused here.
    Thanks,
    Lee

    You really aren't working efficiently. First of all, do your editing on a full sized version of the photo, since you have more data for PSE to work on and will get better results. Use save for web to make your web/email copy when you are totally done. You can resize it down on the right side of the save for web window.
    Duplicating a regular layer makes an opaque layer that obscures the layers below it. It's best to start off by not working on your original image, so that you don't have to worry if you mess up. If you're working on a copy, you can work right on the background layer, or only duplicate the layer once and apply your changes to that. So you'd apply both shadows/highlights and sharpening to the same layer.
    Finally, you should use an adjustment layer for levels. Layer>New Adjustment Layer>Levels. This will put levels on a transparent layer above your image, but you will need to click the layer below it to get back to a pixel layer to apply other changes (you can't sharpen an adjustment layer, for example).

  • Need a little help with RAF logic

    So Im making a program to give different users, different rights. This is the method that appends them to file and Map
         * Writes the players rights to the appendages
         * @param playerName Player to update
         * @param playerRights Rights to give the player
         * @param pointer The lines index in the files
         * @throws IOException If a read/write error occours
        public void writeRights(String playerName, Rights playerRights, long pointer) throws IOException {
            rightsRAF.seek(pointer);
            rightsRAF.write(("\n" + playerName + "::" + playerRights).getBytes());
            if(rightsRAF.read() != '\n') {
                rightsRAF.seek(rightsRAF.getFilePointer()-1);
                rightsRAF.write("\n".getBytes());
            rightsMap.put(playerName, playerRights);
        }1. The RAF goes to the predetermined index in the file, pointer, which is the line the users name starts on. Entries are stored in the file as "name::RIGHTS"
    2.It writes out the players name, and rights
    3. It checks to see if it accidentally wrote over the \n
    My problem now, is that some rights are longer than others. For example, if there was already an entry, "name::MODERATOR" and you overwrite it, with "name::OWNER" then it would turn into "name::OWNERATOR" because the rest of the line wasn't overwritten.
    I need some help with logic to determine how to overwrote the entire line, because sometimes you could go from a short one, to a long one, and need to append a new \n character, and sometimes you could go the other way around from long to short and end up with two words fused, I cant figure out how to determine whats a word that got partially overwritten and whats a new line totally.
    Thanks

    As pointed out you need to have fixed size records, or at least a maximum size.
    You also have another problem nobody commented on yet (I don't think) with the getBytes() calls. At that point in your code you will mangle most unicode Strings.
    All things being equal here I think your best solution is to use an embedded database like JavaDB with JDBC. I think you will find an XML solution to slow for your purposes.
    If you decide to continue the RAF route though here is an example. I know this is not exactly what you are doing but you can extrapolate from this...
    public void updatePlayerName(String playerName, int playerIndex){
       int recordlength = 200;  
       byte[] buff = playerName.getBytes("UTF-8");
       if(buff.length>recordlength){
          //truncate bytes. this is also not great because a character at the end could be mangled
          byte[] temp = new byte[recordlength];
          System.arraycopy(buff,0,temp,0,temp.length);
          buff = temp;
       long pointer = playerIndex * (recordlength+4);// plus 4 bytes per record for actual length
       raf.seek(pointer);
       raf.writeInt(buff.length);
       raf.write(buff);
    public String getPlayerName(int playerindex){
        int recordlength = 200;  
        long pointer = playerIndex * (recordlength+4);
        raf.seek(pointer);
        int lengthToRead = raf.readInt();
        //length to read should be checked for sanity or bad things will happen next
        byte[] buff = new byte[lengthToRead];
        raf. readFully(buff);
        return new String(buff,"UTF-8");
    }And then of course you'd have to add storing the "rights". It gets complicated in a hurry. I do really recommend the JDBC route.

  • Need a little help with some errors.

    Receiving some errors..
    btn2.addActionListener(new ActionListener() {
    and also
    frame.setLocation(400,400);
    frame.setVisible(true);
    }<<~~has 2 errors here...
    Both above have class or interface expected errors..clueless on what i'm missing at the moment.
    Anyone mind pointing out what {'s and }'s i'm missing?
         btn1.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  btn1actions();
              private void btn1actions() {
                   if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
                   if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
         btn2.addActionListener(new ActionListener() {
                                       public void actionPerformed(ActionEvent evt) {
                                            btn2actions();
                        private void btn2actions() {
                             if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
                             if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
                   btn3.addActionListener(new ActionListener() {
                                       public void actionPerformed(ActionEvent evt) {
                                            btn1actions();
                        private void btn3actions() {
                             txt1.setText("");
                             txt1.requestFocus();
    public static void main(String[] args) {
        Test2 frame = new Test2();
        frame.setTitle("Test Frame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 300);
        frame.setLocation(400,400);
        frame.setVisible(true);
    }

    All my code..finally posted...just need help with more errors.
    F:\DocumentsTest2.java:169: ';' expected
              btn1.addActionListener(new ActionListener()) {
    ^
    F:\Documents\Test2.java:176: illegal start of expression
              private void btn1actions() {
    ^
    F:\Documents\Test2.java:191: illegal start of expression
              private void btn2actions() {
    ^
    F:\Documents\.java:202: illegal start of expression
              private void btn3actions() {
    ^
    4 errors
    Tool completed with exit code 1
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test2 extends JFrame{
         static JButton btn1,btn2,btn3;
         static JTextField txt1;
         static JRadioButton radio1,radio2;
           public Test2() {
             Container container = getContentPane();
             container.setLayout(new BorderLayout());
              //Create Panels
                JPanel Panel1 = new JPanel();
                JPanel Panel2 = new JPanel();
                JPanel Panel3 = new JPanel();
                JPanel Panel4 = new JPanel();
                JPanel Panel5 = new JPanel();
                JPanel Panel6 = new JPanel();
                JPanel Panel7 = new JPanel();
                JPanel Panel8 = new JPanel();
                JPanel Panel9 = new JPanel();
                JPanel Panel10 = new JPanel();
              //Set Layout for Panels
              Panel3.setLayout(new BorderLayout());
              Panel4.setLayout(new BorderLayout());
              Panel5.setLayout(new BorderLayout());
              Panel6.setLayout(new BorderLayout());
              Panel10.setLayout(new BorderLayout());
              //Create the Various Fonts and Colors for this GUI
              Font font1 = new Font("SansSerif", Font.BOLD, 20);
              Font font2 = new Font("Serif", Font.PLAIN, 15);
              Color color1 = new Color(3,15,125);//A Dark Blue Color
              Color color2 = new Color(201,29,10);//A Red Color
              Color color3 = new Color(127,127,127);//A Grey Color
              //Create Buttons and Labels
             btn1 = new JButton("Submit");
             btn2 = new JButton("Display Schedule");
             btn3 = new JButton("Enter New Name");
             JLabel label1 = new JLabel("Student Name");
             JLabel label2 = new JLabel("Course Number");
              JLabel label3 = new JLabel("Welcome to the Java Community College");
              JLabel label4 = new JLabel("Registration System!");
              //Declare Text Field For Entering Student Names
              txt1 = new JTextField(15);
              //"Put Course Number from another Method Here"
              String[] courseStrings = { "CISM2230 A", "CISM2230 B", "CISM1110 A", "CISM1110 B", "CISM1120 A", "CISM1120 B" };
              JComboBox Combo1 = new JComboBox(courseStrings);
              //Declare Radio Buttons for Add and Drop Course
              radio1 = new JRadioButton("Add a Course", false);
              radio2 = new JRadioButton("Drop a Course", false);
              ButtonGroup radioButtons = new ButtonGroup();
              radioButtons.add(radio1);
              radioButtons.add(radio2);
              //Panel 10 is the Main Displaying Panel
              Panel10.add(Panel3, BorderLayout.NORTH);
              Panel10.add(Panel4, BorderLayout.CENTER);
              Panel10.add(Panel8, BorderLayout.SOUTH);
              //Panel 3 Used to Display Label 3 and 4 using Panels 1 and 2
              Panel3.add(Panel1, BorderLayout.NORTH);
              Panel3.add(Panel2, BorderLayout.CENTER);
              Panel1.add(label3);
             Panel2.add(label4);
              //Panel 4 Used to Display Student Name, Txt1, Course Number, Combo Box and Radio Buttons
             Panel5.add(label1, BorderLayout.NORTH);
             Panel5.add(txt1, BorderLayout.CENTER);
             Panel6.add(label2, BorderLayout.NORTH);
              Panel6.add(Combo1, BorderLayout.CENTER);
              Panel7.add(radio1, BorderLayout.NORTH);
              Panel7.add(radio2, BorderLayout.CENTER);
              Panel4.add(Panel5, BorderLayout.NORTH);
              Panel4.add(Panel6, BorderLayout.CENTER);
              Panel4.add(Panel7, BorderLayout.SOUTH);
              //Panel 8 Used to Display the Buttons
              Panel9.add(btn1, BorderLayout.CENTER);
              Panel9.add(btn2, BorderLayout.CENTER);
              Panel9.add(btn3, BorderLayout.SOUTH);
              Panel8.add(Panel9, BorderLayout.CENTER);
              //Setting Background, ForeGround and Font of all Text.
             Panel1.setBackground(color3);
             Panel2.setBackground(color3);
             Panel3.setBackground(color3);
             Panel4.setBackground(color3);
             Panel5.setBackground(color3);
             Panel6.setBackground(color3);
             Panel7.setBackground(color3);
             Panel8.setBackground(color3);
             Panel9.setBackground(color3);
             Panel10.setBackground(color3);
             btn1.setBackground(color3);
             btn2.setBackground(color3);
             btn3.setBackground(color3);
             radio1.setBackground(color3);
             radio2.setBackground(color3);
             btn1.setFont(font2);
             btn2.setFont(font2);
             btn3.setFont(font2);
             Combo1.setFont(font2);
             Combo1.setBackground(color3);
             Combo1.setForeground(color1);
             label1.setFont(font2);
             label2.setFont(font2);
             label3.setFont(font1);
             label4.setFont(font1);
             label1.setForeground(color2);
             label2.setForeground(color2);
             label3.setForeground(color1);
             label4.setForeground(color1);
             container.add(Panel10);
              //Setting Keyboard Shortcuts to Radio Buttons and Regular Buttons
              btn1.setMnemonic('S');
              btn2.setMnemonic('D');
              btn3.setMnemonic('E');
              radio1.setMnemonic('A');
              radio2.setMnemonic('C');
              //ActionListener
              btn1.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                        btn1actions();
              private void btn1actions() {
                   if (radio1.isSelected()){ System.out.println("Radio Button 1 is selected. Button 1")};
                   if (radio2.isSelected()){ System.out.println("Radio Button 2 is selected. Button 1")};
              btn2.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                                            btn2actions();
              private void btn2actions() {
                   if (radio1.isSelected()) System.out.println("Radio Button 1 is selected(Button 2).");
                   if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.Button 2");
              btn3.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                        btn1actions();
              private void btn3actions() {
                   txt1.setText("");
                   txt1.requestFocus();
         public static void main(String[] args) {
             JavaCollegeTest2 frame = new JavaCollegeTest2();
             frame.setTitle("Project 4");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.setSize(400, 300);
             frame.setLocation(400,400);
             frame.setVisible(true);
    }

  • Please help with this method, cant get it to work correctly.

    any suggestions AT ALL please, im really stuck with this.
    im creating a little animation of pacman, just an animation of it moving buy its self. im using the java elements package so this is all being shown in a drawing window.
    ive made it move fine and go round the window abit eating dots but the code is a mess, and i know i could change some of the main part into a few simple methods and have tried but it seems to stop moving when i try
    import element.*;
    import java.awt.Color;
    static DrawingWindow d = new DrawingWindow(500,500);  
       public static void wait1second()
        //  pause for one tenth of a second second
            long now = System.currentTimeMillis();
            long then = now + 100; // 100 milliseconds
            while (System.currentTimeMillis() < then)
        public static void waitNSeconds(int number)
            int i;
            for (i = 0; i < number; i++) //allows you to determine how long to pause for
                wait1second();
    public static void main(String[] args) {
        //  declaring the variables
        int pacsize1 = 50, pacsize2 = 50;
        int pac1x = 20, pac1y = 20;
        int pacmouth1 = 45, pacangle1 = 270;
        int pacmouth2 = 25, pacangle2 = 320;
        int pacmouth3 = 6, pacangle3 = 348;
        int startmv = 0, stopmv = 33;
        d.setForeground(Color.black);
        Rect bkrnd = new Rect(0,0,500,500);     
        d.fill(bkrnd);
       // while loop used to make the pacman shape move right across the screen with its mouth in three different states
    Arc pacarc = new Arc();
         while (startmv++<stopmv)
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth1,pacangle1);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth2,pacangle2);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            pac1x += 4;
            d.setForeground(Color.yellow);
            pacarc = new Arc(pac1x,pac1y,pacsize1,pacsize2,pacmouth3,pacangle3);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
    }so i tried making a method to make all the stuf in the while loop alot simpler but it just keeps making the pacman not move at all and im not sure why. heres the code i tried for the method:
    public static void pacmve(int pactestx, int pactesty, int pacsizetest1, int pacsizetest2, int pacmouthtest, int pacangletest)
            pactestx += 4;
            Arc pacarc = new Arc();
            d.setForeground(Color.yellow);
            pacarc = new Arc(pactestx,pactesty,pacsizetest1,pacsizetest2,pacmouthtest,pacangletest);
            d.fill(pacarc);
            d.setForeground(Color.black);
            waitNSeconds(1);
            d.fill(pacarc);
            }it had no problems with the code, but it just doesnt seem to do anything when i call it in the while loop. heres how i used it to try and just make it move across with the mouth in one state:
    while (startmv++<stopmv)
    pacmve(20,20,50,50,45,270);
    }any ideas?
    Edited by: jeffsimmo85 on Nov 22, 2007 2:36 AM

    the clock is still ticking while you do this:
    while (System.currentTimeMillis() < then)
    is that method your design? why not just call Thread.sleep()?
    %

Maybe you are looking for

  • Colors in News Browser

    Hi I have an KM-navigation iView which is using the lauout set for News Browser. I have further diferent XML-Forms which again have a unique color. The meaning is to display the xml fomrms with diferent colors in the same iView. But when I have set a

  • Optional Parameter without a value

    Hi, I'm using Discoverer 10g. Somebody knows what is passed when an optional parameter (a parameter which doesn't require a user to enter a value) is left without a value ? I didn't understand actually if is passed NULL, 'NULL', '',' '... I need to k

  • Any difference in operating systems

    I am looking to buy a macbook pro, I am currently living in South Korea but I am Irish, is there any differences in the software between the two countries.

  • Help with balance sheet adjustment log - sapf180p

    Hi all, Am trying to see the B/S adjustment log. It doesn't recgonise any selection i make. It says nothing has been selected. we haven't used this program to check the log so not sure if i am missing something. There is an error in running sapf180a

  • History tracking in hrms

    Hi experts i am looking for a profile option to enable me to track the changes (a history, was has been done so far). Looking for any response. Thanks