New to java,,,help needed urgently

I am geeting a compile error..."cannot resolve symbol" in my main class. The program is supposed to prompt the user for five sets of data, and calculate the tax and total of the entered products and print it back to the screen, it is also supposed to calculate the cheapest and most expensive item and print them back. can someone pls shed some light on this error msg, as I cant seem to get my head around it.
import java .io.*;
import java.util.StringTokenizer;
import java.text.NumberFormat;
import java.util.Locale;
//set up a class to call on the constructors from the catalogueitem class
public class Myassg4
     private static final int MAX = 2;//sets the length to 2
     private static CatalogueItem[] prodlist ;//sets array for product list
     NumberFormat cash = NumberFormat.getCurrencyInstance(new Locale("en","AU"));
     private static void main(String[] args) throws IOException
     {//declare the variables and initialize
     double preTotal = 0.00;
     String inString;
     double maximum, lowest;
     double sum = 0.00;
     BufferedReader stdin = new BufferedReader (new
     InputStreamReader(System.in));
     prodlist = new CatalogueItem[];//sets the length (THIS IS WHERE THE PROBLEM OCCURS!!!!)
System.out.println("Enter 5 sets of data");
     //loop through the array and read the data in
     for(int i = 0;i <prodlist.length;i++)
          inString = stdin.readLine();
          //create a String Tokenizer to read the data separately
          StringTokenizer tok = new StringTokenizer(inString, ":");
prodlist[i] = new CatalogueItem(tok.nextToken(), tok.nextToken(),
Double.parseDouble(tok.nextToken()));
}//end of loop
//create a header and print the data back to the screen
System.out.println();
System.out.println("LISTING OF ALL GOODS");
System.out.println();
System.out.println("Cat\tDescription\tExTax\tTax\tIncTax");
System.out.println("___\t___________\t_____\t___\t______");
System.out.println();
for(int j = 0;j <prodlist.length;j++){
System.out.println(prodlist[j].getCatno()+"\t"+prodlist[j].getDesc()+
"\t"+prodlist[j].getPrice()+"\t"+prodlist[j].getTax()
+"\t"+prodlist[j].getIncTax());
I have errors every where the prodlist is used, I know I am not initializing it correctly but dont know what the alternatives are.

daniel here is the entire code if you do get a chance can you pls have a look at it for me thanks.
import java .io.*;
import java.util.StringTokenizer;
import java.text.NumberFormat;
import java.util.Locale;
//set up a class to call on the constructors from the catalogueitem class
public class Myassg4
     private static final int MAX = 2; //sets the length to 2
     private static CatalogueItem[] prodlist; //sets array for product list
     NumberFormat cash = NumberFormat.getCurrencyInstance(new Locale("en","AU"));
     private static void main(String[] args) throws IOException
     {//declare the variables and initialize
     double preTotal = 0.00;
     String inString;
     double maximum, lowest;
     double sum = 0.00;
     BufferedReader stdin = new BufferedReader (new
     InputStreamReader(System.in));
     prodlist = new CatalogueItem[5];//sets the length
     System.out.println("Enter 5 sets of data");
     //loop through the array and read the data in
     for(int i = 0;i <prodlist.length;i++)
          inString = stdin.readLine();
          //create a String Tokenizer to read the data separately
          StringTokenizer tok = new StringTokenizer(inString, ":");
prodlist[i] = new CatalogueItem(tok.nextToken(), tok.nextToken(),
Double.parseDouble(tok.nextToken()));
}//end of loop
//create a header and print the data back to the screen
System.out.println();
System.out.println("LISTING OF ALL GOODS");
System.out.println();
System.out.println("Cat\tDescription\tExTax\tTax\tIncTax");
System.out.println("___\t___________\t_____\t___\t______");
System.out.println();
for(int j = 0;j <prodlist.length;j++){
System.out.println(prodlist[j].getCatno()+"\t"+prodlist[j].getDesc()+
"\t"+prodlist[j].getPrice()+"\t"+prodlist[j].getTax()
+"\t"+prodlist[j].getIncTax());
//use this data and call the cheapest method to print
//the cheapest goods in the catalogue
System.out.println();
System.out.println("CHEAPEST GOODS IN THE CATALOGUE");
System.out.println();
lowest = cheapest(prodlist, MAX);
System.out.println("Cat\tDescription\tExTax\tTax\tIncTax");
System.out.println("___\t___________\t_____\t___\t______");
System.out.println();
for(int k = 0;k <prodlist.length;k++){
if(prodlist[k].getTaxInc == lowest)
System.out.println(prodlist[k].Catno()+"\t"+prodlist[k].getDesc()+
"\t"+prodlist[k].getPrice()+"\t"+prodlist[k].getTax()
+"\t"+prodlist[k].getIncTax());
//use the listing of all goods and call the most expensive method
//to calculate and display back on screen
System.out.println();//create two lines of space in between
System.out.println();
System.out.println("MOST EXPENSIVE GOODS IN THE CATALOGUE");
System.out.println();
maximun = expensive(prodlist, MAX);
System.out.println("Cat\tDescription\tExTax\tTax\tIncTax");
System.out.println("___\t___________\t_____\t___\t______");
System.out.println();
for(int l = 0;l < prodlist.length;l++){
if(prodlist[l].getTaxInc == maximum)
System.out.println(prodlist[l].Catno()+"\t"+prodlist[l].getDesc()+
"\t"+prodlist[l].getPrice()+"\t"+prodlist[l].getTax()
+"\t"+prodlist[l].getIncTax());
//print the pretax worth of goods by calling the method and display
System.out.println();//create a two lines of space in between
System.out.println();
System.out.println("TOTAL OF PRE-TAX WORTH OF CATALOGUE ITEMS: "+preTaxWorth
(prodlist));
//print the avg tax payable per item
System.out.println();
System.out.println("AVERAGE AMOUNT OF TAX PAYABLE PER ITEM:"+avgTax
(prodlist));
//declare the other methods within the scope of the main class
public static double cheapest(CatalogueItem[] prodlist, int size)
     double lowest = prodlist[0].getIncTac();
     for(int i = 0; i < size;i++)
          if(prodlist.getIncTax() < lowest)
          lowest = prodlist[i].getIncTax();
     return lowest;
public static double expensive(CatalogueItem[] prodlist, int size)
     double maximum = prodlist[0].getTaxInc();
     for(int i = 0; i < size; i++)
          if(prodlist[i].getIncTax() > maximum)
          maximum = prodlist[i].getIncTax();
     return maximum;
public static double preTaxWorth(CatalogueItem[] prodlist)
{//add all the getPrice's in together
double preTax = 0; //prodlist[0].getPrice();
for(int i =0; i <prodlist.length; i++)
     preTax += prodlist[i].getPrice();
return preTax;
public static double avgTax(CatalogueItem[] prodlist)
{//run through the array and add all the getTax amounts up.
     double sum = 0;
     for(int i = 0; i < prodlist.length; i++)
          sum = sum + prodlist[i].getTax();
     //to get the avg we divide the sum by the MAX number of entries
     double Total = sum / MAX;
     return Total;
}//end of main class
//CatalogueItem class      
//catalogue item class
//ensure that the accesors and mutators
//are visible and cannot be overridden
class CatalogueItem
//declare the data types
private String catno;
private String desc;
private double price;     
//declare the taxation rate constant
//but make it visible
public CatalogueItem(){
     catno = " ";
     desc = " ";
     double price;
//declare the full constructor
CatalogueItem (String inCatno, String inDesc, double Price)
     inCatno = catno;
     inDesc = desc;
     Price = price;
//name accessor---not overidable
public final String getCatno()
     return catno;
//name product description accessor--not overidable
public final String getDesc()
     return desc;
//name the extax method
public double getPrice()
     return price;
//tax utility method
public double Tax()
double Tax;     
     Tax = 00.15 * getPrice();
     return Tax;
//Including Tax method
public double IncTax()
     double IncTax;
     IncTax = Tax() + getPrice();
     return IncTax;

Similar Messages

  • New to Java:   Help Needed

    Hi,
    I am writing a utility to monitor all the objects created by my application. I want to be able to get not only values of class variables(for which the reflection package seems pretty useful), but also instance variables.
    For example.
    public class myClass {
    //Constructor
    public myClass(int i) {
    // another class instantiates this one
    myClass mc = new myClass(10);
    myClass mc1 = new myClass(20);
    I need to keep track of the the handles mc and mc1 and the
    other initializations they do based on the value passed at runtime.
    Is there a way to to this. Or even better, is there someplace in Java which stores all the objects instantiated and their handles?
    Any suggestions would be greatly appreciated.
    Thnx
    cvsan

    How do I access private and proteced variables. By default only the public variables are accessible via the reflect class as in the example below.
    Class c = rc.getClass();
    String s = c.getName();
    System.out.println(s);
    try { abcField = c.getField("abc");
    where abc is a public instance variable. If abc is a private instance variable, the above example fails.
    Is there any way to override the data hiding feature of Java?
    Thanks
    cvsan

  • New to XI (help needed urgent)

    hi all i am new to XI . i have just started learning . so if any one have some documents regarding it then plz share with me.iam lookig for the documents in following areas
    1. XI Fundamentals.
    2. Mapping Concepts.
    3. Adapters Concepts.
    4. Business Process Management Concepts.
    5. Mapping,Adapters and BPM.
    i will be grateful to u and ur efforts.
    i will also give points for ur efforts.
    my id - [email protected]
    plz i am looking for all ur helps.
    its very urgent
    Message was edited by: sanjeev singh

    Hi,
    This is very good document regargding mapping
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb398d3
    Regards,
    Prakash

  • HT201210 i have an error of no 11. kindly help, needed urgently

    i have an error of no 11. kindly help, needed urgently
    when i try to upgrage my
    iphone 3gs wit 4.1 to new latest 5.1
    it gives the erorr of 11. what that mean? Reply as soon as you can !
    thnx

    Error -1 may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.

  • Some J2ME midlets doubts!! help needed urgently!!!

    Hi,
    I am currently working in a company where it does wireless technology like WAP and I am assigned a task of creating a screensaver midlet. I have some doubts on the midlets.
    1) How do i use a midlet suites? From what I heard from my colleagues & friends, a servlet is needed for midlets to interact with one another. is it true?
    2) How do I get the startin midlet to take note the phone is idling so that the screen saver midlet can be called?
    Help needed urgently... if there is any source codes for me to refer to would be better... Thanks...
    Leonard

    indicates that MIDlet suites are isolated (on purpose) from each other, so you can't write over another one's address space.
    Also, I believe (at least on cell phones) that you have to specifically enter the Java Apps mode; unless you do the app won't execute. If you are in Java apps mode and a call comes in, the cell's OS puts the Java app currently executing on "Pause" mode and switches back to phone mode.
    Not sure if you will be able to have a Java app do that automatically.
    BTW why do you need a screensaver on an LCD display? Is it really intended to show an advertisement?
    Download and real all the docs you can from Sun, once you get over the generic Java deficiencies MIDlet's aren't that hard.

  • Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss....

    Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss..

    The startup disk may need repairing.
    Startup your Mac while holding down the Command + R keys so you can access the built in utiliites to repair the startup disk if necessary or restore OS X using OS X Recovery

  • Convert C++ prog into Java( I m new in java)help urgent

    hi all,
    i am very new in java. i have code of C++.i have to convert it in to Java.please help me on urgent basis.plz provide me solution.
    I am looking for positive response.code is below:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sys/stat.h>
    #include <fstream.h>
    #include <iostream.h>
    //#include <sha.h> //24112003
    //#include<wincrypt.h>
    char ntc(unsigned char n){
    if (n<26) return 'A'+n;
    if (n<52) return 'a'-26+n;
    if (n<62) return '0'-52+n;
    if (n==62) return '+';
    if (n==63)return '/';
    unsigned char ctn(char c){
    if (c=='/') return 63;
    if (c=='+') return 62;
    if ((c>='A')&&(c<='Z')) return c-'A';
    if ((c>='a')&&(c<='z')) return c-'a'+26;
    if ((c>='0')&&(c<='9')) return c-'0'+52;
    if (c=='~') return 80;
    return 100;
    int b64decode(char from,char to,int length){
    unsigned char c,d,e,f;
    char A,B,C;
    int i;
    int add;
    char *tot=to;
    for (i=0;i+3<length;){
    add=0;
    A=B=C=0;
    c=d=e=f=100;
    while ((c==100)&&(i<length)) c=ctn(from[i++]);
    while ((d==100)&&(i<length)) d=ctn(from[i++]);
    while ((e==100)&&(i<length)) e=ctn(from[i++]);
    while ((f==100)&&(i<length)) f=ctn(from[i++]);
    //if (f==100) return -1; /* Not valid end */
    if (c<64) {
    A+=c*4;
    if (d<64) {
    A+=d/16;
    B+=d*16;
    if (e<64) {
    B+=e/4;
    C+=e*64;
    if (f<64) {
    C+=f;
    to[2]=C;
    add+=1;
    to[1]=B;
    add+=1;
    to[0]=A;
    add+=1;
    to+=add;
    if (f==80) return to-tot; /* end because '=' encountered */
    return to-tot;
    int b64get_encode_buffer_size(int l,int q){
    int ret;
    ret = (l/3)*4;
    if (l%3!=0) ret +=4;
    if (q!=0){
    ret += (ret/(q*4));
    /* if (ret%(q/4)!=0) ret ++; */ /* Add space for trailing \n */
    return ret;
    int b64strip_encoded_buffer(char *buf,int length){
    int i;
    int ret=0;
    for (i=0;i<length;i++) if (ctn(buf)!=100) buf[ret++] = buf [i];
    return ret;
    int b64encode(char from,char to,int length,int quads){
    // 3 8bit numbers become four characters
    int i =0;
    char *tot=to;
    int qc=0; // Quadcount
    unsigned char c;
    unsigned char d;
    while(i<length){
    c=from[i];
    *to++=ntc(c/4);
    c=c*64;
    i++;
    if (i>=length) {
    *to++=ntc(c/4);
    *to++='~';
    *to++='~';
    break;
    d=from[i];
    *to++=ntc(c/4+d/16);
    d=d*16;
    i++;
    if (i>=length) {
    *to++=ntc(d/4);
    *to++='~';
    break;
    c=from[i];
    *to++=ntc(d/4+c/64);
    c=c*4;
    i++;
    *to++=ntc(c/4);
    qc++; /* qz will never be zero, quads = 0 means no linebreaks */
    if (qc==quads){
    *to++='\n';
    qc=0;
    /* if ((quads!=0)&&(qc!=0)) to++='\n'; / /* Insert last linebreak */
    return to-tot;
    char* mEncryptPassword(char* mPassword)
    char mEncryptedPassword[200]; // To hold encrypted password.
    //char* mEncryptedPassword = new char[200];
    char mPrimEncryptedPassword[200];
    char * temp = new char[200];
    //unsigned char* md; // 19122003
    //md = new unsigned char[100]; // 19122003
    memset(mEncryptedPassword, '\0', sizeof(mEncryptedPassword));
    memset(mPrimEncryptedPassword, '\0', sizeof(mPrimEncryptedPassword));
    strcpy(mPrimEncryptedPassword, mPassword);
    //strcpy(mPrimEncryptedPassword, (char*) SHA1((unsigned char*) mPassword, strlen(mPassword), NULL));
    //strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); // 19122003
    //strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); //19122003
    b64encode(mPrimEncryptedPassword, mEncryptedPassword, strlen(mPrimEncryptedPassword), 0);
    // If successfully encrypts..
    if (mEncryptedPassword != NULL)
    //char * temp = new char[strlen(mEncryptedPassword)+1];
    strcpy(temp,mEncryptedPassword);
    // strcpy(mRetVal,mEncryptedPassword);
    return (char*)temp;
    //return (mEncryptedPassword);
    //return (char*) md; // 19122003
    else
    return ("Error");
    char* mDecryptPassword(char* mPassword)
    char mDecryptedPassword[200]; // To hold decrypted password.
    char mPrimDecryptedPassword[200];
    char * temp = new char[200];
    // 02032007
    memset(mDecryptedPassword, '\0', sizeof(mDecryptedPassword));
    memset(mPrimDecryptedPassword, '\0', 200);
    strcpy(mPrimDecryptedPassword, mPassword);
    b64decode(mPrimDecryptedPassword, mDecryptedPassword, strlen(mPrimDecryptedPassword));
    // If successfully decrypts..
    if (mDecryptedPassword != NULL)
    //char * temp = new char[strlen(mEncryptedPassword)+1];
    strcpy(temp,mDecryptedPassword);
    // strcpy(mRetVal,mDecryptedPassword);
    return (char*)temp;
    //return (mEncryptedPassword);
    //return (char*) md; // 19122003
    else
    return ("Error");
    void main(int argc, char* argv[])
    cout << mEncryptPassword(argv[1])<<endl<<flush;
    cout << mDecryptPassword(mEncryptPassword(argv[1]))<<endl<<flush;
    Anubhav

    endasil wrote:
    I just thought of how ridiculous this would sound in any other profession:
    Surgeons:
    plz plz help I have patient dying need to insert new kidney into 90yr old patient plz someone come do itLawyers:
    Help client guilty need good defense (I m new in law)help urgentHow come we get stuck with the lazy low-lifes?Because there's no legal requirement that a software developer must be licensed

  • New to Java and need help with this program..please!

    I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
    The assignment requirements are:
    1. Change a card game application that draws two cards
    and the higher card wins, to a Blackjack application
    2. Include a new class called Hand
    3. The Hand class should record the number of draws
    4. The application should prompt for a number of draws
    5. The game is played against the Dealer
    6. The dealer always draws a card if the dealer's hand total is <= 17
    7. Prompt the player after each hand if he wants to quit
    8. Display the total games won by the dealer and total and the total games wond by the player after each hand
    9. Display all of the dealer's and player's cards at the
    end of each hand
    10. Player has the option of drawing an additional card after the first two cards
    11. The Ace can have a value of 11 or 1
    (Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
    The following is my code with some comments about a few things that are driving me nuts:
    import java.util.*;
    import javax.swing.*;
    import java.text.*;
    public class CardDeck
    public CardDeck()
    deck = new Card[52];
    fill();
    shuffle();
    public void fill()
    int i;
    int j;
    for (i = 1; i <= 13; i++)
    for (j = 1; j <= 4; j++)
    deck[4 * (i - 1) + j - 1] = new Card(i, j);
    cards = 52;
    public void shuffle()
    int next;
    for (next = 0; next < cards - 1; next++)
    int rand = (int)(Math.random()*(next+1));
    Card temp = deck[next];
    deck[next] = deck[rand];
    deck[rand] = temp;
    public final Card draw()
    if (cards == 0)
    return null;
    cards--;
    return deck[cards];
    public int changeValue()
    int val = 0;
    boolean ace = false;
    int cds;
    for (int i = 0; i < cards; i++)
    if (cardValue > 10)
    cardValue = 10;
    if (cardValue ==1)     {
    ace = true;
    val = val + cardValue;
    if ( ace = true && val + 10 <= 21 )
    val = val + 10;
    return val;
    public static void main(String[] args)
    CardDeck d = new CardDeck();
    int x = 3;
    int i;
    int wins = 1;
    int playerTotal = 1;
    do {
    Card dealer = (d.draw());
    /**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
    System.out.println("Dealer draws: " + dealer);
    do {
    dealer = (d.draw());
    System.out.println(" " + dealer);
    }while (dealer.rank() <= 17);
    Card mine = d.draw();
    System.out.println("\t\t\t\t Player draws: "
    + mine);
    mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
    do{
    String input = JOptionPane.showInputDialog
    ("Would you like a card? ");
    if(input.equalsIgnoreCase("yes"))
         mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
         playerTotal++;
         else if(input.equalsIgnoreCase("no"))
    System.out.println("\t\t\t\t Player stands");
         else
    System.out.println("\t\tInvalid input.
    Please try again.");
    I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
    if ((dealer.rank() > mine.rank())
    && (dealer.rank() <= 21)
    || (mine.rank() > 21)
    && (dealer.rank() < 22)
    || ((dealer.rank() == 21)
    && (mine.rank() == 21))
    || ((mine.rank() > 21)
    && (dealer.rank() <= 21)))
    System.out.println("Dealer wins");
    wins++;
         else
    System.out.println("I win!");
    break;
    } while (playerTotal <= 1);
    String stop = JOptionPane.showInputDialog
    ("Would you like to play again? ");
    if (stop.equalsIgnoreCase("no"))
    break;
    if (rounds == 5)
    System.out.println("Player wins " +
    (CardDeck.rounds - wins) + "rounds");
    } while (rounds <= 5);
    private Card[] deck;
    private int cards;
    public static int rounds = 1;
    public int cardValue;
    /**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
    class Hand()
    static int r = 1;
    public Hand() { CardDeck.rounds = r; }
    public int getRounds() { return r++; }
    final class Card
    public static final int ACE = 1;
    public static final int JACK = 11;
    public static final int QUEEN = 12;
    public static final int KING = 13;
    public static final int CLUBS = 1;
    public static final int DIAMONDS = 2;
    public static final int HEARTS = 3;
    public static final int SPADES = 4;
    public Card(int v, int s)
    value = v;
    suit = s;
    public int getValue() { return value; }
    public int getSuit() { return suit;  }
    public int rank()
    if (value == 1)
    return 4 * 13 + suit;
    else
    return 4 * (value - 1) + suit;
    /**This works, but I'm confused. How is this method called? Does it call itself?**/
    public String toString()
    String v;
    String s;
    if (value == ACE)
    v = "Ace";
    else if (value == JACK)
    v = "Jack";
    else if (value == QUEEN)
    v = "Queen";
    else if (value == KING)
    v = "King";
    else
    v = String.valueOf(value);
    if (suit == DIAMONDS)
    s = "Diamonds";
    else if (suit == HEARTS)
    s = "Hearts";
    else if (suit == SPADES)
    s = "Spades";
    else
    s = "Clubs";
    return v + " of " + s;
    private int value; //Value is an integer, so how can a
    private int suit; //string be assigned to an integer?
    }

    Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
    Card dealer = (d.changeValue());
    I get an error message saying:
    Incompatible types found: int
    required: Card
    I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
    Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated.

  • 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

  • Help needed urgently on a problem..plzzz

    hi..this is a linear congruential generator. I have to implement it and i need the execution time for the program.
    for your understanding i'm providing an example below.
    Xn=(( a* xn-1 )+b) mod m
    If X0=7 ; a = 7 ; b =7 ; m=10
    Then
    X0 = 7
    X1 =((7 * 7) + 7))mod 10 = 6
    X2 = ((6*7)+7))mod 10 = 9
    X3 = ((9*7)+7) mod 10 = 0
    X4 = ((0*7)+7) mod 10 = 7
    Now since the cycle is being repeated i.e 7 appears again�so the period is 4 coz there are 4 diff nos. i.e 7,6,9,0�..
    help required urgently....your help will be appreciated...thankyou..

    Hi,
    I wrote the code so that it catches any cycle (not only the "big" one).
    Otherwise it will enter infinite loop...
    The time complexity is O(N*logN): it can do at most N iterations (here N is your 'm'), and in each iteration there can be O(log N) comparisons (since I maintain TreeSet).
    Interesting issue: is it possible to supply such (x0, a, b, m) tuple such that all possible values from 0 to m-1 will be output? I think no :)
    Here is the program:
    package recurr;
    import java.util.TreeSet;
    import java.util.Comparator;
    public class Recurrences {
         private static long x0, a, b, m;
         private static TreeSet theSet;
         public static void main(String[] args)
              long l0, l1, l2, l3;
              try {
                   x0 = Long.parseLong(args[0]);
                   a = Long.parseLong(args[1]);
                   b = Long.parseLong(args[2]);
                   m = Long.parseLong(args[3]);
              } catch(NumberFormatException nfe) {
                   nfe.printStackTrace();
              System.out.println("X[0]: " + x0 + "\n");
              long curr = x0;
              boolean cut = false;
              int i;
              // initialize the set
              theSet = new TreeSet(new LongComparator());
              // we can get at most m distinct values (from 0 to m-1) through recurrences
              for(i=1; i <= m; ++i) {
                   // iterate until we find duplicate
                   theSet.add(new Long(curr));
                   curr = recurrence(curr);
                   if(theSet.contains(new Long(curr))) {
                        cut = true;
                        break;
                   System.out.println("X[" + i + "]: " + curr + "\n");
              if(cut) {
                   System.out.println("Cycle found: the next will come " + curr + "\n");
              } else {
                   System.out.println("No cycle found!");
              System.out.println("----------------------------------");
              System.out.println("Totally " + (i-1) + " iterations");
         private static long recurrence(long previous)
              return (a*previous + b)%m;
         static class LongComparator implements Comparator
              public int compare(Object o1, Object o2)
                   if(((Long)o1).longValue() < ((Long)o2).longValue()) {
                        return -1;
                   } else if(((Long)o1).longValue() > ((Long)o2).longValue()) {
                        return 1;
                   } else return 0;
    }

  • Help Needed Urgently !! weblogic portal , webflow, cookies

    Hello!!
    I am new to java related technology, I need help asap,
    Using webflow, I need to make a portlet within a portal with 3 JSP
    pages (login.jsp,welcome.jsp,logout.jsp)
    Login.jsp
    It should have form with 2 textboxes (Username & password) and a
    submit button
    Upon clicking submit button a cookie for username and password should
    be created and the displayed in "welcome.jsp" page.
    welcome.jsp
    Everytime his page is called by the browser it should read the
    username and password from the cookie and display.
    It should have a Button upon clicking which the cookie containing the
    username and password is deleted.
    logout.jsp
    This page should confirm the deletion of cookie and should have a link
    to login.jsp page
    NOTE: PLEASE I NEED THE ENTIRE CODE ASAP.

    you know what ... i need the entire money ... all 3 million $ for that job bevore
    I will write a line :)
    [email protected] wrote:
    Hello!!
    I am new to java related technology, I need help asap,
    Using webflow, I need to make a portlet within a portal with 3 JSP
    pages (login.jsp,welcome.jsp,logout.jsp)
    Login.jsp
    It should have form with 2 textboxes (Username & password) and a
    submit button
    Upon clicking submit button a cookie for username and password should
    be created and the displayed in "welcome.jsp" page.
    welcome.jsp
    Everytime his page is called by the browser it should read the
    username and password from the cookie and display.
    It should have a Button upon clicking which the cookie containing the
    username and password is deleted.
    logout.jsp
    This page should confirm the deletion of cookie and should have a link
    to login.jsp page
    NOTE: PLEASE I NEED THE ENTIRE CODE ASAP.

  • Help needed Urgently- Rebate based on collected amount

    Dear all,
    I come across scenario while discussiion with client that they require rebate with collection. Details of the requirement are given below:
    1. SAP rebates run on billed values & set the accrual in rebate agreement on the rate what we have specified in the rebate agreement. Requirement is that, If i have billed on 1000$ & my accrual value is 100$ with the rate of 10%. If i collected 800$ instead of 1000$, then i need to pay the accrual on the basis of 800$ not on the basis of 1000$. It means i have to adjust accrual amount on the basis of 800$. Conclusion is that i have to pay not 100$ accrual instead less then 100$ on the basis of 800$ which i collected.
    2. In month 1 have billed on 5000$, my accrual amount is 500$ with rate of 10%. In the 2nd month i have to bill 1000$ and i have given an discount of 500$, it means my billed value is 500$ and my accrual amount is 50$@10%. In month 3 again i billed 500$ and my accrual amount is 50$@10%.
    Requirement is that, when i am going to pay the accrual to client, i should pay correct accrual for which he is entitled for. Means i should pay 100$ accrual not 600$ because i have already given an discount of 500$. Discount which i have given already of 500$ should need to be offest with the first month accrual of 500$. So remaning accrual is 100$.
    Great if somebody can help me out for the solutioning of the above requirements.

    Thanks Ivano,
    Somebody has started the conversation.
    Let me put my questions again.
    This requirement is nothing to do with Payment procedure in the agreement type.
    1. In any month if i billed 1000$, so my account receivable would be 1000$. My rebate for that month is 100$ at the rate of 10%. During customer receipt if i collected against my invoice 900$ instead of 1000$, my accrual needs to be corrected 90$ instead of 100$.
    I know this can not be fullfilled by standard SAP, by any thoughts on this welcomed.
    2. I know Rebate can be settled partially or full settlement by payment method( by cheque, bank transfer, or by credit memo) we have configure in rebate agreement type. But here requirement is totally different.
    Here, i need to pay the Rebate as a Discount instead of by cheque or by credit memo. While doing the partial or full settlement system will take into account collected accrual up to that day & apply as a discount to the final bill.
    Scenario is like that sometimes customer asked to give us the discount on bill for whatever they accrued so far.
    This is again cannot solved by standard SAP, but any thought by any body welcome. We have already thought that we need to enhance the solution.
    Solution needed urgently.

  • JVM & JProfiler - Help needed urgent

    Hi,
    I am a fresher and new to java. I am doing load testing. When i hook up a profler into JVM and run a test for 10 mins with 10 virtual users, i see deadlocks and 200 transactions will be completed in this period.
    When i take out profiler and run the same test for 10 mins with 10 virtual users i see 1400 transaction being completed.
    Please let me know what is the reason for drop in number of transactions when i run a test with JProfiler hooked into JVM.
    Also deadlock issue has anything to do with JProfiler as it retrieves data from it?
    Please suggest. Also let me know how do i analyze deadlocks?
    Thanks
    Aditya

    Hi,
    I am a fresher and new to java. I am doing load
    testing. When i hook up a profler into JVM and run a
    test for 10 mins with 10 virtual users, i see
    deadlocks and 200 transactions will be completed in
    this period.
    When i take out profiler and run the same test for 10
    mins with 10 virtual users i see 1400 transaction
    being completed.
    Please let me know what is the reason for drop in
    number of transactions when i run a test with
    JProfiler hooked into JVM.It's normal. You always get a negative impact on performance when using a profiler. This impact depends on the profiling technique (AOP, bytecode instrumentation, custom classloader...) and the kind of profiling data (memory usage, response time ...). Follow vendor instructions to minimize this impact.
    >
    Also deadlock issue has anything to do with JProfiler
    as it retrieves data from it?What kind of deadlocks? Can you post thread dumps?
    Maybe your application has some kind of hidden error that you cannot see if it isn�t under heavy load.
    >
    Please suggest. Also let me know how do i analyze
    deadlocks?There's a nice tool to analyze thread dumps called "Samurai".
    >
    >
    Thanks
    Aditya

  • Unable to allocate 27160 bytes.........Help needed urgently

    hi
    in my production database in getting this error..
    ORA-04031: unable to allocate 27160 bytes of shared memory ("shared
    pool","unknown object","sga heap(1,0)","session param values")
    help needed urgently

    If you have a program that does not use bind variables you can get this error.
    In such cases you do not want to increase the size of the shared pool, but reduce it, and flush regularly. This is a bug in the application and should be fixed to use bind variables.
    Another possible workaround is setting cursor_sharing = force, but this can cause other problems, so should only be used as a last resort. If the apps connections can be distinguished by user account or machine, then a log on trigger could be set cursor_sharing just for that application, to limit the damage until the vendor can fix it.

  • I am new to Java. Need help-urgent

    I need to write a java program that reads a text input and outputs it one word per line. Also, print the total number of words in the inputtext. I am not allowed to use a StringTokenizer object. Could you please tell me how to do it?
    Thanks

    copy the string you read in to a char[] then
    use a for loop to iterate through the array using print instead of println to write out each letter
    once you come to a space use println.

Maybe you are looking for

  • Error Messages for iTunes and Quicktime, what do I do?

    Hello, I'm in need of some help. Let me walk you all through what I did for the last 4 hours: (important note: I suck at far too much computer stuff, so I am fully aware that as you read the following, at certain points I probably made the problem mu

  • Time machine - on a new Mac, how can I find my old files?

    My iMac had to give way to the new baby, so I got myself an older MacBook Pro to replace it. I used the Migration Assistant to port all my music, photos etc. over, but the hard disk was smaller so had to forgo some bigger files - like my iMovie libra

  • HR: Address data not updated in ALE inbound

    Hello all, EBP 5.0, HR R/3 4.7 In HR system Main addresses are not maintainted. So we create standard partner and in table T77S0 in field HRALX OADBP we maintain its address (with leading zeroes) and in HRALX OADRE we set flag. When we replicate org

  • Leopard "kind of" detects my LCD TV, but doesn't work ( DVI-to-HDMI )

    I recently bought a new LG 32" (32LG5000) and was hoping to hook it up to my laptop. When I connect the DVI-to-HDMI cable (DVI on macbook, HDMI on TV port), Leopard's screen turns "blue" for a sec, like if it was detecting/adjusting/whatever the exte

  • HT204150 Contacts only show phone numbers, no names?!

    My wife's iPhone 4S has suddenly lost its info. All contacts are just phone numbers, no photo stream etc., as if it's lost icloud back up , even it's never been backed up. I've rebooted it (off/on) and no difference. I've had this happened to my iPho