Need help with class I'm trying to write for school

Hi,I'm taking my first Java class, and we're learning how to write classes. I've got MOST of the program and class to work, but I'm still having trouble with it.
In the class I wrote, if I delete the "getWindTempF(strAlt)" the program runs fine, other than not doing the conversion to Fahrenheit. So, I'm guessing that there's a problem with my getWindTempF method. However, it is almost exactly a duplicate of my getWindTempC method, so I can't figure out what I'm doing wrong. The errors I get when I keep the "getWindTempF(strAlt)" in the prtWindInfo method are:
java.lang.NumberFormatException: For input string: " "
     at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
     at java.lang.Integer.parseInt(Integer.java:426)
     at java.lang.Integer.parseInt(Integer.java:476)
     at NWSFD.getWindTempF(NWSFD.java:94)
     at NWSFD.prtWindInfo(NWSFD.java:162)
     at a19004.main(a19004.java:30)
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
Again, the program and class work perfectly except for the getWindTempF. Any ideas would be greatly appreciated, and sorry for such a long post
Here is the main program:
import cs1.Keyboard;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.util.Date;
public class a19004
     // Instantiates the windsAloft object by using the NWSFD class
     public static void main (String[] args)
          final String FAA_FD="SAN 1405 2908+26 2911+19 2809+11 1307-09 0308-20 " +
          "032433 012543 352853";
          NWSFD windsAloft = new NWSFD(FAA_FD);     //Instantiate the NWSFD object
          System.out.println ("Winds Aloft");
          System.out.println ("as of " + windsAloft.getDate());
          System.out.println ("");
          System.out.println ("STA Alt Dir Speed TempC TempF");
          System.out.println ("");
          System.out.println (windsAloft.prtWindInfo("03"));
          System.out.println (windsAloft.prtWindInfo("06"));
          System.out.println (windsAloft.prtWindInfo("09"));
          System.out.println (windsAloft.prtWindInfo("12"));
          System.out.println (windsAloft.prtWindInfo("18"));
          System.out.println (windsAloft.prtWindInfo("24"));
          System.out.println (windsAloft.prtWindInfo("30"));
          System.out.println (windsAloft.prtWindInfo("34"));
          System.out.println (windsAloft.prtWindInfo("39"));
And for the sake of brevity, just a part of the NWSFD class:
import java.text.*;
import java.util.Date;
public class NWSFD
     // Set up variables
     private String strWea;
     // 3.a. Constructor
     public NWSFD (String strVar)
          strWea=strVar + " ";
     // 3.d.
     public String getWindTempC (String strAlt)
          String strVar;
          strVar = strWea.substring(getPos(strAlt) + 4, getPos(strAlt) + 7);
          if (strAlt.equals("03"))
               strVar = strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 5);
          if (strAlt.equals("30"))
               strVar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strAlt.equals("34"))
               strVar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strAlt.equals("39"))
               strVar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strVar.equals(" "))
               strVar = "N/A";
          return strVar;
     // 3.ed.
     public String getWindTempF (String strAlt)
          String strVar;
          String strFar;
          int intRet;
          int intFar;
          strFar = strWea.substring(getPos(strAlt) + 5, getPos(strAlt) + 7);
          if (strAlt.equals("03"))
               strFar = strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 5);
          if (strAlt.equals("30"))
               strFar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strAlt.equals("34"))
               strFar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strAlt.equals("39"))
               strFar = "-" + strWea.substring(getPos(strAlt) +4, getPos(strAlt) + 6);
          if (strFar.equals(" "))
               strVar = "N/A";
          intRet = Integer.parseInt(strFar);
          intFar = intRet * (9/5) + 32;
          strVar = Integer.toString(intRet++);
          return strVar;
     // 3.h.
     public String prtWindInfo (String strAlt)
          String strRet;
          strRet = strWea.substring(0,3) + " " + strAlt + "000" + " " +
               getWindDir(strAlt) + " " + getWindSpeed(strAlt) + " " +
               getWindTempC(strAlt) + "C " + getWindTempF(strAlt) + "F";
          return strRet;
}

Thank you for the reply, soni29. here is the code:
public int getPos(String strAlt)
          int intAlt;
          int intRet;
          intAlt = Integer.parseInt(strAlt);
          switch (intAlt)
               case 3:
                    intRet = 4;
                    break;
               case 6:
                    intRet = 9;
                    break;
               case 9:
                    intRet = 17;
                    break;
               case 12:
                    intRet = 25;
                    break;
               case 18:
                    intRet = 33;
                    break;
               case 24:
                    intRet = 41;
                    break;
               case 30:
                    intRet = 49;
                    break;
               case 34:
                    intRet = 56;
                    break;
               default:
                    intRet = 63;
          } //     Close switch
          return intRet;
However, I really don't think there's a problem with any of the coding there. The only times I have problems with the program is when I'm trying to display the data from getWindTempF. If I omit that method, the program works perfectly. Basically, what the program is supposed to do, is hand a string (FAA_FD) to the NWSFD class, which then extracts data from it. Thank you again for the help...any other advice?

Similar Messages

  • Need help with classes

    I''ve just started out with Java and I need help with my latest program.
    The program looks someting like this:
    public class MultiServer {
       public static void main(Straing[] args) {
          ServerGUI GUI = new ServerGUI();
    public class ServerGUI extends JFrame implements ActionListener {
       private TextArea textArea;
       public ServerGUI() {
          //setting up the JFrame and stuff like that
       public void actionPerformed(ActionEvent event) {
          if(button == addButton) {
             addGUI add = new addGUI();
    public class addGUI extends JFrame implements ActionListener {
        private TextField t1 = new TextField(25);
        public addGUI() {
          //setting up the JFrame and stuff like that
       public void actionPerformed(ActionEvent event) {
          if(button == printButton) {
             textArea.append("THIS DOES NOT WORK!");
    }   The problem is as follows: I want to be able to write text in the textArea in class ServerGUI from the class addGUI, but I can't. I hope you understand what I mean.
    How is this fixed? Please help me!

    public void actionPerformed(ActionEvent event) {
          if(button == addButton) {
             addGUI add = new addGUI(textArea);
    public class addGUI extends JFrame implements ActionListener {
        private TextArea textArea;
        public addGUI(TextArea textArea) {
            this.textArea = textArea;
        }/Kaj

  • Need help with saving data and keeping table history for one BP

    Hi all
    I need help with this one ,
    Scenario:
    When adding a new vendor on the system the vendor is suppose to have a tax clearance certificate and it has an expiry date, so after the certificate has expired a new one is submitted by the vendor.
    So i need to know how to have SBO fullfil this requirement ?
    Hope it's clear .
    Thanks
    Bongani

    Hi
    I don't have a problem with the query that I know I've got to write , the problem is saving the tax clearance certificate and along side it , its the expiry date.
    I'm using South African localization.
    Thanks

  • Need help with class design

    I want to design and use one or more classes for a particular project I am working on.
    I need some advice hopefully from someone who has experience in this area. Basically,
    for this particular problem I have two database tables. I want the first class to
    represent the first database table and the second class to represent the second
    database table. An object of the first class will be created first, and then if certain
    criteria are met then an object of the second class will be created.
    Question:
    Should I use classical inheritance and let the first class inherit from the second class?
    Or should I use the containment delegation model and embed an object of the second
    class in the first class?
    ----Tables------
    For example, my first table ET_UserData looks something like this:
    ET_UserData
    (PK)UserName
    Password
    FirstName
    LastName
    My second table ET_DetailedUserData looks like this
    ET_DetailedUserData
    (FK)UserName
    WorkAddress
    WorkPhoneNumber
    CityWhereEmployed
    SocialSecurityNumber
    City
    State
    StreetAdress
    PrimaryTelephoneNumber
    AlternatePhoneNumber
    HasRegistered
    RegistrationDate
    RegistrationTime
    CreditCardNumber
    NameOfPrimaryContact
    DateOfBirth
    Weight
    EyeColor
    Height
    Member
    Here is are some pseudo classes for the two classes.
    Class UserData
    string UserName
    string FirstName
    string LastName
    Class DetailedUserData /* For a classical approach, sub class off of class UserData */
    /* UserData ThisUser --> Containment delegation model */
    string (FK)UserName
    string WorkAddress
    string WorkPhoneNumber
    string CityWhereEmployed
    string SocialSecurityNumber
    string City
    string State
    string StreetAdress
    Int PrimaryTelephoneNumber
    Int AlternatePhoneNumber
    Bool HasRegistered
    Int RegistrationDate
    Int RegistrationTime
    Int CreditCardNumber
    String NameOfPrimaryContact
    Int DateOfBirth
    Int Weight
    Int EyeColor
    Int Height
    bool Member
    }

    Thank you for your help. If you can continue to help me I would appreciate it.
    I and another developer did the database design. Pretty solid design. Plus we have all of the requirements
    which are very good too.
    Originally I wanted just one table to contain all of the data associated with a user. Instead of ET_UserData and ET_Detailed user data I wanted just one table. But I decided to break this table up into the two tables for the following reason.
    1.) This is a web application where each user logs into a web form. At a minimum, in order to use the website the session associated with each user needs the UserName, Password, First and last name.
    This is the data in the first table.
    If they choose to do more specialized functions on this website, then they will need all of the information (Attributes) that are located in the second table. In general 40% of the time all users will need information located in the second table.
    My reasoning for breaking the table into two seperate tables is that I wanted to minimize the amount of data involved in a result set, created from the sql query. The math tells me that 60% of the time most of the data in the result set will not be used.
    2.) If I create one class to represent all of the data/attributes in both tables, then my reasoning is that their will be alot of overhead in the single class because 60% of the time, a majority of the attributes are not needed and used.
    I would deeply appreciate your help with this. You seem to have great insight and advice. Please help me as I increase the duke dollars Sir.

  • Where to start? Need help with classes

    My question involves those classes he wants us to make. I don't really get the concept of classes, so could someone tell me what they think he wants us to do? And try to explain it to me in terms I might be able to understand. Does that mean for us to use subclasses or use separate files for each class? Or could I do either? I'm so confused :(
    Assignment: Write a program that consists of the classes listed below.
    Player Class: The Player Class consists of at least two elements -- the player name and a list of scores for
    games. The score attribute is not used in Program #3 but will be needed in Program #4. Include in the
    class appropriate accessor and mutator methods for each element in the class. You may have other
    attributes if needed.
    Team Class: The Team class consists of at least 6 elements -- the name of the team and five players from
    the Player class. Include in the class appropriate accessor and mutator methods for each element in the
    class. You may have other attributes if needed.
    Course Syllabus Page 3
    Input3 class: The Input3 class is provided for you. The Input3 class supplies data for your program. The
    Input3 class has a public method called getNextString, which returns a string with the input for your
    program, one after the other. You must use this class to get the data for your program. See Input3.java on
    WebCT to understand the class construction.
    Your program should display the roster of each team in alphabetical order by last name.
    This is the Input3 that he gave us to work with if anyone needs to see it:
    public class Input3
         private String[] input = new String[40];
         private static int StringNum = -1;
         public static final int NUMBER_OF_TEAMS = 3;
         public static final int NUMBER_OF_PLAYERS = 5;
         public Input3()
              //The first six inputs will be for the first team
              input[0] = "LAKERS";
              input[1] = "Kobe Bryant";
              input[2] = "Derek Fisher";
              input[3] = "Shaquille O'Neal";     
              input[4] = "Karl Malone";
              input[5] = "Brian Cook";
              //The next six inputs will be for the second team
              input[6] = "MAVERICKS";
              input[7] = "Antoine Walker";
              input[8] = "Dirk Nowitzki";
              input[9] = "Tony Delk";
              input[10] = "Shawn Bradley";
              input[11] = "Travis Best";
              //The next six inputs will be for the third team
              input[12] = "KNICKS";
              input[13] = "Mike Sweetney";
              input[14] = "Allan Houston";
              input[15] = "Howard Eisley";
              input[16] = "Kurt Thomas";
              input[17] = "Shanon Anderson";
         //This method returns the strings one after the other.
         public String getNextString()
              StringNum++;
              return input[StringNum];
    }<br>
    <br>
    <br>
    Thanks

    You could put the classes in separate files, but it's not necessary. They wouldn't be called 'subclasses' here, as that word is specific to inheritance, which you don't need here. Here's an example of using multiple classes:
    public class MainClass {
        public static void main(String [] args) {
         OtherClass1 oc1 = new OtherClass1(3);
         OtherClass2 oc2 = new OtherClass2("hello");
         System.out.println("" + oc1.getInt());
         System.out.println(oc2.getString());
    class OtherClass1 {
        int someInt;
        public OtherClass1(int i) {
            someInt = i;
        public getInt() {
         return someInt;
    class OtherClass2 {
        String someString;
        public OtherClass2(String s) {
            someString = s;
        public getString() {
            return someString;
    }and like BDLH said above, it's preferred to put them in separate files. Just make sure the file name is EXACTLY the same as the class name, followed by .java

  • Need help with class object? Please somoen

    hey guys,
    It's been few days since i'm working on making a small bingogame program but i'm getting stuck frequantly.
    I've different classes, in the main class i'm asking the user to input number of players who would like to play then i'm asking the player's name and how many bingoCards each player wants.
    I'm stroing all that info in a BingoPlayer class's array object. But for some reason when i get out from the loop and try to retrive the info from that array it only gives me the last input entry (player's name & number of cards) at any index of the array.
    Can please someone tell me how i can store the given information for each player in that object array on different indices of the array?
    I'm providing the code where i've the problems:
    public class BingoGame
        public static BingoPlayer players[] = new BingoPlayer[5];
        public static void main() throws IOException {
            int numPlayers = 0;
            int numCards [] = new int [5];
            String name [] = new String[4];
            BufferedReader input = new BufferedReader (new InputStreamReader(System.in)); //allows input
    // ask for the number players who wants to play
            System.out.print("Please enter the number of players in this game (2-5): ");
            numPlayers = Integer.parseInt(input.readLine());
    // make sure the entered value is within range
            while (numPlayers < 2 || numPlayers > 5) {
                System.out.println("Invalid number of players ");
                System.out.print("Please enter the number of players in this game (2-5): ");
                numPlayers = Integer.parseInt(input.readLine());
            System.out.println();
    //ask for the names and numebr of cards for entered number of players
    // and make sure the number of cards are within the range,
    //and assign the players that many cards using the BingoPlayer object 
            for (int i = 1; i <= numPlayers; i++) {
                System.out.print("Please enter name of player " + i + " : ");
                name[i] = input.readLine();
                System.out.println();
                System.out.print("Please enter the number of cards (1-5) for player " + i + " : ");
                numCards[i] = Integer.parseInt(input.readLine());
                while (numCards[i] < 1 || numCards[i] > 5) {
                    System.out.println("Invalid number of cards for the player " + i);
                    System.out.print("Please enter the number of cards (1-5) for player " + i + " : ");
                    numCards[i] = Integer.parseInt(input.readLine());
                System.out.println();
                players[i] = new BingoPlayer(name, numCards[i]);
    * here it only prints out the information for the last player, instead it should return the information for both of the player
    for (int k = 1; k <= numPlayers; k ++) {
    System.out.println(players[k]);
    //players[k].genCards();
    for example if i enter 2 players:
    Player1: name: Jami, number of cards 1
    Player2: name: Joey, number of cards 2
    in the last loop it just prints out :"Joey, 2" 2 times instead of printing out: "Jami, 1" & "Joey, 2"
    Please someone help! i really need to complete this within 2 days. Thanks in advance

    Without seeing BingoPlayer's implementation, all it
    would be would be a guess.
    My guess: The name and numCards members of that class
    are declared as static, so all instances share the
    same values.Thanks it worked, declaring them static was the main probelm..thank you very much

  • Need help with class inheritance

    I've got a class called jemAccount and i need to create a savings account class and a checking account class that inherit from it.
    Here is the jemAccount:
    public class jemAccount
    protected String myName;
    protected double myBalance;
    protected double[] withdrawls = new double [50];
    protected double[] deposits = new double [50];
    protected int withIndex = 0;
    protected int depIndex = 0;
    public jemAccount ()
    myBalance = 0;
    public jemAccount (String newName)
    myName = newName;
    myBalance = 0;
    public jemAccount (String newName, double newBal)
    myName = newName;
    myBalance = newBal;
    public void setName(String newName)
    myName = newName;
    public double balance()
    return myBalance;
    public void withdrawl (double amount)
    if (amount < 0)
    myBalance += amount;
    else
    myBalance -= amount;
    if (withIndex < 50)
    withdrawls[withIndex] = amount;
    withIndex++;
    public void deposit (double amount)
    if (amount > 0)
    myBalance += amount;
    if (depIndex < 50)
    deposits[depIndex] = amount;
    depIndex++;
    public void printAccount()
    System.out.println("Owner of account: " + myName);
    System.out.println("Balance of account: " + myBalance);
    System.out.println("Deposits: ");
    for (int i = 0; i < depIndex; i++)
    System.out.println(" " + deposits);
    System.out.println("");
    System.out.println("Withdrawls: ");
    for (int i = 0; i < withIndex; i++)
    System.out.println(" " + withdrawls[i]);
    System.out.println("");
    System.out.println("");
    } // end of class jemAccount
    Here are my requirements for the savings account class:
    � Call the class "abcSaveAccount".
    � Have this class inherit from "jemAccount"
    � Add a float for keeping track of the yearly interest rate of the checking account. Call this class variable "interest" Make it protected.
    � Add a public constructor for the savings account class. It should have one parameter, a float that initializes the new savings account class variable. This constructor should also call the parent class constructor with no arguments.
    � Add a public method for calculating interest. Call it "calcInterest". Have it take one parameter, an integer which represents the number of months to calculate the interest for. This method should return a float, the result of the interest calculation. For example, if 30 months are entered as a parameter of 30, then 2 and one/half years of interest on the balance are calculated and returned.
    Here are the requirements for the checking account class:
    � Call the class "abcCheckAccount"
    � Have this class inherit from "jemAccount"
    � Add an array for keeping track of the checks you write. For now, just make this an array of 100 doubles, very similar to withdrawals
    � Add a public constructor for the checking account class. It should have zero parameters. This constructor should also call the parent class constructor with no arguments.
    � Add a new public method to your checking account class. Call it "writeCheck". This should take one double parameter. If the value of the parameter is positive, subtract the parameter from the balance, and copy the value into the "checks" array. (Keep the checks and withdrawals separate.) Else do nothing.
    � Override the "printAccount" method. Have the checking account "printAccount" run its parent "class printAccount", then print out a list of the checks, after the list of the withdrawals.
    Here's what i have so far for the savings account class:
    public class abcSaveAccount extends jemAccount
    protected float interest;
    public void abcSaveAccount (float newSavings)
    super ();
    public calcInterest (int numberMonths)
    return interest;
    And here's what i have so far for the checking account class:
    public class abcCheckAccount extends jemAccount
    double[] checks = new doulbe[100];
    public abcCheckAccount ()
    super ();
    public writeCheck (double value)
    if (value >= 0)
    balance = balance - value;

    Few changes,
    public class abcCheckAccount extends jemAccount {
         private double[] checks = new double[100];
         private int checkIndex;
         public abcCheckAccount() {
              super ();
              checkIndex=0;
         public void writeCheck (double value) {
              if ( value >= 0) {
                   withdrawl(value);
                   checks[checkIndex++]=value;
         public void printAccount() {
              super.printAccount();
              System.out.println("Checks:");
              for (int i = 0; i < checkIndex; i++) System.out.println("     "+checks[ i ]);
              System.out.println("");
              System.out.println("");
    } // end of abcCheckAccount classand
    public class abcprog {
       public static void main (String args[]) {
              abcCheckAccount check = new abcCheckAccount();
              check.setName("Sudha");
              check.deposit(1000.0);
              check.deposit(200.0);
              check.withdrawl(112.0);
              check.writeCheck(300.0);
              check.printAccount();
              abcSaveAccount save = new abcSaveAccount(6);
              save.setName("Mike");
              save.deposit(1000.0);
              save.withdrawl(112.0);
              save.printAccount();
              System.out.println("Calculated Interest : "+save.calcInterest(120));
    }U can use this program to test your classes.
    Sudha

  • Need help with class info and cannot find symbol error.

    I having problems with a cannot find symbol error. I cant seem to figure it out.
    I have about 12 of them in a program I am trying to do. I was wondering if anyone could help me out?
    Here is some code I am working on:
    // This will test the invoice class application.
    // This program involves a hardware store's invoice.
    //import java.util.*;
    public class InvoiceTest
         public static void main( String args[] )
         Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
    // display invoice1
         System.out.println("Original invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    // change invoice1's data
         invoice1.setPartNumber( "001234" );
         invoice1.setPartDescription( "Yellow Hammer" );
         invoice1.setQuantity( 3 );
         invoice1.setPricePerItem( 19.49 );
    // display invoice1 with new data
         System.out.println("Updated invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    and that uses this class file:
    public class Invoice
    private String partNumber;
    private String partDescription;
    private int quantityPurchased;
    private double pricePerItem;
         public Invoice( String ID, String desc, int purchased, double price )
              partNumber = ID;
         partDescription = desc;
         if ( purchased >= 0 )
         quantityPurchased = purchased;
         if ( price > 0 )
         pricePerItem = price;
    public double getInvoiceAmount()
         return quantityPurchased * pricePerItem;
    public void setPartNumber( String newNumber )
         partNumber = newNumber;
         System.out.println(partDescription+" has changed to part "+newNumber);
    public String getPartNumber()
         return partNumber;
    public void setDescription( String newDescription )
         System.out.printf("%s now refers to %s, not %s.\n",
    partNumber, newDescription, partDescription);
         partDescription = newDescription;
    public String getDescription()
         return partDescription;
    public void setPricePerItem( double newPrice )
         if ( newPrice > 0 )
    pricePerItem = newPrice;
    public double getPricePerItem()
    return pricePerItem;
    Any tips for helping me out?

    System.out.println("Part number:
    "+invoice1.getPartNumber;
    The + sign will concatenate invoice1.getPartNumber()
    after "Part number: " forming only one String.I added the plus sign and it gives me more errors:
    C:\>javac InvoiceTest.java
    InvoiceTest.java:16: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ",   + invoice1.getPartNumber() );
                                                  ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:19: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:20: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    InvoiceTest.java:24: cannot find symbol
    symbol  : method setPartDescription(java.lang.String)
    location: class Invoice
            invoice1.setPartDescription( "Yellow Hammer" );
                    ^
    InvoiceTest.java:25: cannot find symbol
    symbol  : method setQuantity(int)
    location: class Invoice
            invoice1.setQuantity( 3 );
                    ^
    InvoiceTest.java:30: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ", + invoice1.getPartNumber() );
                                                ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:33: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:34: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    16 errors

  • Need help with classes in Applets and drawing buildings.

    I'm trying to create an Applet that draws a starfield (I got that right) and then searches for any parameters in the Applet tag. The Applet then draws as many buldings as there are parameters in the Applet tag, and uses the number in the parameter as the height. I have it working OK, but it won't draw the buildings. Here is me code:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    int n = 1;
    String param = null;
    while((param = getParameter("param" + n)) != null) {
    n++;
    int startX = 0;
    int startY = getHeight();
    int height = 0;
    int width = getWidth() / (n + 2);
    Building structure = new Building();
    structure.drawBuilding(pen, height, width, startX, startY, n);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen, int height, int width, int startX, int startY, int n) {
    Random generator = new Random();
    int n2 = 1;
    int runs = 1;
    String input = "";
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startX, startY, height, width);
    pen.fill(building);
    startY = startY + width;
    n2++;
    runs++;
    Can anyone help me?

    That didn't work, so I looked at the code again and found some errors. I decided to rewrite it, here is the updated code...
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    Building structure = new Building();
    structure.drawBuilding(pen);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen) {
    Random generator = new Random();
    int n = 1;
    int n2 = 1;
    int runs = 1;
    String input = "";
    String param = "";
    while ((param = getParameter("building" + n)) != null) {
    n++;
    int height = getHeight();
    int width = getWidth();
    int startX = 0;
    int startY = height;
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    height = getHeight();
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startY, startX, height, width);
    pen.fill(building);
    startX = startX + width;
    n2++;
    runs++;
    I can get it to draw one large black building, but that's it.

  • Need help with Class-Path and NCDFE

    This isn't a new issue, but I'm getting a variation of a problem a lot of people seem to have had. I was hoping someone out there can help me out.
    I have a jar file (imex.jar) sitting in c:\temp\imextest. I also have another jar file, commons-cli-1.0.jar sitting in c:\temp\imextest\lib.
    I want to run the jar in a standalone manner. My manifest has the following entries.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.5.3
    Created-By: 1.4.2_01-b06 (Sun Microsystems Inc.)
    Main-Class: com.foo.imex.DirectoryImportExport
    Class-Path: lib/commons-cli-1.0.jar
    I am invoking it using the following command (from c:\temp\imextest)
    java -jar imex.jar -i -f c:\matt\RRBus\jiyun.xml -v
    I get this result:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
    It seems to me that I have my directory structure and manifest set up correctly, but maybe I don't (as it's not working). Does anyone see what I'm doing wrong here? (the "missing" class is in commons-cli-1.0.jar).
    Thanks,
    Matt

    perhaps jar file needed for parsing is not there in classpath...set it...in the classpath..

  • Need help with "class file contains wrong class"

    I have a dbUtil package as
    package dbUtil;
    public class dbConfig {
    public String getHost(String db) {
    This file called dbConfig.java has been compiled with -d option and rthe class files resides in dir <install_dir>/webapps/test/WEB-INF/classes/eb/dbUtil/
    I have a jsp file in <install_dir>/webapps/test/test.jsp which imports the dbUtil package
    <%@ page import="eb.dbUtil.dbConfig" %>
    and I am getting this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    /opt/hpws/tomcat/work/Standalone/localhost/test/test_jsp.java:12: cannot access eb.dbUtil.dbConfig
    bad class file: /opt/hpws/tomcat/webapps/test/WEB-INF/classes/eb/dbUtil/dbConfig.class
    class file contains wrong class: dbUtil.dbConfig
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import eb.dbUtil.dbConfig;
    ^
    1 error
    Can anyone tell me what am I doing wrong? I am using tomcat 4.1
    Thanks!
    L.

    Given your java file, the fully qualified name of the class is dbUtil.dbConfig.
    What you are importing is eb.dbUtil.dbConfig
    These things are not the same.
    The root of the classpath for the webapp is the classes directory.
    So either
    1 - specify dbConfig.java to be in package eb.dbUtil
    2 - move the class file into web-inf/classes/dbUtil/dbConfig.class, and import dbUtil.dbConfig.
    Also, by convention, classnames should start with a capital letter ie dbUtil.DbConfig.
    Cheers,
    evnafets

  • Need help with my Toshiba remote control and receiver for Qosmio G30 161

    Hello to all
    I have a Toshiba Qosmio G30-161 and with it I have a Toshiba remote control and a Toshiba remote control receiver, this is the first time I have used it (tried to that is), my problem is the remote is not working on the computer when I press any program buttons the computer does nothing.
    I have installed four brand new AA batteries and the remote works fine its sending signals to the receiver, the receiver the detecting the remote as a red light appears every time you press a button and as for the computer I have checked the drivers and the USB is picking up the receiver as a E-home remote receiver which I have checked with Toshiba and that is correct, so all in all the remote is working, the receiver is picking up signals and the pc has detected the receiver but nothing works, I have installed remote control manager but this still has done anything. I have spoken to Toshiba help and support and the end result is they are not sure what the problem is. Can anyone help I require the remote for slideshows for customers as I??m a photographer.
    Also to confirm I am running Windows XP MCE addition.
    Anthony Worlock

    Hi there,
    this remote contol works, if you use it without any special drivers and special software, only in the Media Center.
    But if you install such stuff like [WinLirc|winlirc.sourceforge.net] then you should be able to get some functions for your presentation.
    Please try this tool and check if it works.
    By the way: If I were you I would first read the Manual and FAQ of WinLirc before starting because its a little bit tricky to handle the program. :) (Too many settings :D)
    Greets

  • Desperately need help with a networked printer and SMB sharing for windows

    Complete xServ newbie here. I'm a windows/novell admin, with limited experience in Unix and Linux.
    Against my advice, a client of mine that owns a small office of 20 people bought an XServG5 to act as a server for 20 mixed Windows PCs. File sharing services are working fine. I've created the users, set up groups and rights - that's all good.
    I cannot get an SMB shared printer to work from the windows machines. They run through the network printer install just fine, it shows up online, etc. However, when print jobs are submitted they DO show up in the printer queue on the server, sit there for a while, and then get moved to the completed box.
    They never print. There's not any indication that the job is even submitted to the printer. I can print to the printer just fine from the server itself, but the windows clients don't work, but they don't return an error message.
    Print services are running on the server, I've configured the printer name to be less than 12 characters for the share, and indeed it does pop right up during the "add network printer" routine.
    Ideas? I'm not even sure what questions I'm supposed to be asking, such is my ignorance of the OS. I do know that I followed the documentation to a T, and according to Apple this should work.
    Thanks in advance for the help. I'm extremely frustrated.

    We have the same problem. Our printer worked for about 2 years but failed similar to yours after a system update.
    Can you go into the Windows service, Logs, Printer Service. Copy and paste the log here. What I am looking for is a line like lpr: CANNOTCONNECTCLIENT or something similar to this.
    What I expect is that you have a problem where the cups defined printer is not usable. We can't get our problem fixed either - but am just curious if you have the same thing. We reloaded our server, applied all of the update and still cannot get it to work.
    Again, I think it stems from the update.

  • Need help with 3 way call to a 1 for English or 2 ...

    I can do a 3 way with Skype, but the recording I need to have my client listen to is telling me to push 1 for English or 2 for Spanish. Can you tell me how to do this?

    Do you want to set up auto attandant service based on Skype? if so, you can try PrettyMay Call Center for Skype which can be used easily.
    check out more at: http://www.prettymay.net
    Want to record Skype calls, check out at:
    hereandhere

  • Need help with a lookup on a IDoc element for BPM

    Hello All,
       I was wondering if there is someway that I can lookup on the <b>E1EDKA1</b>segment and get the value of <b>NAME1</b> where the value of <b>PARVW = LF</b> in BPM. I appreciate any help.
    Thanks
    Message was edited by:
            Balu Yalamanchili

    HI,
    To get value of element/container variable , you cna use first context object, based on context object put switch (aslo some block/fork step ) with condition , stating that if that value of context element is matched then put control step to raise alert.
    i think you got this ,if not please let me know to explain clearly.
    Any way please see some links regarding alert..
    /people/krishna.moorthyp/blog/2006/04/08/reconciliation-of-messages-in-bpm
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards
    Chilla..

Maybe you are looking for