Simple java applet help needed

hi, im having trouble with an applet im developing for a project.
i have developed an applet with asks the user for simple information( name,address and phone) through textfields, i wish for the applet to store this information in an array when an add button below the textfeilds is pressed.
client array[];
array=new client[];//needs to be an infinate array!
I have created the client class with all the set and get methods plus constructors needed but i dont know how to take the text typed into the textfields by the user and store them in the array.
i also need to save this info to a file and be able to load it back into the applet.
Could some please help! Thank you for your time.

Better maybe redefine the idea using an data structure :
public class client{
private char name[];
private char address[];
private int phone;
public class vector_clients{
private client vect[];
// methods for vect[]
What is your opinion about ???

Similar Messages

  • Simple java applet help

    im following the java tutorial at their web site online. I'm having problems with these simple applets:
    http://java.sun.com/docs/books/tuto...kMeApplets.html
    I compiled them fine on my other computer, but when I compiled them on the computer I am using presently, I get a problem.
    the files seem to compile fine. but when i compare them with the files online, my files that i compiled are a little less in size. when i load the applet in the provided html file, all i get is a blank gray screen. and when i move the mouse over the gray screen, it says for a split second: "load: class ClickMe not found"
    i have all the correct files...but after compiling the .java files, it doesn't work. the .class files on the web work fine. but my compiled files seem to be smaller than those on the web.
    the ClickMe.class file i compiled is 1.45 KB (1,494 bytes)
    the Spot.class file i compiled is 293 bytes (293 bytes)
    the ClickMe.class file online is 1.50 KB (1,539 bytes)
    the Spot.class file online is 339 bytes (339 bytes)

    I believe that one (or more) of these applats are currently broken - the files are mislocated, I believe. Just skip the clickme applets (unless you want to debug them yourself).

  • Need help with Java applet, might need NetBeans URL

    I posted the below question. It was never answered, only I was told to post to the NetBeans help forum. Yet I don't see any such forum on this site. Can someone tell me where the NetBeans help forum is located (URL).
    Here is my original question:
    I have some Java source code from a book that I want to compile. The name of the file is HashTest.java. In order to compile and run this Java program I created a project in the NetBeans IDE named javaapplication16, and I created a class named HashTest. Once the project was created, I cut and pasted the below source code into my java file that was default created for HashTest.java.
    Now I can compile and build the project with no errors, but when I try and run it, I get a dialog box that says the following below (Ignore the [...])
    [..................Dialog Box......................................]
    Hash Test class wasn't found in JavaApplication16 project
    Select the main class:
    <No main classes found>
    [..................Dialog Box......................................]
    Does anyone know what the problem is here? Why won't the project run?
    // Here is the source code: *****************************************************************************************************
    import java.applet.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import java.util.*;
    public class HashTest extends Applet implements ItemListener
    // public static void main(String[] args) {
    // Hashtable to add tile images
    private Hashtable imageTable;
    // a Choice of the various tile images
    private Choice selections;
    // assume tiles will have the same width and height; this represents
    // both a tile's width and height
    private int imageSize;
    // filename description of our images
    private final String[] filenames = { "cement.gif", "dirt.gif", "grass.gif",
    "pebbles.gif", "stone.gif", "water.gif" };
    // initializes the Applet
    public void init()
    int n = filenames.length;
    // create a new Hashtable with n members
    imageTable = new Hashtable(n);
    // create the Choice
    selections = new Choice();
    // create a Panel to add our choice at the bottom of the window
    Panel p = new Panel();
    p.add(selections, BorderLayout.SOUTH);
    p.setBackground(Color.RED);
    // add the Choice to the applet and register the ItemListener
    setLayout(new BorderLayout());
    add(p, BorderLayout.SOUTH);
    selections.addItemListener(this);
    // allocate memory for the images and load 'em in
    for(int i = 0; i < n; i++)
    Image img = getImage(getCodeBase(), filenames);
    while(img.getWidth(this) < 0);
    // add the image to the Hashtable and the Choice
    imageTable.put(filenames[i], img);
    selections.add(filenames[i]);
    // set the imageSize field
    if(i == 0)
    imageSize = img.getWidth(this);
    } // init
    // tiles the currently selected tile image within the Applet
    public void paint(Graphics g)
    // cast the sent Graphics context to get a usable Graphics2D object
    Graphics2D g2d = (Graphics2D)g;
    // save the Applet's width and height
    int width = getSize().width;
    int height = getSize().height;
    // create an AffineTransform to place tile images
    AffineTransform at = new AffineTransform();
    // get the currently selected tile image
    Image currImage = (Image)imageTable.get(selections.getSelectedItem());
    // tile the image throughout the Applet
    int y = 0;
    while(y < height)
    int x = 0;
    while(x < width)
    at.setToTranslation(x, y);
    // draw the image
    g2d.drawImage(currImage, at, this);
    x += imageSize;
    y += imageSize;
    } // paint
    // called when the tile image Choice is changed
    public void itemStateChanged(ItemEvent e)
    // our drop box has changed-- redraw the scene
    repaint();
    } // HashTest

    BigDaddyLoveHandles wrote:
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    That wasn't attention-grabbing enough apparantly. Let's try it again.
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}

  • Simple button applet help

    ok, i'm working on a project involving buttons, and i finished it and it compiles fine, but when i run the applet (using textpad), nothign shows up.
    i decided to make a new applet of only the frame and buttons, and i got the same problem. here is the simple one.
    import java.util.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    public class framek extends JApplet
         public static final int WIDTH = 600;
         public static final int HEIGHT = 300;
         public void framek()
              JFrame myWindow = new JFrame();
              myWindow.setSize(WIDTH, HEIGHT);
         Container contentPane = myWindow.getContentPane();
              contentPane.setBackground(Color.blue);
              contentPane.setLayout(new BorderLayout());
              JPanel button = new JPanel();
              button.setLayout(new FlowLayout());
              JButton convert = new JButton("Translate");
              button.add(convert);
              JButton delete = new JButton("Delete");
              button.add(delete);
              contentPane.add(button, BorderLayout.SOUTH);
    i might have made some mistakes in the shortening of my project (such as variables that arent used) but i just need help with getting the buttons and background things to show. I used very similar programs in a textbook and on the web to check and they worked fine on textpad, and this doesnt. its probably a very simple thing that i forgot but i cant find it yet, as i am fairly new to swing.
    any help is appreciated thanks

    /*  <applet code="HelloApplet" width="600" height="300"></applet>
    *  use: >appletviewer HelloApplet.java
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class HelloApplet extends JApplet
        public static final int WIDTH = 600;
        public static final int HEIGHT = 300;
        public void init()
            Container contentPane = getContentPane();
            contentPane.setBackground(Color.blue);
            contentPane.setLayout(new BorderLayout());
            JPanel button = new JPanel();
            button.setLayout(new FlowLayout());
            JButton convert = new JButton("Translate");
            button.add(convert);
            JButton delete = new JButton("Delete");
            button.add(delete);
            contentPane.add(button, BorderLayout.SOUTH);
        /** this is a convenience method */
        public static void main(String[] args)
            JApplet applet = new HelloApplet();
            JFrame myWindow = new JFrame();
            myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            myWindow.add(applet);
            myWindow.setSize(WIDTH, HEIGHT);
            myWindow.setLocation(200,200);
            applet.init();
            myWindow.setVisible(true);
    }

  • Java applet help for mountain lion update on macbook pro

    Hey, I upgraded to the new mountain lion update yesterday and since then when opening java applets, it won't allow me to do anything with them such as entering usernames and passwords. It was working fine yesterday before I did the update but now I can't seem to get it to work. I've reinstalled Java and it says it's all installed correctly. I was wondering if anyone else is having/had the same problem and knows what to do?
    Thanks in advance

    Hi Leonie! I was running into the same problem on my Macbook Air with ML but I just found a soultion that worked for me.
    I downloaded and installed Java 7 from oracle's website.  And then in the java prefences referenced before, changed the Java 7 build to be my default. 
    All my applets work great now for me.
    Hope this helps!

  • Java applet help

    iam trying to put the checkboxes in different line
    so all the checkbox is alligned
    what the syntax to do that??
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    public class Computers extends Applet implements ActionListener
         //declare varibles
         double totalCost;
         //contruct Label and Checkboxes
         Label companyName = new Label ("REASONABLE COMPUTER CORPORATION");
         Label system = new Label ("Basic Computer System cost: $575");
         Label choice = new Label ("Select the peripheral devices you want add");
         CheckboxGroup selectGroup = new CheckboxGroup();
              Checkbox printers = new Checkbox("Printer $150",false,selectGroup);
              Checkbox monitors = new Checkbox("Monitor $300",false,selectGroup);
              Checkbox modems = new Checkbox("Modems $100",false,selectGroup);
              Checkbox speaker = new Checkbox("Speaker $20",false,selectGroup);
              Checkbox microphone = new Checkbox("MircoPhone $15",false,selectGroup);
              Checkbox external = new Checkbox ("250G external hard driver $200",false,selectGroup);
         Button calc = new Button("Calculate");
         Label output = new Label("Click Calculate to see your final price");
         //init method for adding the stuff
         public void init()
              setBackground(Color.green);
              setForeground(Color.black);
              add(companyName);
              add(system);
              add(choice);
              add(printers);
              add(monitors);
              add(modems);
              add(speaker);
              add(microphone);
              add(external);
              add(calc);
              calc.addActionListener(this);
              add(output);
         public void actionPerformed(ActionEvent e)
              totalCost = 575 + getCode();
              output(totalCost);
         public double getCode()
              double dollars = 0;
              if (printers.getState()) dollars += 150;
              else if (monitors.getState()) dollars += 300;
              else if (modems.getState()) dollars += 100;
              else if (speaker.getState()) dollars += 20;
              else if (microphone.getState()) dollars += 15;
              else if (external.getState()) dollars += 200;
                return dollars;
         public void output(double totalCost)
              output.setText("Your Final cost is: " + totalCost + ".");
    }

    hiddendragon wrote:
    iam trying to put the checkboxes in different line
    so all the checkbox is alligned
    what the syntax to do that??There's no "syntax" involved. Instead you have to read up on and study the various layout managers. You could for instance use a BoxLayout to stack information on top of each other, and put your checkboxes in their own panel that uses flowlayout. There's many many ways to arrange this, and the best is the one that works for you. Start here .

  • 2 simple java applet

    Hi
    I have 2 short questions about java applets.
    1. when my applet comes up in the web browser, I have to click it before it will identify and fire off keyup and keydown method. (it's like i have click it with the mouse to wake it up or put it in focus) these are the methods i'm using
    public boolean keyUp(Event e, int key){
         showStatus(" ");
         return true; }
    public boolean keyDown(Event e, int key){
    return true;}
    QUESTION: Is there something special, that I have to do to make it automatically accept or see keyDown actions.
    2. QUESTION 2: What is the syntax to capture key event for the Spacebar and Esc button?
    For example I know that the event to catch the letter m is like this :
    if(key=='m'||key=='M'){
    and function key is caught like this
    if(key==Event.F1){
    But how do I catch the spaceBar and Escape?
    Thanks a lot in advance.
    Stephen
         

    hi is requestFocus() part of jdk 1.0 ?
    Have you ever used it before successfully?
    If so, can type a little syntax about how it works ?
    and to the person who had the javascript solution could you type a little syntax about how it works ? i also tried that. i put my applet in a div container and try to give it focus. I also tried to give the applet itself a name and give it focus with
    document.appletname.focus();

  • Beginner needs Java applet Help!!!

    I would be greatful if someone could answer any of the questions below following the description, thank you:
    Description:
    There are 3 textFields, 3buttons(add,delete,display), and 1 textArea on my applet.
    User types their "name" in the first textField(called tField1)
    User types their "surnname" in the second textField(called tField2)
    User Types their "Town" in the Third textField(called tField3)
    User presses add button to add details to an array of type "member".
    User presses display to view all members(elements of the array) in the TextArea.
    User adds details to textFields and presses the delete button to delete that member.
    member.class:
    Has constructors, individual set and get methods and private attributes name,surname + address plus a toString method.
    Code Behind the ADD button i.e. in the VOID ADD_ACTIONTIONPERFORMED(ACTION EVENT) method:
    Q1.How do i create an array of type member?
    Is it: MEMBER X[] = NEW MEMBER[100]; If so Where does this statement go?
    Q2.How do i allow the user to keep adding more members every time the add button is pressed?
    Code Behind the DISPLAY button i.e. in the VOID DISPLAY_ACTIONTIONPERFORMED(ACTION EVENT) method:
    Q3. How do i get member array elements displayed into the Textfield?
    Code Behind the DELETE button i.e. in the VOID DELETE_ACTIONTIONPERFORMED(ACTION EVENT) method:
    Q4. Deleting user selected elements?
    thanks for your time

    Q1.How do i create an array of type member?
    Is it: MEMBER X[] = NEW MEMBER[100]; Not unless MEMBER is final, which would be inappropriate here + I'd advise the word 'new' though not 'NEW'.
    If so Where does this statement go?In your source code file
    Q2.How do i allow the user to keep adding more members
    every time the add button is pressed?By having source code that creates the conditions for this
    >
    Code Behind the DISPLAY button i.e. in the VOID
    DISPLAY_ACTIONTIONPERFORMED(ACTION EVENT) method:Again these are not final methods, they are overrided methods
    Q3. How do i get member array elements displayed into
    the Textfield?This goes back to the thorny issue of writing code again. It's generally quite hard to do this sort of thing without it.
    >
    Code Behind the DELETE button i.e. in the VOID
    DELETE_ACTIONTIONPERFORMED(ACTION EVENT) method:Again, this is overriden, so final declarations are not permitted
    Q4. Deleting user selected elements?See above, re: source code.
    thanks for your time Welcome, we're here to help

  • Creating a SIMPLE Java APPLET for a HTML website

    Hello!
    I was wondering if anyone can help me.
    i have designed a very simple HTML website and wanted to make an applet.
    which program would be best (eclipse, blue j...etc)
    and how do i go about it!
    i am very new to this and would appriciate the help
    many thanks in advance

    sabre150 wrote:
    gimbal2 wrote:
    your brain to do all the hard work. It needs to be preloaded with knowledge of programming, the Java language, the Java platform and the Java plugin relating to applets before it will work.So that's where I have been going wrong!Lies, I know for a fact that you know a thing or two. What are you trying to do here? Hide from your responsibilities as a knowledgeable person?

  • Psuedocode to java.. help needed

    this is the start of psuedocode i need to convert into java:
    Roll a 12 sided die to choose a number in the range 1.....12
    While the user has not made an incorrect guess
    Ask the uer to guess whether they think the next number will be higher
    or lower
    it goes on to other topics but i was just wondering if anyone knew how
    to begin, especially the prediction or random output of a number by the
    computer..
    if anyone can help then that'd be great, thank you
    steve

    hey again, cheers for the hint.. i have been working hard on a simpler program and have only one error surround the 'if' statement.. how does this look to you?? i can't find the error however.
    import java.util.Scanner;
    public class dice
              public static void main (String [] args)
                        Scanner in = new Scanner(System.in);
                        Random rnd = new Random();
                        int r = rnd.nextInt(12) + 1;
                   System.out.print("guess a number ");
                   int x = in.nextInt();
              while (x != r);
                   System.out.print("Guess incorrect, choose hi or low ");
                   int hi = in.nextInt();
                   int low = in.nextInt();
                        if
                        (hi > r); {
                        System.out.print("correct ");
                        if (low < r);
                             System.out.print("correct ");
                        else
                             System.out.print("spot on! ")
              }

  • Java SDK Help Needed URGENTLY!

    Hi, as part of my uni course I am required to learn Java. Until now, I have only used it at uni and everything works fine. However, I decided to download Java 2 SDK from the Sun website (version 1.3.1_01).
    I am using Textpad as the editor and just installed Java by running the 32mb installer file. Textpad works fine and Java was installed to c:\jdk1.3.1_01
    Now, i created this simple program (from my tutorial notes) in Textpad:
    // The code below is held in a file called Exmpl1.java
    // This is Example1
    // The program requires you to type in your name.
    // Your name and a welcome message are then output to the screen
    import java.io.*;
    class Exmpl1M
    static BufferedReader keyboard = new
    BufferedReader (new InputStreamReader(System.in));
    static PrintWriter screen = new PrintWriter(System.out,true);
    public static void main (String[] args) throws IOException
    String name; // The place to store data entered from the keyboard
    // Prompt to the user of the program
    screen.print("Please enter your name ");
    screen.flush();
    // Get the data (a name) entered at the keyboard
    name = keyboard.readLine();
    screen.print("\n\nHello " + name );
    screen.println(" - Welcome to programming with Java\n\n");
    String lab; // The place to store data entered from the keyboard
    screen.print("What lab are you working in? ");
    screen.flush();
    // Get the data (a lab) entered at the keyboard
    lab = keyboard.readLine();
    screen.println("\n\n" + lab + "is a nice place to work!" );
    } // End of method main
    } // End of class Exmpl1M
    I know this file works ok because i have tested it on the uni computers. The Exmpl1M.class file is created where the Exmpl1M.java file is stored. It will compile fine using the Tools>Compile Java menu option.
    Now, here is the problem: when i go to Tools>Run Java Application, I get the message
    "Exception in thread "main" java.lang.NoClassDefFoundError: Exmpl1M
    Press any key to continue..."
    Now, seeing as how i am new to Java, i have no idea why i am getting this message. Should I have changed any settings when i installed Java? I'm guessing it may have something to do with "method main" in the coding, but we have always been told to put this but not told why.
    Please help cause i need to be able to write the progs at home too

    Is the name of the class the same as the class file
    Maybe you mixed up Exmple1 and Exmpl1M
    If this is ok then try this:
    I do not know Textpad so
    open Terminal/Console/DOS-Box go to directory where your Exmpl1.class file is located.
    Type in
    java Exmpl1
    If the program runs now some configuration in Textpad is wrong.
    Horst
    Hi, as part of my uni course I am required to learn
    Java. Until now, I have only used it at uni and
    everything works fine. However, I decided to download
    Java 2 SDK from the Sun website (version 1.3.1_01).
    I am using Textpad as the editor and just installed
    Java by running the 32mb installer file. Textpad works
    fine and Java was installed to c:\jdk1.3.1_01
    Now, i created this simple program (from my tutorial
    notes) in Textpad:
    I know this file works ok because i have tested it on
    the uni computers. The Exmpl1M.class file is created
    where the Exmpl1M.java file is stored. It will compile
    fine using the Tools>Compile Java menu option.
    Now, here is the problem: when i go to Tools>Run Java
    Application, I get the message
    "Exception in thread "main"
    java.lang.NoClassDefFoundError: Exmpl1M
    Press any key to continue..."
    Now, seeing as how i am new to Java, i have no idea
    why i am getting this message. Should I have changed
    any settings when i installed Java? I'm guessing it
    may have something to do with "method main" in the
    coding, but we have always been told to put this but
    not told why.
    Please help cause i need to be able to write the progs
    at home too

  • Pricing : ABAP to Java conversion help needed

    Hi all.
    I am basically an ABAP developer. My recent assignment needs some java coding.
    It will be very helpful if we anybody helps me in finding the corresponding pricing fields in java.
    The abap code is as follows
    check : xkomv - kgrpe  = '  '.
    check: xkomv - xkbetr ne 0.
    check : komp - kpein ne 0.
    if komp - netwr < 0.
      komp - netpr = 0 - komp - netpr.
    endif.
    xkwert  = (        (  ( komp - netpr * ( 100000 + xkomv - xkbetr))     / 100000)
    komp-mglme / komp-kumza * komp - kumne / 1000 / komp - kpein )
      - komp-netwr.
    Please help in converting this abap code to its corresponding java code.
    Thanks and Regards
    Deepika

    Here is the code I have developed: Please check and let me know if there are any changes
    import java.math.BigDecimal;
    import com.sap.spe.pricing.customizing.PricingCustomizingConstants;
    import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
    import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
    public class ZS2S_IPC_ZDCP extends ValueFormulaAdapter {
          public BigDecimal overwriteConditionValue(
                IPricingItemUserExit item,
                IPricingConditionUserExit condition) {
                BigDecimal kompKumza = new BigDecimal(String.valueOf(condition.getFraction().getNumerator()));
                BigDecimal kompKumne = new BigDecimal(String.valueOf(condition.getFraction().getDenominator()));
                boolean xkomvKgrpe = condition.isGroupCondition();
                BigDecimal kompKpein = condition.getPricingUnit().getValue();    
                BigDecimal kompNetwr  = item.getNetValue().getValue();
                BigDecimal kompNetpr  = item.getNetPrice().getValue();
                BigDecimal xkomvKbetr = condition.getConditionRate().getValue();
                BigDecimal kompMglme = item.getBaseQuantity().getValue();
                  if ( xkomvKgrpe = true )
                      return PricingTransactiondataConstants.ZERO;
                  if ( kompKumza != PricingTransactiondataConstants.ZERO )
                    return PricingTransactiondataConstants.ZERO;
                if ( kompKumne != PricingTransactiondataConstants.ZERO )
                      return PricingTransactiondataConstants.ZERO;   
                if ( kompKpein != PricingTransactiondataConstants.ZERO )
                        return PricingTransactiondataConstants.ZERO;
                if (kompNetwr.compareTo(PricingTransactiondataConstants.ZERO) < 0 )
                      kompNetpr = (PricingTransactiondataConstants.ZERO).subtract(kompNetwr);
                 BigDecimal y = new BigDecimal("100000");
                BigDecimal a = y.add(xkomvKbetr);
                BigDecimal temp = kompNetpr.multiply(a);
                BigDecimal result1 = temp.divide(y, 2, BigDecimal.ROUND_HALF_UP);
                BigDecimal result2 = result1.multiply(kompMglme)
                                         .divide(kompKumza, 2 BigDecimal.ROUND_HALF_UP).multiply(kompKumne).divide(kompKpein, 2,  BigDecimal.ROUND_HALF_UP);
                BigDecimal Result = result2.subtract(kompNetwr);
              return Result;
    Edited by: Deepika Mallya on Aug 6, 2009 9:08 AM

  • Simple java question, help please

    please help
    -i am just starting out in java and im havin an early problem. Im trying to run a small java script from a commant prompt but im getting the following error after i enter this command at my prompt
    c:\javatest>javac HelloARP.java
    javac is not as an internal or external command, operable program or batch file.
    when i enter
    c:\java -version
    i get the following message: registry key software\javasoft\java runtime enviornment\current version has value of 1.1 but 1.4 is requiured
    error: could not find java.dll
    error: could not find java 2 runtime enviornment
    -im sure this is a simple error on my part. all im trying to do is run my first lil program that i saved in notepad, its only 5 lines long. here is the lil test program im trying to execute
    class HelloARP {
    public static void main (String[] arguments) {
    System.out.println("What's good ARP?");
    - all responses and help are welcomed. Thank you ahead of time for anyone that can help me get started.

    Hi
    First of all uninstall your current JDK installation, if you can get to the registry delete the registry entries for the old version of java which was there on your machine.
    Now do a fresh install of your j2sdk1.4.1, make sure that you will install the JRE with the J2SDK1.4.1.
    Once you are done, set your classpath in autoexec.bat if you are using Windows 95/98
    or set your environment variables if you are using Win NT/2000/XP.
    If using solaris or other unix flavors see the included installation instructions provided.
    Let me if you face the same problem.
    Thanks
    Swaraj

  • Java Progrramming HELP, Needed Urgently, T hanks

    hey guys,
    I have this lab I need to be done tomorrow, its been weeks lol of thinking and figuring things out can someone make it work ? Pleaseeeee !
    I feel like going out and yelling for help lol I have been trying to figure this out for weeks now.
    I am pasting my Lab and My Codes I did so far, And Please I really need this done today at any rate, all help would be kindly appreciated.
    A Java program is required that will produce a number of reports based on the data from the Product file. This file contains the product name, cost, quantity and UPC. The file name must be input. Valid data from the file will be loaded into an array.
    A menu will provide the following options: (Note there are changes from previous assignment.)
    1     Display of all valid product information including extended price and GST including totals sorted by name.
    2     Display of all invalid records sorted by name.
    3     Search and display a certain product by name.
    4     Sort by UPC and use a binary search and display a certain product by UPC. (valid records)
    9 Exit.
    Processing requirements:
    Input the data from a file and load the records into an object array. Use this object array to produce the above reports.
    Code a class definition exactly as given in the following UML.
    (For specific students: you may code the UPC as an integer but if not numeric throw an exception that is handled in main. Document your choice in your submission).
    Product
    ? Name : String
    ? UPC : String
    ? Cost : Real
    ? Quantity : Integer
    + Product (Name : String, UPC : String, Cost : Real, Quantity : Integer)
    + Calculate Extended Cost() : Real
    + Calculate GST(): Real
    Input Record:
    Product name: String
    UPC: String
    Cost: real
    Quantity: integer
    Output Reports
    1. Display of all product information including extended cost and GST including totals of these 3 fields.
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 10,723,160.83
    Tissues 98989898989x 1.99 2 3.98      0.20     4.18
    TOTALS                         10,212,538.10 510,626.91 10,723,165.01
    2. Display of all invalid records and the count.
    Following is a sample of the output required:
    Invalid UPC Records = 1
    Count Record
    1          Tiara Diamond, 12345678901x, 36020.00, 2
    3. Search and display a certain product by name. Display appropriate message if not found.
    Following is a sample of the output required:
    Enter product name: CrownJewels
    CrownJewels 99999999991x     100,000.00 1 100,000.00 5,000.00 $105,000.00
    6. Display the product information sorted by name
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 $10,723,160.83
    Pearls      88888888881x 10,000.00 1 10,000.00 500.00 $10,500.00
    RubyRing      77777777771x 10,000.00 1 10,000.00 500.00 $10,500.00
    Tissues      98989898989x 1.99 2 3.98 0.20     $4.18
    TOTALS          (complete these values)           xxx           xxx      xxx
    Java coding requirements for this assignment
    Main methods required
    1.     Load array with all records. Display exception messages only for records that have invalid data in any of the fields. Return array of valid records and logical size.
    2.     Validate the UPC. Display each report when requested from the menu.
    3.     Justify the data in the columns. Right justify numeric fields; left justify the alpha fields.
    4.     A method for each report required in the menu.
    Class methods
    5.     Use the object method for the extended cost.
    6.     Use the object method for the GST.
    You may use additional methods in the main program but do not add any methods in the class definition.
    Use DecimalFormat for rounding.
    Create an array to hold the objects. Assume that we only need to process a file of a maximum of 500 records but the file may be larger than 500 records.
    A Universal Product Code consists of 12 digits. The first digit (from the left) is the UPC type. The next five digits are the Manufacturer code. The next five digits are the product code which is assigned by the manufacturer. The final digit is the check digit. A person can determine the check digit of a Universal Product Code by doing the following:
    Step 1: Sum all of the digits in the odd positions together.
    0+4+0+1+5+9 = 19
    Step 2: Multiply the sum from Step 1 by 3.
    3 * 19 = 57
    Step 3: Sum all of the digits in the even positions together.
    6+2+0+1+8 = 17
    Step 4: Sum together the results from Step 2 and Step 3.
    17 + 57 = 74
    Step 5: Subtract the sum from the next highest multiple of 10.
    80 - 74 = 6 [check digit]
    TEST DATA:
    Step 1: Create 5 or MORE additional records that will test all conditions. Include these in your documentation. Identify what field is tested in your test data. (Example: error in each field of the record, rounding up, rounding down, valid UPC, invalid UPC, formatting of report, file too large
    Step 2: Use the file attached.
    GODDDDDDDDDDDDDD lol pasting it made me go crazy,
    these are my codes so far, HOwever the problem is ONLY DISPLAY MENU SHOWS, nothing else even though i have enough codes that it can show something,
    My codes are as follows:
    I am working on Eclipse.
    import java.util.Arrays;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.io.IOException;
    * Name : Sana Ghani
    * Date : July 10
    public class lab56
         public static Scanner file;
         public static Scanner parse;
         public static Scanner input = new Scanner(System.in);
         public static Scanner searchInput = new Scanner(System.in);
         public static void main(String[] args) throws Exception
              Product1[] validProduct = new Product1[500];
              int logicalSize = 0;
              int menuChoice=0;
              String FileName = getFileName();
              displayMenu();
              switch(menuChoice)
              case 1:
                   displayAllValidRecords(validProduct, logicalSize);
                   try
                   // Open an output stream
                   OutputStream fout = new FileOutputStream ("myfile.txt");
                   // Print a line of text
                   new PrintStream(fout).println ("hello world!");
                   // Close our output stream
                   fout.close();          
                   // Catches any error conditions
                   catch (IOException e)
                        System.err.println ("Unable to write to file");
                        System.exit(-1);
                   break;
              case 2:
                   break;
              case 3:
                   binarySearchByName( validProduct,logicalSize);
                   break;
              case 4:
                   break;
              case 5:
                   break;
              menuChoice = displayMenu();
         public static void display(Product1[]validProduct, int logicalSize)throws Exception
              String Product, UPC;
              double Cost;
              int Quantity;
              for(int index =0; index<logicalSize; index++)
                   Product = validProduct[index].GetName();
                   UPC = validProduct[index].GetUPC();
                   Cost=validProduct[index].GetCost();
                   Quantity=validProduct[index].GetQuantity();
                   System.out.println(Product+"\t\t"+UPC+"\t\t"+Cost+"\t\t"+Quantity);
         public static String getFileName()
              String fileName;
              Scanner input = new Scanner(System.in);
              System.out.print("Please enter a file name: ");
              fileName = input.next();
              return fileName;
         public static int displayMenu()
              int menuChoice;
              boolean validFlag = false;
              do
                   System.out.println("\n\n*************************************");
                   System.out.println(" Product Display Menu ");
                   System.out.println("*************************************");
                   System.out.println("(1)Display All Records");
                   System.out.println("(2)Display All Invalid Records");
                   System.out.println("(3)Search by Product Name");
                   System.out.println("(4)Sort by Product Name");
                   System.out.println("(5)Exit");
                   System.out.println("*************************************");
                   System.out.print("Enter your choice(1-5): ");
                   menuChoice = input.nextInt();
                   if ((menuChoice >= 1) && (menuChoice <= 5))
                        validFlag = true;
                   if (!validFlag)
                        System.out.println("You have chosen " + menuChoice + ", " + menuChoice +
                        " is not valid. Please try again");
              }while(!validFlag);
              return menuChoice;
         public static String loadArray(Product1 [] ValidProduct, String fileName)throws Exception
              int logicalSize=0;//will always have to declare
              String record;//will always have to declare
              String Product, UPC;//variable names from
              double Quantity;
              double Cost;
              Scanner file = new Scanner(new File(fileName));//open
              record = file.nextLine();//read a line
              record = file.nextLine();//read a line
              for(int index = 0; index < ValidProduct.length && file.hasNext(); index++)//check to see if the file has data
                   record = file.nextLine();
                   parse = new Scanner(record).useDelimiter(",");
                   String Name = parse.next();
                   UPC = parse.next();
                   Cost = parse.nextDouble();
                   Quantity=parse.nextDouble();
                   ValidProduct[index] = new Product1 ( Name, UPC, Cost, (int) Quantity);
    //               create the object-- call the constructor and pass info
                   logicalSize++;
              return logicalSize+".txt";
         public static double roundDouble(double value, int position)
              java.math.BigDecimal bd = new java.math.BigDecimal(value);
              bd = bd.setScale(position,java.math.BigDecimal.ROUND_UP);
              return bd.doubleValue();
         * This method will print report about valid records
         public static void displayAllRecords( Product1[]valid, int ValidProduct,
                   Product1[] invalid, int InvalidProduct)
    //          Print valid records
              displayAllValidRecords(valid, ValidProduct);
    //          Print invalid UPC records
              displayAllValidRecords(invalid, InvalidProduct);
         public static void displayOneRecord(Product1[]valid, int index)
              double extendedCost, GST, SumofGST = 0, // Total Extended Cost
              totalCost, SumOfTotalCost = 0; // Total Extended Cost + GST
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Quantity", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
              extendedCost = valid[index].CalculateExtendedCost();
              extendedCost = roundDouble(extendedCost, 2);
              GST = valid[index].CalculateGST();
              GST = roundDouble(GST, 2);
              totalCost = extendedCost + GST;
              totalCost = roundDouble(totalCost, 2);
    //          justify method ensures all values are of the same size
              System.out.println(//leftJustify(i+"",3) + ": " +
                        leftJustify(valid[index].GetName(), 50) +
                        leftJustify(valid[index].GetUPC(), 15) +
                        rightJustify(valid[index].GetCost()+"", 10) +
                        rightJustify(valid[index].GetQuantity()+"", 5) +
                        rightJustify(extendedCost+"", 10) +
                        rightJustify(GST+"", 10) +
                        rightJustify(totalCost+"", 10));
         * This method will print report about valid records
         public static void displayAllValidRecords( Product1[]valid, int validCounter)
              double extendedCost, sumOfExtendedCost = 0, // Total Extended Cost
              GST, sumOfGST = 0, // Total GST
              totalCost, sumOfTotalCost = 0; // Total Extended Cost + GST
              System.out.println("************************ XYZ Product " +
                        "Cost REPORT ****************************" +
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Qty", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
    //          Print Records
              for(int i=0; i<validCounter; i++)
                   extendedCost = valid.CalculateExtendedCost();
                   extendedCost = roundDouble(extendedCost, 2);
                   GST = valid[i].CalculateGST();
                   GST = roundDouble(GST, 2);
                   totalCost = extendedCost + GST;
                   totalCost = roundDouble(totalCost, 2);
    //               justify method ensures all values are of the same size
                   System.out.println(//leftJustify(i+"",3) + ": " +
                             leftJustify(valid[i].GetName(), 50) +
                             leftJustify(valid[i].GetUPC(), 15) +
                             rightJustify(valid[i].getClass()+"", 10) +
                             rightJustify(valid[i].GetQuantity()+"", 5) +
                             rightJustify(extendedCost+"", 10) +
                             rightJustify(GST+"", 10) +
                             rightJustify(totalCost+"", 10));
                   sumOfExtendedCost += extendedCost;
                   sumOfGST += GST;
                   sumOfTotalCost += totalCost;
         private static void sortByName(Product1 [] ValidProduct, int logicalSize) throws Exception
              Product1 temp;
              for (int outer = logicalSize-1; outer > 1; outer --)
                   for (int inner = 0; inner < outer; inner ++)
                        if (ValidProduct[inner].GetName().compareToIgnoreCase(ValidProduct[inner+1].GetName())>0)
                             temp = ValidProduct[inner];
                             ValidProduct[inner] = ValidProduct[inner + 1];
                             ValidProduct [+ 1] = temp;
         public static void binarySearchByName(Product1 [] ValidProduct, int logicalSize)
              int high = logicalSize - 1;
              int low = 0;
              int mid = 0;
              int count = 0;
              int compare = 0;
              boolean found = false;
              System.out.print("Enter a product name");
              String product = input.nextLine();
              while (high >= low && !found)
                   count += 1;
                   mid = (high + low) / 2;
                   compare = ValidProduct[mid].GetName().compareToIgnoreCase(product);
                   if (compare == 0)
                        System.out.println("Found: " + ValidProduct[mid].GetName());
                        found = true;
                   else if (compare < 0)
                        low = mid + 1;
                   else
                        high = mid - 1;
              if (!found)
                   System.out.println(product + " not found.");
              System.out.println(count + " steps");
              System.out.println();
         public static String leftJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static String rightJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static void displayValidRecords(Product1 [] ValidProduct, int logicalSize) throws Exception {
              long longMAX_POSSIBLE_UPC_CODE = 999999999999L;
              // set input stream and get number
              Scanner stdin = new Scanner(System.in);
              System.out.print("Enter a 12-digit UPC number: ");
              long input =stdin.nextLong();
              long number = input;
              // determine whether number is a possible UPC code
              if ((input < 0)|| (input > longMAX_POSSIBLE_UPC_CODE)) {
                   // not a UPC code
                   System.out.println(input +"is an invalid UPC code");
              else {   
                   // might be a UPC code
                   // determine digits
                   int d12 = (int) (number % 10);
                   number /= 10;
                   int d11 = (int) (number % 10);
                   number /= 10;
                   int d10 = (int) (number % 10);
                   number /= 10;
                   int d9 = (int) (number % 10);
                   number /= 10;
                   int d8 = (int) (number % 10);
                   number /= 10;
                   int d7 = (int) (number % 10);
                   number /= 10;
                   int d6 = (int) (number % 10);
                   number /= 10;
                   int d5 = (int) (number % 10);
                   number /= 10;
                   int d4 = (int) (number % 10);
                   number /= 10;
                   int d3 = (int) (number % 10);
                   number /= 10;
                   int d2 = (int) (number % 10);
                   number /= 10;
                   int d1 = (int) (number % 10);
                   number /= 10;
                   // compute sums of first 5 even digits and the odd digits
                   int m = d2 + d4 d6 d8 + d10;
                   int n = d1 + d3 d5 d7 + d9 + d11;
                   // use UPC formula to determine required value for d12
                   int r = 10 - ((m +3*n) % 10);
                   // based on r, can test whether number is a UPC code
                   if (r == d12) {
                        // is a UPCcode
                        System.out.println(input+" is a valid UPC code");
                   else {   
                        // not a UPCcode
                        System.out.println(input+" is not valid UPC code");
    Any help would be great thanks !!
    Take care,

    1) It's your problem that you waited until the last minute before you went for help...not ours. We'll give your problem the same attention as anyone elses...therefore your problem isn't any more urgent than any other problem here.
    2) I don't intend on doing your entire assignment. Nor do I intend on reading all of it. If you need help with a specific requirement, then post the information/code relevant to that requirement. I don't know how to help you when you bury the problem inside a 9 mile long essay.
    3) Post code in tags so it's formatted and readable. (there's a *code* button up above that makes the tags for you).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Simple BIP Report help needed

    Hi All ,
    I am bit new to BI Publisher,I have done plenty of Oracle reports 6i and 10g.
    Have read the BIPublisher Guide as well,but could not understand a few points.
    suppose I want to build a very very simple report like
    Sysdate Sysdate Sysdate
    16-Oct-08 16-Oct-08 16-Oct-08
    step 1) I will write the following query in the Data Model and store/save it.
    select sysdate ,sysdate,sysdate from dual.
    Step 2) In the layout model I want to use .rtf layout .So in the MS word .rdf document I create /insert
    a table with 2 rows and 3 columns,where 1st row will have Sysdate in all 3 columns as header.
    Now to fetch date 3times(the data) from the above query,WHAT is going to be my next steps ????
    I am not able to understand the link between the layout(.rtf document) and XML document.
    Please can someone reply to this question and let me know ?
    Regards
    Sunny

    I added a useless parameter just so you could see where parms should go...
    Datatemplate:
    <dataTemplate name="A_SIMPLE_REPORT">
         <properties>
              <property name="xml_tag_case" value="upper"/>
         </properties>
         <parameters>
              <parameter name="P_PARM" dataType="character"/>
         </parameters>
         <dataQuery>
              <sqlStatement name="QUERYNAME">
                   <![CDATA[
    select sysdate SYSDATE1
    , sysdate SYSDATE2
    , sysdate SYSDATE3
    from dual
    where 'XYZ' = nvl(:P_PARM, 'XYZ')
    ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_UPPERGROUP" dataType="varchar2" source="QUERYNAME">
                   <element name="SYSDATE1" dataType="varchar2" value="SYSDATE1"/>
                   <element name="SYSDATE2" dataType="varchar2" value="SYSDATE2"/>
    <element name="SYSDATE3" dataType="varchar2" value="SYSDATE3"/>
              </group>
         </dataStructure>
         <dataTrigger name="afterReportTrigger" source="A_SIMPLE_REPORT.afterreport()"/>
    </dataTemplate>
    XML OUPUT:
    <?xml version="1.0" encoding="UTF-8" ?>
    <A_SIMPLE_REPORT>
    <LIST_G_UPPERGROUP>
    <G_UPPERGROUP>
    <SYSDATE1>2008-10-16T18:20:19.000-05:00</SYSDATE1>
    <SYSDATE2>2008-10-16T18:20:19.000-05:00</SYSDATE2>
    <SYSDATE3>2008-10-16T18:20:19.000-05:00</SYSDATE3>
    </G_UPPERGROUP>
    </LIST_G_UPPERGROUP>
    </A_SIMPLE_REPORT>
    Hope this helps,
    Scott
    PS If you have been doing reports for as long as you say you prob. know this already...but I NEVER* trust Oracle to convert my dates. I convert them all to char, pass them and convert them on "the other side" (if needed). But, you can change the data type to date if you feel brave, but don't say I didn't warn you. ;-)

Maybe you are looking for

  • Change column headers dynamically in OBIEE

    hey guys. We are working on a BI module for Finance. The data mart captures data for Actuals/Forecasts and Budgets for entire year by months (for example Jan2008 will have Actual/Forecast value and Budget value & similarly for other months of the yea

  • File Name Not Changing

    I am downloading some files via Safari. I then click the file name and paste the preferred name (usually in column view) copied off the Safari window. After a few, Finder stops allowing me to make any changes. I can get the name to open as if it can

  • ConnectionPool problems with WLS 7.0 and Oracle 9.2

    Hi, We are using WLS 7.0 SP4, and Oracle 9 and the Oracle thin driver type 4. In our application on the productive system (and only there) we constantly encounter a whole set of SQLExceptions which have all in common that the Connection from the pool

  • Sales order BOM configuration - CU51

    Hi, I am using with Variant configuration. I will be configuring the FERT into Sales Order for the characteristic. Then I tried for CU51 t code for BOM configuration (for adding or removing of materials for some special cases) in the sales order, But

  • Primary Key Conflicts While Inserting Rows

    Hi, I am inserting some rows into a table which has primary key constraints on columns 1,2,3. I have set the key columns in my program to 1,2,3. When I try to insert a row it throws a syncresolver exception stating that there is a key conflict. But i