URGENT Java/SQLJ Help

This is for my final exam that is due tomorrow. I've been trying everything & I just can't get it to work & my brain is turning to mush at this point. Please let me know if anyone can help...
We need to generate data for a table based on what is in our host variables & the number of rows is determined by the user. So the idea is that we only store a few names & we can randomly pick combinations of first & last to insert into the database up to the number the user entered (dups are OK).
So here is the basic code I have... If it stays like this is will just do Scott Jones, Mike Smith & Sally Miller. Then it will have an array out of bounds exception if the user entered anything more than 3. So I know I need to incorporate a random number generation to get different combinations, but I tried sticking the code everywhere & it wouldn't compile. PLEASE HELP!
String[] fname = new String[] { "Scott", "Mike", "Sally"};
String[] lname = new String[] { "Jones", "Smith", "Miller"};
try { for (int i=0; i<intnum; i++)
{ #sql {INSERT INTO users VALUES
(:(fname), :(lname[i]))};

Is 'intnum' the number to user put in?
You want to use the Random class (the Java API is your friend here) to generate a number that is within the range of possible indices for your array. And you want to do this the number of times the user says to (if I understand your problem).
Good luck with your exam.

Similar Messages

  • Urgent java code help needed

    i need java code for writing following lines in a file
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
    Moreover i need code for reading word by word html file.
    PLease reply as soon as possible.
    iwapsms

    for the html-part there are several html-parser, that bould whole parsetrees, which you can traverse (walk) through as you whish. just check google for it (something like: java html parser).
    if that xml you have there is in String-form, just use a Filewriter
    BufferedWriter writer = new BufferedWriter (new FileWriter (new File ("FilePath/filename.xml")));
    writer.write (xmlString);
    writer.close();however, if you have to juggle xml tags, content and attributes a lot, i'd recomend jdom to construct the xml and saxParser to write it.
    again jsut google for it.

  • Java Access Helper problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    sorry ab the multiple post, it was urgent for me to
    know the answer.
    I've JDK 1.4.2 and JAccessHelper should work with 1.3
    or later
    Can there be some kind of path problems?No, I doubt it. It's just some internal app failure - looks like it's trying to determine the running Java version, and is not doing a good job at it. But the failure has nothing per se to Java, it's that specific app - what are we supposed to know about that app though?

  • URGENT! PLS HELP Load tests (Oracle Load Testing) in OTM

    hello,
    it´s really urgent so please help!
    How can I see the test result of the lload tests (done with Oracle Load Testing) in OTM????
    I can not figure out why such an important point is missing in the documenation....
    Thank you very much for your (hopefully soon) help!
    Edited by: 853007 on 20.04.2011 05:42

    added these files in the classpath : using oracle 9i
    , jdk1.4.2
    C:\Documents and Settings\Sampathkumar\Desktop>set
    CLASSPATH=c:\oracle\ora92\jdb
    c\lib\ojdbc14.jar;c:\oracle\ora92\jdbc\lib\nls_charset
    12.jar;%CLASSPATH%;
    submitted this code as a sample to test the
    conection
    import java.sql.*;
    public class test{
    public static void main(String[] args) throws
    SQLException,ClassNotFoundException {
    //load oracle driver
    Class.forName("oracle.jdbc.OracleDriver");
    System.out.println("Driver Loaded");
    //connecTION to the sample database
    String url =
    =
    "jdbc.oracle:thin:@SEC_MEC-MS3:1521:global.oracle";
    Connection conn=DriverManager.getConnection
    tion (url,"sam","aaj");
    System.out.println("Database connection
    on successful");
    //create a statement
    Statement stmt = conn.createStatement();
    ResultSet rset =stmt.executeQuery("select
    ry("select sysdate from Dual");
    while (rset.next())
    System.out.println(rset.getString(1));
    }//end of test DB class
    give the error stack
    C:\Documents and Settings\Sampathkumar\Desktop>java
    test
    Driver Loaded
    Exception in thread "main" java.sql.SQLException: No
    suitable driver
    at
    at java.sql.DriverManager.getConnection(Unknown
    known Source)
    at
    at java.sql.DriverManager.getConnection(Unknown
    known Source)
    at test.main(test.java:17)__________________________________________________________
    You are loading the driver classes ok. But is that the appropriate driver for youir database?
    I know Oracle is phasing out the .zip version classes12.zip, but have tried them
    here the possible drivers
    ojdbc14.jar Oracle 9. and higher and jk1.4 and higher
    ojdbc14_g-1.jar - include extentsion Oracle 9. and higher and jk1.4 and higher
    classes12.zip - Primarily used with oralce 8.* and jk1.2.* - jtk1.3.*

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • Urgent JMS Problem,Help!!

    I meet a urgent problem about JMS,I use wls61 sp1
    but when serverl MDB subscribed to one topic,problem
    accur and not all of the subscriber seems to receive the
    message,I know that sp2 have slove the bugs.but I just
    want to get the patch of jms for wls61sp1.
    This is very urgent,can anyone help me to
    get the patch?
    Thanks a lot

    This sounds like the symptoms that I am currently suffering,
    under Weblogic 6.1 SP2.
    My situation is that I have processes on several "satellite"
    Weblogic servers that all subscribe to the same set of several
    JMS Topics published by a "central" Weblogic server. The servers
    are all using Weblogic 6.1 SP2 (non-clustered). It appears that
    only one of the subscribing "satellite" servers receives the
    messages published. After a couple of experiments, it appears
    that the first "satellite" server to register with the Topics is
    the one that receives the messages, even if that "satellite"
    server is restarted, until such time as the "central" server is restarted.
    It appears from Eric's message that there is a patch for this.
    How do I go about getting a copy of the patch? Or is my problem
    different?
    Thanks,
    -Chris-
    "Eric.Nie" <[email protected]> wrote:
    >
    I have got the patch,Thank u very much
    Ravi Akella <[email protected]> wrote:
    Are these subscribers on the server. If you could provide some more
    info about the problem I will try to help you.
    Ravi Akella.
    "Eric.Nie" wrote:
    I meet a urgent problem about JMS,I use wls61 sp1
    but when serverl MDB subscribed to one topic,problem
    accur and not all of the subscriber seems to receive the
    message,I know that sp2 have slove the bugs.but I just
    want to get the patch of jms for wls61sp1.
    This is very urgent,can anyone help me to
    get the patch?
    Thanks a lot

  • New to java(need help on access specifier)

    hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
    i am unable to understand how i can define all specifiers practicly.i mean in a program.
    thanks.plzzzzzzzz help me

    the most common project i can think of is a payroll system..
    you can have real implementation of all the access specifiers
    good luck

  • Pascal to Java Please help me!

    I am truobled in creating a validation method for the user loging in....
    As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
    PROGRAM USERLOGIN;
    TYPE
      USER_TYPE = RECORD
        USERNAME : STRING[15];
        PASSWORD : STRING[15];
    END;
        USFILE = FILE OF USER_TYPE;
    VAR
       USER: USER_TYPE;
       CKUSER: USER_TYPE;
       RECFILE : USFILE;
       I,J     : INTEGER;
    BEGIN
    WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
    WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
    FILESPEC :='USERFILE.USR';
    ASSIGN(RECFILE, FILESPEC);
    RESET(RECFILE);
      WHILE NOT EOF(RECFILE) DO
       BEGIN
         READ(RECFILE, USER);
         IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
              LOGIN
        ELSE
              WRITE('USER NOT FOUND');
       END;
    END.Thank you

    Don't bother:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=539277

  • How I can enable Java ssv helper plugin silently for win7 users with IE9

    here is what happens:
    when I deploy java 7.21 on win7 users, after deployment when users try to Open their IE they get a login screen and apparently it is related to Java ssv helper plugin. it is trying to enable it and needs admin account/password. I am trying to deploy this to about 3000 computers and I dont want all of them start calling helpdesk for this.
    your help is appreciated.

    The following article describes how to create a shared preference file. You can either create preferences that individual users can override, or create locked preferences that individual users cannot override.
    http://kb.mozillazine.org/Lock_Prefs
    (Note: I don't have any personal experience with these files, but another volunteer might post some additional tips and tricks.)

  • 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).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Urgent need of help with a java WSDL application

    Hello,
    I'm trying to turn a WORKING java application which uses some webservices, into a JAR file.
    Somehow i keep on getting the same errors all the time.
    I added all the necessary jar files, which are used in the program, in the global JAR file, but still the error remains.
    Can anyone help me with this error? (Error see below, WARNING EXTREMELY LONG!)
    ---------------------------------------------------------------- ERROR MESSAGE --------------------------------------------------------------------
    standard type mapping initialization error: javax.xml.rpc.JAXRPCException: javax
    .xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.mes
    saging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at test.proxy.runtime.RegistrationWS_Service_SerializerRegistry.getRegis
    try(RegistrationWS_Service_SerializerRegistry.java:26)
    at test.proxy.runtime.RegistrationWS_Service_Impl.<init>(RegistrationWS_
    Service_Impl.java:26)
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1300)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at test.Main.test(Main.java:21)
    at test.Main.<init>(Main.java:10)
    at test.Main.main(Main.java:14)
    CAUSE:
    javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SO
    AP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl n
    ot found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at test.proxy.runtime.RegistrationWS_Service_SerializerRegistry.getRegis
    try(RegistrationWS_Service_SerializerRegistry.java:26)
    at test.proxy.runtime.RegistrationWS_Service_Impl.<init>(RegistrationWS_
    Service_Impl.java:26)
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1300)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at test.Main.test(Main.java:21)
    at test.Main.<init>(Main.java:10)
    at test.Main.main(Main.java:14)
    Caused by: javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable t
    o create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFacto
    ry1_1Impl not found
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:95)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:62)
    at oracle.j2ee.ws.common.encoding.literal.StandardLiteralTypeMappings.<i
    nit>(StandardLiteralTypeMappings.java:198)
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:280)
    ... 10 more
    Caused by: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider
    com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:33)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:93)
    ... 13 more
    CAUSE:
    javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SO
    AP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl n
    ot found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at test.proxy.runtime.RegistrationWS_Service_SerializerRegistry.getRegis
    try(RegistrationWS_Service_SerializerRegistry.java:26)
    at test.proxy.runtime.RegistrationWS_Service_Impl.<init>(RegistrationWS_
    Service_Impl.java:26)
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1300)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at test.Main.test(Main.java:21)
    at test.Main.<init>(Main.java:10)
    at test.Main.main(Main.java:14)
    Caused by: javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable t
    o create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFacto
    ry1_1Impl not found
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:95)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:62)
    at oracle.j2ee.ws.common.encoding.literal.StandardLiteralTypeMappings.<i
    nit>(StandardLiteralTypeMappings.java:198)
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:280)
    ... 10 more
    Caused by: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider
    com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:33)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:93)
    ... 13 more
    ---------------------------------------------------------------- ERROR MESSAGE --------------------------------------------------------------------

    I face this same problem too, I have a jar which calls a webservice and I want to execute it from windows command , I get the following error when I use the command : java -cp Has.jar moicr.Main
    standard type mapping initialization error: javax.xml.rpc.JAXRPCException: javax
    .xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.mes
    saging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at has.proxy.runtime.JoPayWebServiceService_SerializerRegistry.getRegist
    ry(JoPayWebServiceService_SerializerRegistry.java:26)
    at has.proxy.runtime.JoPayWebServiceService_Impl.<init>(JoPayWebServiceS
    ervice_Impl.java:26)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at has.proxy.JoPayWebServiceClient.<init>(JoPayWebServiceClient.java:18)
    at moict.Main.confirmPayment(Main.java:142)
    at moict.Main.main(Main.java:93)
    CAUSE:
    javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SO
    AP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl n
    ot found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at has.proxy.runtime.JoPayWebServiceService_SerializerRegistry.getRegist
    ry(JoPayWebServiceService_SerializerRegistry.java:26)
    at has.proxy.runtime.JoPayWebServiceService_Impl.<init>(JoPayWebServiceS
    ervice_Impl.java:26)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at has.proxy.JoPayWebServiceClient.<init>(JoPayWebServiceClient.java:18)
    at moict.Main.confirmPayment(Main.java:142)
    at moict.Main.main(Main.java:93)
    Caused by: javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable t
    o create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFacto
    ry1_1Impl not found
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:95)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:62)
    at oracle.j2ee.ws.common.encoding.literal.LiteralAnyElementSerializer.<i
    nit>(LiteralAnyElementSerializer.java:16)
    at oracle.j2ee.ws.common.encoding.literal.StandardLiteralTypeMappings.<i
    nit>(StandardLiteralTypeMappings.java:198)
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:280)
    ... 14 more
    Caused by: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider
    com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:33)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:93)
    ... 18 more
    CAUSE:
    javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SO
    AP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl n
    ot found
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:282)
    at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(
    BasicService.java:244)
    at has.proxy.runtime.JoPayWebServiceService_SerializerRegistry.getRegist
    ry(JoPayWebServiceService_SerializerRegistry.java:26)
    at has.proxy.runtime.JoPayWebServiceService_Impl.<init>(JoPayWebServiceS
    ervice_Impl.java:26)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactory
    Impl.java:92)
    at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryIm
    pl.java:121)
    at has.proxy.JoPayWebServiceClient.<init>(JoPayWebServiceClient.java:18)
    at moict.Main.confirmPayment(Main.java:142)
    at moict.Main.main(Main.java:93)
    Caused by: javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable t
    o create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFacto
    ry1_1Impl not found
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:95)
    at oracle.j2ee.ws.common.encoding.literal.LiteralFragmentSerializer.<ini
    t>(LiteralFragmentSerializer.java:62)
    at oracle.j2ee.ws.common.encoding.literal.LiteralAnyElementSerializer.<i
    nit>(LiteralAnyElementSerializer.java:16)
    at oracle.j2ee.ws.common.encoding.literal.StandardLiteralTypeMappings.<i
    nit>(StandardLiteralTypeMappings.java:198)
    at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService
    .java:280)
    ... 14 more
    Caused by: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider
    com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found
    C:\>

  • Urgent! Pls help me! Can't compile any *.java files

    I am a new user to Java2SDK. I am using Win2K sever and I have installed Java2SDK1.4.0 in D drive. When I compile any *.java files, a message " 'javac' is not recognized as an internal or external command, operable program or batch file" appears. How can I solve this problem?
    Please help me. I am busy with my homework. Thank you very much.

    In your PATH variable include %JAVA_HOME%\bin;
    For example:
    C:\jdk1.4\bin;

  • Urgent!! Help Java 1.4 installation What is invaid or expired ticket?

    When I try to install Java 1.4 it says that I have an invalid or expired ticket. What does that mean? and How do I fix it? Please help. W

    Whose product is this? Cut & paste relevant information...

  • Help Urgent: Java Profiler

    Hi Frds,
    I am preparing a java profiler tool..i've seen a sample java profiler code..observed code with servlets and jsp..i'm new to J2EE..can you please tell me how to initiate it..i've observed few things to prepare own java profiler..
    Hook
    Java Agent
    ASM plugin
    plz..Can any one explain more about it..so that i can start writing code on it..
    thx in advance
    Rajesh.

    It is the project file(.jpx) and it has more than 1000 files in it..and it is completely applet application.. and it is not even showing what operation is unsupported..when i change to JDK1.4 ,it is working fine..the moment i shfted to jdk5.0 and try to rebuild it is giving "java.lang.UnsupportedOperationException" and it is not giving any other info.now..any one plz..help..

  • Basic Java Program help needed urgently.

    I have posted the instructions to my project assignment on here that is due tomorrow. I have spent an extremely large amount of time trying to get the basics of programming and am having some difficulty off of the bat. Someone who has more experience with this and could walk me through the steps is what I am hoping for. Any Help however will be greatly appreciated. I am putting in a lot of effort, but I am not getting the results I need. Thank you for the consideration of assisting me with my issues. If you have any questions please feel free to ask. I would love to open up a dialogue.
    CIS 120
    Mathematical Operators
    Project-1
    Max possible pts 100
    Write a program “MathOperators” that reads two integers, displays user’s name, sum, product,
    difference, quotients and modulus of the two numbers.
    1. Create a header for your project as follows:
    * Prgrammer: Your Name (1 pt) *
    * Class: CIS 120 (1 pt) *
    * Section: (1 pt) *
    * Instructor: (1 pt) *
    * Program Name: Mathematical Operators (1 pt) *
    * Description: This java program will ask the user to enter two integers and *
    display sum, product, difference, quotients and modulus of the two numbers
    * (5 pts) *
    2. Display a friendly message e.g. Good Morning!! (2 pts)
    3. Explain your program to the user e.g. This java program can add, subtract, multiply,
    divide and calculate remainder of any two integer numbers entered by you. Let’s get
    started…. (5 pts)
    4. Prompt the user- Please enter your first name, store the value entered by user in a
    string variable name. Use input.next() instead of input.nextLine(). (8 pts)
    5. Prompt the user- name, enter first integer number , store the value entered by user in
    an integer variable num1.(5 pts)
    6. Prompt the user- name, enter second integer number , store the value entered by user in
    an integer variable num2.(5 pts)
    7. Display the numbers entered by the user as: name has entered the numbers num1and
    num2.(5 pts)
    8. Calculate sum, product, difference, quotients and modulus of the two numbers. ( 30 pts)
    9. Display sum, product, difference, quotients and modulus of the two numbers. ( 10 pts)
    10. Terminate your program with a friendly message like- Thanks for using my program,
    have a nice day!!(2 pts)

    Nice try. You have not demonstrated that you've at least TRIED to do something. No one is going to do your homework for you. Your "urgency" is yours alone.

Maybe you are looking for

  • Can not get access files from Windows 7 to Claims-based file authorization share

    We have AD level 2012R2, DCs running 2012R2 of course, and we have clustered File Server (3 FSNodes running 2012R2). We enabled 2 policies  KDC Support for claim Kerberos support for claim We created 1 claim type in ADAC (For example "Division" Sourc

  • The instruction at 0x10001d8d reference memory at 0x00000000. The memory could not be read.

    I've tried looking up the answer online but I cannot find the one specific to this code. No idea what it means or how to fix it, or even if it posses a major issue. But I have been having issues with my internet browsers. when I open them as soon as

  • TS2755 Group iMessage is not working after upgrading to ios 7.

    When creating a group chat using iMessage with ios 7 or 7.0.2  When you send a message each person gets the text as an individual text and when they reply back it comes back as an individual text not in the group chat as it did in the previous ios ve

  • N95 problem with phone memory and backup.

    My phone is saying that I have 1870 MB of messages on the phone memory (which can't be true), and it is refusing to back up on the memory card, which I guess is because of this problem as it thinks there's not enough space on the card. Anyone know wh

  • I canu00B4t reimport a model

    Hi forum When i try to reimport a "model" i got the next error: !MESSAGE Apr 28, 2008 12:58:45...         com.sap.ide.webdynpro.ui.service.ServicesUI          [Thread[main,5,main]] Error: Internal error    Plugin name: Web Dynpro Model Editor    Plug