Need help with a basic java thing..

Sorry, just started java a few weeks ago and i'm having trouble figuring out how to do something.
I wanted to know how to make this work. It cant be more than 6 characters in length and of those six characters, the first two have to be letters only, followed by a dash (-) and then three numbers. EG: ab-234 or gf-643...
Im using it as a serial number generator type thing, thats only one part of the entire program, but I cant figure it out.
Just need the most basic way to do that if anyone could help! been looking for hours in a couple java books i have and dont know where to look or what to look for!!
Any help figuring out the code for that would be great! Here's what I have so far and how i need the rest to be implemented! Thanks! PS: using TextIO
<code>
String itemNum1
     itemNum1 = new String ( " Enter Item Number(AB-123): " );
     TextIO.put("\n" + itemNum1);
     itemnum = TextIO.getlnString();
</code>

Oh hey sorry, i figured the bit of text i put in there
would be enough. I basically need a user to enter the
information, but i just need to know (or get a hint)
of how to prevent them from entering an invalid
number/serial code type thing in regards to the
parameters that I need met. (such as no more than 6
chars, but alternating numbers/letters). I presume I
use the char and not the getlnString command but
nonetheless im still stuck as to how I'd manage that.
Do i need to code each character seperately? (such as
letters by themselves, then another prompt to enter
the numbers??) or is there a way to get it all in one
go?
Thanks for any advice! oh and Sorry for the bad
wording in my question :P.
You could read the String from console using something like
public static String readWord()
   {  int ch;
      String r = "";
      boolean done = false;
      while (!done)
      {  try
         {  ch = System.in.read();
            if (ch < 0
               || java.lang.Character.isSpace((char)ch))
               done = true;
            else
               r = r + (char) ch;
         catch(java.io.IOException e)
         {  done = true;
      return r;
   }you would have to modify it according to your needs and after that you could use the String API to confirm if the user has entered it right or not. If not you could ask him to do that again

Similar Messages

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

  • Help with my basic java

    Hello i am in a high school programming class and i need help. I have to make an application that draws a basic face, and then i put in different scrollbars, drop menus and checkboxes to control how the face works. I have gotten most of what i need to do but i am stuck on, I need to have a so if i press it they will get closer together of farther apart, which is where im stuck. i can only make them move in the same direction. any ideas???
    heres the code.
    import java.awt.*;
    import java.awt.event.*;
    public class Unit9q extends java.applet.Applet implements AdjustmentListener,ItemListener {
         Graphics g;
         Checkbox mybox1,mybox2,mybox3,mybox4,mybox5;
         CheckboxGroup mygroup1,mygroup2;
         Choice mymenubar1,mymenubar2;
         String colorword,shapeword,menuitem1,menuitem2,eyefill,eyesstring;
         Color clr;
         int yaxis,inteyes,ineyes;
         Scrollbar yaxisscroll,eyes;     
         public void init() {
              yaxisscroll=new Scrollbar(0,50,1,120,140);
              yaxisscroll.addAdjustmentListener(this);
              yaxisscroll.setBounds(100,10,100,20);
              add(yaxisscroll);
              yaxis=120;
              eyes=new Scrollbar(0,50,1,120,140);
              eyes.addAdjustmentListener(this);
              eyes.setBounds(100,10,100,20);
              add(eyes);
              inteyes=110;
              mygroup1=new CheckboxGroup();
              mybox1=new Checkbox("Red",mygroup1,false);
              mybox2=new Checkbox("Blue",mygroup1,false);
              mybox3=new Checkbox("Green",mygroup1,false);          
              mybox4=new Checkbox("Filled",mygroup2,false);
              mybox5=new Checkbox("Outlined",mygroup2,false);
              add(mybox4);
              add(mybox5);
              mybox1.addItemListener(this);
              mybox2.addItemListener(this);
              mybox3.addItemListener(this);
              add(mybox1);
              add(mybox2);
              add(mybox3);
              clr=Color.white;
              mymenubar1=new Choice();
              mymenubar1.addItem("Square");
              mymenubar1.addItem("Circle");
              mymenubar1.addItem("Rectangle");
              mymenubar1.addItem("Oval");
              mymenubar1.addItemListener(this);
              mymenubar2=new Choice();
              mymenubar2.addItem("Square");
              mymenubar2.addItem("Oval");
              mymenubar2.addItemListener(this);
              add(mymenubar1);
         public void adjustmentValueChanged(AdjustmentEvent event){
              yaxis=yaxisscroll.getValue();
              inteyes=eyes.getValue();
              repaint();
         public void itemStateChanged(ItemEvent event) {
              menuitem1=mymenubar1.getSelectedItem();
              menuitem2=mymenubar2.getSelectedItem();
              if (mybox1.getState()==true) {clr=Color.red;}
              else if (mybox2.getState()==true) {clr=Color.blue;}
              else if (mybox3.getState()==true) {clr=Color.green;}
              repaint();
         public void paint(Graphics g) {
              g.setColor(Color.black);
              if (menuitem1.equals("Rectangle")){
                   g.drawRect(100,100,70,90);}
              else if (menuitem1.equals("Oval")){
                   g.drawOval(100,100,75,90);}
              else if (menuitem1.equals("Circle")){
                   g.drawOval(100,100,80,80);}
              else if (menuitem1.equals("Square")){
                   g.drawRect(100,100,80,80);}     
              if (menuitem2.equals("Circle")){
                   g.drawOval(80,100,10,10);}
              else if (menuitem2.equals("Square")){
                   g.drawRect(80,100,10,10);}     
                        g.setColor(clr);
              if (mybox4.getState()==true) {
                   g.fillRect(inteyes,120,10,10);
                   g.fillRect(ineyes,120,10,10);}
              else if (mybox5.getState()==true) {
                   g.drawOval(inteyes,120,10,10);
                   g.drawOval(ineyes,120,10,10);}     
              ineyes=inteyes+42;
              g.setColor(Color.black);     
              g.fillOval(128,yaxis,15,22);
              g.drawArc(111,160,50,20,0,180);     
         } //thank you if you can solve it

    Next time you post code, use the CODE button or [code] and [/code] tags so that it maintains the formatting from your editor.
    If two things are moving int the same direction, your adding N to both of their x-coordinates. If you want one to move in one direction and the other in the other direction, then you have to add N to one and -N to the other.

  • Need help with mac and java

    Hi, I'm trying to develop an application on a Machintosh OSX 10.2.8 machine.
    I'm having a herrendous time trying to get quicktime to work on it.
    I've somehow managed t oget 1.3.1 and QTJava.jar to work together but now i need encryption, however that requires 1.4+
    Now 1.4.1 doesnt work with quicktime
    I've downloaded the latest software upgrades but Ive got no idea how to set up quicktime to work with java 1.4.1
    Now to add on top of that mac reports it can use AES encryption. this is from source code ripped striaght from this website.
    But first and foremost can anyone, annyonee help me out with setting up 1.4.1 with quicktime?
    Thank you

    If you need encryption with Java 1.3.1, download the JCE from either Sun (http://java.sun.com/products/jce/) or Bouncy Castle (http://www.bouncycastle.org/).
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                   

  • I need help with a basic rock paper scissors program!

    i need to make a program that allows the computer to play rock paper scissors at random and compare the results with user and tell who wins or if its a tie. can anyone help me?

    import java.util.Scanner;
    import java.util.Random;
    public class RockPaperScissors
    public static final int ROCK = 1;
    public static final int PAPER = 2;
    public static final int SCISSORS = 3;
    public static void main(String[] args)
    final int NUM_CHOICES = 3;
    Random generator = new Random();
    int userWins = 0;
    int compWins = 0;
    int ties = 0;
    int compChoice, userChoice;
    boolean exit = false;
    Random randGen = new Random();
    Scanner scan = new Scanner(System.in);
    System.out.println("Enter your choice: ");
    userChoice = scan.nextInt();
    System.out.println("Computers Choice: ");
    compChoice = scan.nextInt();

  • Help with a SIMPLE java thing

    I've only got ONE handful of hair left.
    I'm trying to build a series of dropdown boxes; a day dropdown (Mon, Tue, Wed...), a month dropdown (Jan, Feb, Mar...), a year dropdown, hour dropdown, minute dropdown, and an am/pm dropdown.
    I think I want to build my dropdowns using "for" loops something like this:
    for (i=0;i<12;i++) {
    myStringBuffer.append("<option>" + [someUnknownFunctionThatReturnsTheFirstThreeLettersOfTheMonth(i)] + "</option>")
    I've been trying to mix up various combinations of Date objects (most date functions seem to be depreciated), Calendar Objects, DateFormat Objects and SimpleDateFormat Objects but nothing seems to want to perform the function that I need.
    I've had iffy success creating a calendar object, setting the Month to "i", using the getTime function to return a Date object which I can then pass to the SimpleDateFormat object using the .format(Date) function, after setting the pattern to "EEE", but it seems like just an incredibly complicated way to do what ought to be a simple function...i.e. convert a number 0-11 (or 1-12, I'm not picky) into the name of a stinking Month! Arrgh.
    If anyone can help, I thank you.

    I've done that before, so i'll share it with you.
    import java.text.SimpleDateFormat;
    import java.text.DateFormatSymbols;
    import java.util.Calendar;
    import java.util.Date;
    public String createListOfMonth(String pName) {
    StringBuffer sbMonth = new StringBuffer();
    DateFormatSymbols fm = new DateFormatSymbols();
    String[] arrMonth = fm.getMonths();
    sbMonth.append("<select name=\"" + pName + "\">");
    sbMonth.append("     <option value=\"\">Month</option>\n");
    for (int i=0; i<arrMonth.length; i++) {
    if (!arrMonth.trim().equals("")) {
    String sValue = "0000" + (i + 1);
    sValue = sValue.substring(sValue.length() - 2);               
    sbMonth.append("     <option value=\"" + sValue + "\">" + arrMonth[i] + "</option>\n");
    sbMonth.append("</select>");
    return (sbMonth.toString());
    You can manipulate the symbol (either for months, days) using different locale. You can see the API for java.text.DateFormatSymbols in Java2 SE.
    Regards,
    Hariyanto

  • Need help with Visual BASIC

    I am in an intro to programming course, and I am writing a console on Visual Basic 2013.  My problem with Visual Basic right now is that I cannot get the formula to work.  All of my inputted values end up being 0's.  Am I using incorrect parameters,
    am I misunderstanding how to use arguments; am I not coding correctly?  The scenario for my problem is:
          Areas of Rectangles: The area of a rectangle is the rectangle’s length times its width.  Design a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the
    greater area, or if the areas are the same.
    //My code is 
    Module Module1
        Sub Main()
            Dim LENGTH As Double = 0
            Dim WIDTH As double = 0
            Dim AREA_1 As Double
            Dim AREA_2 As Double
            Dim RECTANGLE As String = " "
            area1(LENGTH, WIDTH)
            areaCalc1(AREA_1, LENGTH, WIDTH)
            area2(LENGTH, WIDTH)
            areaCalc2(AREA_2, LENGTH, WIDTH)
            decision(AREA_1, AREA_2, RECTANGLE)
            displayDec(RECTANGLE)
            Console.WriteLine("Press any key to exit...")
            Console.Read()
        End Sub
        Sub area1(ByVal LENGTH, WIDTH)
            Console.WriteLine("Please input the following for your first rectangle:")
            Console.Write("Length: ")
            LENGTH = Console.ReadLine()
            Console.Write("Width: ")
            WIDTH = Console.ReadLine()
        End Sub
        Sub areaCalc1(ByVal AREA_1, ByRef LENGTH, WIDTH)
            AREA_1 = LENGTH * WIDTH
            Console.WriteLine("This is the area for rectangle 1: " & AREA_1)
        End Sub
        Sub area2(ByVal LENGTH, WIDTH)
            Console.WriteLine("Please input the following for your second rectangle: ")
            Console.Write("Length: ")
            LENGTH = Console.ReadLine()
            Console.Write("Width: ")
            WIDTH = Console.ReadLine()
        End Sub
        Sub areaCalc2(ByVal AREA_2, ByRef LENGTH, WIDTH)
            AREA_2 = LENGTH * WIDTH
            Console.WriteLine("This is the area for rectangle 2: " & AREA_2)
        End Sub
        Sub decision(ByRef AREA_1, AREA_2, ByVal RECTANGLE)
            If AREA_1 < AREA_2 Then
                RECTANGLE = "rectangle 2"
            Else
                RECTANGLE = "rectangle 1"
            End If
        End Sub
        Sub displayDec(ByRef RECTANGLE)
            Console.WriteLine("The rectangle with the greater Area is " & RECTANGLE)
        End Sub
    End Module

    Hi,
      If you are just beginning to program i highly recommend setting the following options in the Visual Studio menu (Tools/Options). Open the Options window and go to the (Projects and Solutions) and click on (VB Defaults). Now set the options as follows.
    Option Strict - On
    Option Explicit - On
    Option Infer - Off
     And probably one of the most important things to do is learning to Debug your code. That will save you hours of headaches when you get unexpected results in your applications. You will know how to track it down and find where in the code your results
    are being thrown off. There are quite a few Debugging tutorials on the internet. Here are a few decent ones.
    Debugging Express
    Breakpoints and Debugging Tools
    If you say it can`t be done then i`ll try it

  • Need help with long term Java problems

    I've been having problems with Java on my computer for about a year now, and I'm hoping that someone here can help me out.
    Java used to work fine on the computer when I first got it (a Dell laptop) and I hadn't installed anything myself. But then one day it stopped loading Java applets, and hasn't worked since. By this, I mean that I get the little colorful symbol in a box when I try to play Yahoo games, use the http://www.jigzone.com site, go to chat rooms, etc. Java menus on websites like http://www.hartattack.tv used to work still, but lately they've been giving me that symbol too.
    I've tried downloading a newer version of Java, but nothing I do seems to work, and I don't know of anything I did to trigger it not working. I'm hoping there's a simple solution to this, and I'm just dumb.
    Thanks.

    This might be way off, but it's something that's tripped me up in the past:
    If you are using Sun's Java plugin, the first time you go to a site that has a particular Java applet, you may be asked to approve/reject a security request.
    If you have clicked on any other windows while the request is first being loaded (which can take some time, because this is swing based), then the security dialog box does not pop to the top of the window stack, and doesn't add an entry into the task bar.
    It appears that Java just doesn't work, but it's actually waiting for you to click "Yes". You can check this by hitting alt-tab and seeing if the Java coffee cup icon is one of the options.
    - K

  • Need help with running a Java program on Linux

    I am trying to get a Java program to run on a Linux machine. The program is actually meant for a Mac computer. I want to see if someone with Java experience can help me determine what is causing the program to stall. I was successful in getting it installed on my Linux machine and to partially run.
    The program is an interface to a database. I get the login screen to appear, but then once I enter my information and hit enter the rest of the program never shows, however, it does appear to connect in the background.
    Here is the error when I launch the .jar file from the command screen:
    Exception in thread "main" java.lang.IllegalArgumentException: illegal component position
    at java.awt.Container.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    I am not a programmer and I am hoping this will make some sense to someone. Any help in resolving this is greatly appreciated!

    Well, without knowing a little bit about programming, and how to run your debugger, I don't think you're going to fix it. The IllegalArgumentException is saying that some call does not like what it's getting. So you'll have to go in an refactor at least that part of the code.

  • Need help with a basic script to resize image then resize the canvas

    I am new to photoshop scripting, and have come across a need to force an image to be 8"x10" at 300dpi (whether it is vertical or horizontal)
    I need to maintain the correct orientation in the file, so an Action will not work, I believe I have to implement a script to accomplish this.
    I have the below script so far, but I am not certain of how to input the variables / paramters
    doc = app.activeDocument;
    if (doc.height > doc.width) doc.resizeImage("2400 pixels","3600 pixels", "300", "BICUBIC");
    if (doc.height > doc.width) doc.resizeCanvas("2400 pixels","3000 pixels", "MIDDLECENTER");
    if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
    if (doc.height < doc.width) doc.resizeCanvas(3000,2400,"MIDDLECENTER");
    When I run this script, I get the following error:
    Error 1245: Illegal argument - argument 4
    - Enumerated value expected
    Line: 5
    if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
    The fact that its failing on lien 5 lets nme know that I have the "If" portions of my script correct, I just dont know how to accomplish the functions correctly.
    Any help would be appreciated!
    Thanks,
    Brian

    I know I'm late here but it seems to me your trying to automate a 8"x10 or 10"x8 300DPI  print.
    To do that you must first crop your image to a 4:5 aspect ratio to prevent distortion unless your shooting with a 4" by 5" camera.   I wrote a Plugin script a couple years ago that could help you do a centered crop.  You could do the whole process by recording a simple Photoshop action that uses two  Plugin Scripts only four steps would be needed.
    Step 1 Menu File>Automate>AspectRatioSelection  (My script based of Adobe Fit Image Plugin script) Set 4:5 Aspect ratio, center,  Rectangle, Replace, no feather. Llike Fit Image this script woks on both Landscape and Portrait images. The Selection will be correct for the images orientation.
    Step 2 Menu Image>Crop
    Step 3 Menu File>Automate>Fit Image set 3000 PX height and 3000 PX width the Image will be Resample so its longest side will be 3000 pixels.  Adobe Fit Image Plugin Script always uses BICUBIC resampling.  I have a modified version of Fit Image  that uses Bicubic Sharper whebndownsizing and BicubicSmoother when up sizing.
    Step 4 Menu Image>Size un check resample set resolution to 300 DPI.
    When you play the actions the Script Dialogs will not be displayed and the setting use when you recorded the action will ne used.
    The Plugin Script are included in my crafting actions package:
    http://www.mouseprints.net/old/dpr/JJMacksCraftingActions.zip
    Contains:
    Action Actions Palette Tips.txt
    Action Creation Guidelines.txt
    Action Dealing with Image Size.txt
    Action Enhanced via Scripted Photoshop Functions.txt
    CraftedActions.atn Sample Action set includes an example Watermarking action
    Sample Actions.txt Photoshop CraftedActions set saved as a text file. This file has some additional comments I inserted describing how the actions work.
    12 Scripts for actions
    My other free Photoshop downloads cam be found here: http://www.mouseprints.net/Photoshop.html

  • Need help with settng up JAVA environment

    Hi:
    Can someone help me?
    How do you set up PATH and CLASSPATH?
    I downloaded the J2SDK VERSION 1.4. Then installation created the java folder j2sdk. So now all the files are in C:\J2SDK\such as lib,bin,read me right! What do I do next?
    Now how do I set my environment variables.Plus I created a new folder called Khava on my desktop to put my source code files.
    Appreciate any help
    Thanks.

    depends on ur OS. If you are running Windows 9X/2K/Me...find your autoexec.bat file. Either right-click and edit it or type "edit autoexec.bat" in DOS. In there, add to your current PATH line (or create one if you don't) that has the bin folder in it.
    So in your case, append this to the PATH= line:
    C:\J2SKD\bin
    should be all you need.
    Save and either restart the puter or run autoexec.bat. To check to see if it worked, type "PATH" in DOS and it'll display ur current path. Hope this helps.

  • Computer idiot needs help with  vista and java

    -running vista home edition 64bit
    - i am administrator
    -need to run an older version of java jdk/jre6 update 6
    - when i download the appropriate version for the windows 64 bit, I go through the installation and finish it but java never appears in my control panel
    - if i download the version for just windows the java icon appears in my control panel but IE7 does not recognize it as being there
    HELP

    AFTER I break down and erase the HD and reinstall OSX
    You don't have to erase the drive to reinstall the OS. Just reinstall WITHOUT erasing the drive. Only system files will be over-written, and your borked OS will be fixed, while your own files will be left in place. You really should have a backup before a reinstall, but unless one is very unlucky and something goes wrong it isn't strictly necessary.
    Never trash anything unless you know what it is, what it does, why it is doing it, and what put it there to do that. I know, it's a bit late for this crisis, but you should now avoid future crises caused by throwing away (or moving) the wrong thing.
    Francine
    Francine
    Schwieder

  • Need Help with the basics

    I'm attempting to take something in post fix notation and compute its calculation
    I'm having problems with my main and passing things to and from the stack. The print statement is just there to make sure its taking the #s in correctly
    Ex. 1 3 - 4 5 * +
    = 18
    import java.util.*;
    public class ABStack // Array-based implementation of a stack data structure
    //instance variables
    int [] pile; // This array holds the contents of the stack. The stack grows rightward from element 0.
    int count; // # of elements in stack. This value is also the index of the next available array element.
    public ABStack(int size) //constructor
    if(size > 1)
    pile = new int[size];
    else
    pile = new int[1];
    count = 0;
    public boolean isEmpty()
    return(count==0);
    public boolean isFull()
    return(count==pile.length);
    public int size()
    return count;
    // Add a new value to the top of the stack.
    // Do nothing if the stack is full.
    public void push(int n)
    //add n to stack top
    if(!isFull()) //have room
    pile[count]=n;
    count++;
    // Remove (and return) th value on the top of the stack.
    // If the stack is empty, return -99999 as a sentinel value.
    public int pop()
    if(isEmpty())
    return -99999;
    else
    count--;
    return pile[count];
    public static void main(String[] args)
    Scanner sc = new Scanner(System.in);
    System.out.print("Please enter numbers in Postfix notation: ");
    String note = sc.nextLine();
    char note2[] = note.toCharArray();
    int opt1, opt2;
    char c;
    for (int i=0;i < note2.length;i++)
    if (note2>= '0'&& note2[i]<='9')
    String nextchar = "" + note2[i];
    int nextnum= Integer.parseInt(nextchar);
    System.out.print(+nextnum); // Can't figure out how to pass my stuff to and from the stack
    Message was edited by:
    jaydon34
    Message was edited by:
    jaydon34

    import java.util.*;
    public class ABStack // Array-based implementation of a stack data structure
    //instance variables
    int [] pile; // This array holds the contents of the stack. The stack grows rightward from element 0.
    int count; // # of elements in stack. This value is also the index of the next available array element.
    public ABStack(int size) //constructor
    if(size > 1)
    pile = new int[size];
    else
    pile = new int[1];
    count = 0;
    public boolean isEmpty()
    return(count==0);
    public boolean isFull()
    return(count==pile.length);
    public int size()
    return count;
    // Add a new value to the top of the stack.
    // Do nothing if the stack is full.
    public void push(int n)
    //add n to stack top
    if(!isFull()) //have room
    pile[count]=n;
    count++;
    // Remove (and return) th value on the top of the stack.
    // If the stack is empty, return -99999 as a sentinel value.
    public int pop()
    if(isEmpty())
    return -99999;
    else
    count--;
    return pile[count];
    public static void main(String[] args)
    Scanner sc = new Scanner(System.in);
    System.out.print("Please enter numbers in Postfix notation: ");
    String note = sc.nextLine();
    char note2[] = note.toCharArray();
    int opt1, opt2;
    char c;
    for (int i=0;i < note2.length;i++)
    if (note2>= '0'&& note2<='9')
    String nextchar = "" + note2;
    int nextnum= Integer.parseInt(nextchar);
    System.out.print(+nextnum); // Can't figure out how to pass my stuff to and from the stack
    }Message was edited by: 

  • Really Need Help with Some Basics! 

    I've done Adobe's flash tutorials, and made a numbef of
    animations, and feel comfortable with that, but am having trouble
    finding a good source on how to best implement a full flash site
    for the web. Is there an Adobe tutorial I am missing?
    Specifically, I've made an animation using the new Flash
    screens feature, but am having a few problems with it. For one, the
    animation is 443 kb for the full animation. Is this acceptable if I
    add a preloader? (website is for a Swiss audience only - so pretty
    good bandwidth)
    Here's the site: (use forward and back to navigate as one of
    the problems I"m having is with the buttons on the top)
    http://www.genevanotebook.com/BUFFET/test.html
    I've also had some problems with the navigation. Forward and
    Back work, but I can't get the buttons to work (is this a limiation
    in the "linear" screens feature?)
    Or would someone divide this up in some way. I've though of
    different possibilities like using frames (which I haven't touched
    for years) and having buttons in an simple html frame, which then
    opens and plays the flash files in the frame just below it. Or
    would Iframes be a way of proceeding? Or is there something else I
    am missing. I would be very curious to hear how you experts would
    proceed with putting together a site like the one above!
    Many thanks for any suggestions, including websites with good
    examples of the different ways a site like mine could be
    implemented for the web.

    Here is the link.
    http://www.matthewpavkov.com/buffetscreens_edited.fla
    Now, I'm going to try and explain what I did as best I can.
    But please understand that I do not know very much about
    actionscript, I just know how to feel my way through syntax and
    where code should and shouldn't be.
    First, I renamed the slides on the left. b-b-q ----> bbq1,
    and so forth. This is what I believe was the main problem for the
    buttons not working. My guess is you may have used the instance
    name somewhere and that could affect it. The second part to the
    main reason why your buttons weren't working is that you had
    different code on the word buttons than the code on the picture
    buttons. The code on the word buttons was the correct code. So, I
    copied and pasted that code on each of the word buttons AND each of
    the picture buttons, correspondingly. Then I changed each code to
    match up with the new names for the slides. Doing this alone fixed
    all the buttons so everything worked correctly. I also found that
    you had actionscript associated with the bbq slide. If you click on
    the slide on the left, you'll see the actionscript, I deleted that
    as it was unnecessary. Also, make sure to use the "Auto format"
    button in the actionscript plane, it's very useful for keeping
    things looks clean and consistent. I did that for all the code.
    Aside from this, I found nothing else wrong.
    I'd also like to point out that I've never used slides
    before. In fact, I only became aware of them after looking at your
    file. They look like a useful feature if you're going to have many
    simple pages, but I think it'd be much easier to do what you're
    doing now...just have each button point to a frame (or set of
    frames) in the timeline. These slides seem a little cumbersome for
    a small project, not to mention I'm sure you'll have no problems
    whatsoever using the frames method instead of slides.
    Hope this helped.

  • I need help with some basics with itunes 9

    Okay, maybe it's just me, but I can't get 9 to do some of the things that I just figured out how to do with 8 so if anyone can help you would save my sanity. First, I only have a few things listed to rank my albums on top in the view section-like album, artist album artist for ex. I used to be able to see all of those on the screen. 9 has spread out these columns too wide and I would like to reduce them.
    Second, I have several compilation albums like the Now that's what I call music. I had them fixed so that they would list as the total album with all the various artists. Now if I have 9 in the list view, it separates every artist in that type of album by their name. It won't just list them as an album together. If I click on the album from the side album it has the tracks all mixed up. The only way that I can see them being together and in the correct order is if I stay on the album view.
    I'm sure that these are stupid things to be concerned with, but I want to be able to view my own library the way I want to view it. Any help would be greatly appreciated.

    Okay, maybe it's just me, but I can't get 9 to do some of the things that I just figured out how to do with 8 so if anyone can help you would save my sanity. First, I only have a few things listed to rank my albums on top in the view section-like album, artist album artist for ex. I used to be able to see all of those on the screen. 9 has spread out these columns too wide and I would like to reduce them.
    Second, I have several compilation albums like the Now that's what I call music. I had them fixed so that they would list as the total album with all the various artists. Now if I have 9 in the list view, it separates every artist in that type of album by their name. It won't just list them as an album together. If I click on the album from the side album it has the tracks all mixed up. The only way that I can see them being together and in the correct order is if I stay on the album view.
    I'm sure that these are stupid things to be concerned with, but I want to be able to view my own library the way I want to view it. Any help would be greatly appreciated.

Maybe you are looking for

  • Moving bookmarks from old Vista drive to primary XP drive C in wifes computer

    Main computer with Vista lost the motherboard. The hard drive is fine. I have it installed in my wife's Vista computer. I need all my book marks out of the old hard drive but can't find them. I tried to use the profile program but it only will find t

  • SRM 7.0 SP9  Timezone warning message

    We are currently testing SRM 7.0 for implementation in JUly.    We occassionally get a Timezone warning message, that seems to go away depending on the product/vendor being selected.   The warning message says:   Timezone MSTNO is not valid in countr

  • Split Response without BPM

    Hi, i have a synchronous scenario: SAP (ABAP proxy) <-> 3rd Party (http) Is it possible to send in addtion to the (synchronous) proxy response some IDocs without use of BPM? synchr proxy request .................-> http service synchr proxy response.

  • Is text search possible in a portfolio on iPad?

    Search works fine on an individual page in a portfolio and will run across pages in a multisheet .pdf. I frequently use this tool on portfolios in the Windows version of Reader and cannot find it on my iPad when I open a portfolio.

  • Inventory Management Data Model

    Can I have a combined Inventory Management Snapshot and Non Cumulative?  By this I mean as follows: 1.     Use the Business Content model to load to the Inventory Management (0IC_C03) cube on a daily basis (loading delta from 03_BF and 03_UM) 2.