Operator + cannot be applied to operands of type 'method group and 'int'

Hello I have a problem that I'm trying to fire a bullet everytime I pressed the spacebar key, but I have this problem that is cropping up.
 if ((e.KeyCode == Keys.Space) && (playerOne.Bullet.Alive == false))
                            playerOne.Bullet.Alive = true;
                            playerOne.Bullet.getX = playerOne.getXposition + 15;
                            playerOne.Bullet.getY = playerOne.getYposition + 10;
It says in the error list: "Opeartor '+' cannot be applied to operands of type 'method group' and 'int'", I have no clue. I'm also new to programming.

I want to get the bullet to shoot where the player is, here is the code:
class Player
        // attributes here  -   Int other words data types and variables:
        int health = 3;
        float xPosition;
        float yPosition;
        Bitmap playerGraphics;
        int score = 0;
        bool leftPressed;
        bool rightPressed;
        float Width = 50;
        public Bullet Bullet = new Bullet();
        // functions here:
        public void Init()
            // Get Player_Bat.png from resources, so that we can work with it:
            playerGraphics = new Bitmap(Green_Aliens.Properties.Resources.Player_Bat);
            health = 3;
            score = 0;
            xPosition = 375;
            yPosition = 540;
            leftPressed = false;
            rightPressed = false;
            Bullet Bullet = new Bullet();
        public float getWidth()
            return Width;
        public void toggleLeftPressed()
            if (leftPressed == true)
                leftPressed = false;
            else
                leftPressed = true;
        public void toggleRightPressed()
            if (rightPressed == true)
                rightPressed = false;
            else
                rightPressed = true;
        public bool getLeftPressed()
            return leftPressed;
        public bool getRightpressed()
            return rightPressed;
        public Bitmap getGraphics()
            return playerGraphics;
        public float getXposition()
            return xPosition;
        public float getYposition()
            return yPosition;
        public int getHealth()
            return health;
        public int getScore()
            return score;
        public void moveLeft()
            xPosition -= 10;
        public void moveRight()
            xPosition += 10;
        public void loseLife()
            health--;
        public void adScore(int valueAdd)
            score += valueAdd;
        //Resets the player to the start position:
        public void resetPosition()
            xPosition = 400;
            yPosition = 550;

Similar Messages

  • 'operator + cannot be applied to double'

    public double getTotalPrice() {
            if (orderItems.size() == 0) {
                return 0.0;
            double total = 0.0;
            for (Iterator it = orderItems.iterator(); it.hasNext();) {
                OrderItem oi = (OrderItem) it.next();
                 total += (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()));
            return total;
    }ive got this method here and this part's got an error:
    total += (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()));Error: operator + cannot be applied to double, <any>
    any help is appreciated. thx

    What type does this return?
    (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()))At a glance, I'd guess BigDecimal. You can't use arithmetic operations like + on BigDecimal. You'd have to call its doubleValue method, or whatever there is that returns a double. Of course, since BigDecimal can hold numbers that double can't, that could give you bogus values, so you really need to make total a BigD as well, and call BigD's methods in place of +=, or else stick to numbers that fit in a double and don't use BigD at all.

  • What is the maximum number of Call Types, Skill Groups and Campaigns created in ICM 8.0.1 and 8.0.3

    Hi All,
    What is the maximum number of Call Types, Skill Groups and Campaigns created in ICM 8.0.1 and 8.0.3?
    In which the above requested information will be available??

    Oh I see. So I guess what you are saying is that is
    Director's way of compressing vector numbers. Also, as to what you
    were saying about the number 3000 is sure not the limit for vector
    units, I think I was just jumping the gun considering that I only
    glanced at the script error, and then clicked on the debug button
    to see where the error happened. Then once I looked at the varibles
    in the varible window, I saw these weird numbers with the e3 at the
    end of them, and I just thought that it could not add the vectors
    together with the e3 at the end of each vector unit. However, to
    make a long story short, I detached the script and reattached it
    which did no create the error again, and I learned that Director
    can add vector units together that have an e3 at the end of each
    vector unit. So thanks for clarifying what the e3 means.

  • HELPHomework operator = cannot be applied to boolean, int???????

    Hi im struggling ive been searching on the net but i just cant seem to figure a way to get my code to work properly. Basically a user has to input a percent and the program outputs a grade. 95 or higher = A+,
    90 or higher = A etc etc. this is my code
    import java.util.Scanner;
    public class GetGrades {
    public static void main(String[] args) {
         Scanner keyboard = new Scanner(System.in);
         System.out.println("Please enter your grade: ");
         int gradeOne = keyboard.nextint();
         String myGrade;
         System.out.println("Your letter grade: " + myGrade);
         if(gradeOne >= 95)
         myGrade= "A+";
         else if(95 > gradeOne >= 92)
         myGrade= "A";
         else if(92 > gradeOne >= 87)
         myGrade= "A-";
         else if(87 > gradeOne >= 80)
         myGrade= "B+";
         else if(80 > gradeOne >= 75)
         myGrade= "B";
         else if(75 > gradeOne >= 70)
         myGrade= "B-";
         else if(70 > gradeOne >= 60)
         myGrade= "C";
         else if(60 > gradeOne >= 50)
         myGrade= "D";
         else
         myGrade= "F";
    Can anyone please help :S

    String myGrade;
    System.out.println("Your letter grade: " + myGrade);The first line is declaring the variable, but is not setting a value to it so it is not pointing to anything (has no value not even an empty string). So, when you use the second line the compiler is saying that since the variable has not been initialized (at all) it can't.
    Try something like this:
    String myGrade = ""Nothing yet buddy :)";
    System.out.println("Your letter grade: " + myGrade);or move your printline to after you assign the value to it in the if statement.

  • Content tab in options is not operational, cannot allow certain popup windows for sites like pandora and others; that's the tip of the iceberg...

    When I go into option menu, then click on the content tab, nothing happens; regardless of the duration of the waiting period, as when you click it and wait, you might as well walk away, because it will not load even if you wait an hour; THE OTHER TABS LOAD (THOUGH SLOWER THAN PREVIOUS VERSION) and function as far as I can determine. There is not the Firefox "One button for everything" at the top left like in the tutorial for this 4th gen. update either, and in general it's functioning rather sluggishly; I think I will be uninstalling the new version tomorrow as soon as I can.

    Did you look here?
    *Tools > Options > Content : Fonts & Colors > Colors : [X] "Allow pages to choose their own colors, instead of my selections above"
    Note that these settings affect background images.
    See also:
    *http://kb.mozillazine.org/Website_colors_are_wrong
    You can also change this by toggling the <b>browser.display.use_document_colors</b> pref on the <b>about:config</b> page.
    *http://kb.mozillazine.org/about:config

  • Cannot be applied

    Hello,
    I am trying to call the method print();
    Could someone please tell me what parameters i need to put in to get it to call? Right now its giving me a cannot be applied error.
    The print() method is in the Coin class which is a different class. Thanks
    Coin p = new Coin()//<----pretty sure i need this to call a method in a different class
    Coin.print(not sure what to put here);
    public static void print(int ncount,int dcount,int qcount,LinkedList<String>nickels,LinkedList<String>dimes,
                                 LinkedList<String>quarters,String type)//<---method that needs to be called

    Honestly, because static methods are easier to call.Huh? Apperently you have no idea what static means.
    Sorry Im really new.No need for sorry, just do some research if you don't know what something means/does. You should use the static keyword for methods that "do not directly belong" to a specific instance of a class.
    Example:
    class Coin {
      static Coin createNickle() {
        // return a Coin with a value of a nickle
    }now you can create a Coin object with the static above:Coin nickle = Coin.createNickle();But a print() method suggests that you print the internal state of an instance (nickle is an instance of a Coin)
    class Coin {
      int value;
      static void print() {
        // from here you cannot print 'value', since the print() method is static!
        // In other words: it does not belong to this instance
    }so you should do it like this:class Coin {
      int value;
      void print() {
        // now print the 'value' variable
    }and you can now do:Coin nickle = Coin.createNickle();
    nickle.print();understand?
    Of course, you can create new intance of a Coin by calling it's constructor (if there is one), it was only an example of me to do it with a static (factory) method.

  • String cannot be applied to java.lang.String in NetBeans 6 !?!?

    Guys,
    I have a problem. I am calling some API from jar file. Here is the method prototype in API jar:
    public Operator getAdminOperator(String name, String password, int admin);
    when I call this method in NetBeans 6 like the following:
    admin.getAdminOperator(userName, password, 1);
    where userName and password are both string, I get the following error:
    getAdminOperator(String, String, int) in common.admin.AdminRemote cannot be applied to (java.lang.String, java.lang.String, int)
    WTF?!?! If i try the same code in NetBeans 5 it works, and it works in JavaStudioCreator, but NetBeans 6 does not takes it! And because of this error, I am not able to see the Design view in the JSF! The code compiles just fine and runs if I deploy it in the server though, but i need to see the Design view.
    ANY ideas what is going on?

    Then this "String" class must be some other class and not java.lang.String. Did you write the API in question? Does it have a "String" class in one of its namespaces? Or perhaps you wrote a class named "String" and didn't put it in a package? If that's not the case, then contact the writer and ask them.

  • The operation cannot complete because of an unknown error. [Parm]

    I manage computer labs for a small college and we recently installed Adobe CS3 Design Premium on our Macintosh labs. When a user launches Adobe Illustrator CS3 (13.0.2), they see a widget with the Ai (Adobe Illustrator) icon and the following text "The operation cannot complete because of an unknown error. [Parm]" and an OK button. At the same time, the console log (~/Library/Logs/Adobe Illustrator CS3/AISuitePea.log) is flooded with something called SuitePea throwing errors, such as these below (this is only a small portion of those thrown):
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1397908844 (leRS)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1397908844 (leRS)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:33:17 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:37:18 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:37:18 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:37:19 SuitePea Threw error 1394689636 (dF!S)
    Sep 06 14:37:19 SuitePea Threw error 1394689636 (dF!S)
    Some google searching suggested multiple means of dealing with this, from Disk Utility Permissions Repair to plug-in issues/removal. So far, nothing I have tried has yielded any results. My latest attempt was fully uninstalling CS3 using the utility on the CD, and then manually removing all remaining portions I could find on the hard drive (prefs, remaining folders, etc...), rebooting, and then resintalling, but have found I encounter the same result.
    Does anyone know what this SuitePea is or what to do about this kind of error?
    System Information:
    Clients are running Adobe Illustrator 13.0.2
    Intel-based iMacs running OS X 10.4.10
    User home directories are on a network share, not local
    Any help would be appreciated. Thank you,
    Branden Ohlinger

    When I called Adobe, I was pretty much told that they would not offer any assistance. I offered to purchase the incident support, but they said that wasn't an option with this problem. I had to badger the guy just to get him to say that he believed it was caused by an inability of our network account users to write to the local hard drive. What is below is the results of my attempts to research and solve the problem from that point.
    The way we addressed it was to make a second partition (only 10GB) on the local computers and give full read & write access to it for everyone. Then, we instructed our students to set their Scratch location to that new partition. This does indeed resolve the [PARM] error and some problems trying to save and open large files. It does not address the SUITEPEA errors we are getting in our console log though.
    To change the Scratch location:
    - click Illustrator in the menu bar
    - select Preferences
    - click Plug-ins and Scratch
    - use the drop-down menu to change the Primary scratch disk
    - click OK
    Sadly, the above must be done per each individual user and I have not yet found a way to push the preference using Workgroup Manager since the Illustrator preference file is not a normal .plist and the Scratch portion is a rather lengthy string of characters. Adobe did not make this one easy on us and they're not willing to support it (or weren't in my case).
    I wish the rest of you better luck than I have had on this issue.
    The funny thing is - if Adobe used /Users/Shared for the default scratch location instead of whatever location it currently is, I don't think this would be a problem since all users (in a default Mac OS X install) have full access to /Users/Shared

  • *The operation cannot be carried out with this node type*

    Hi Friends,
    My requirement is :
    PO in IS retail system--(IDOC ORDERS)--Sales Order processing-->Sales order in AFS system
    where AFS is apparel footwear solution used in retail industries.
    Now I have created PO in IS-retail system , and IDOC is successfully generated .
    After this I am checking this IDOC in AFS system thru  tcode BD87 for processing but getting error mesage in next screen when I am executing BD87 after putting the IDOC number.
    The operation cannot be carried out with this node type
    Message no. B1891
    Diagnosis
    Node types such as logical system, inbound and outbound IDocs or filter nodes are used only for the structure and for information. They cannot
    be used for processing and display functions.
    Any pointers .
    Regards
    Ashu

    a

  • Operand data type char is invalid for sum operator

    can someone help me re-writing the following so I wont keep getting thie baopv ementioned error: here is the statement:
    RIGHT('0000000000'+REPLACE(CAST(SUM(PAID_AMT) AS VARCHAR),'.',''),14) AS TOT_NET_PAID
    +
    RIGHT('0000000000'+REPLACE(CAST(SUM(PAID_AMT)
    AS
    VARCHAR),'.',''),14)
    AS TOT_NET_PAID
    It keeps retuning he following error messages:
    Operand data type char is invalid for sum operator

    As Jingyang said, you cannot sum a non numeric field. Cast it to a numeric first (INT maybe?)
    + RIGHT('0000000000'+REPLACE(CAST(SUM(CAST(PAID_AMT AS INT)) AS VARCHAR),'.',''),14) AS TOT_NET_PAID
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Same Org as Business Group and Operating Unit cannot be migrated via isetup

    Hi,
    I have tried to migrate the setup of an organization which is classified as both Business group and Operating unit.
    When it comes to Operating unit API, it errors out with the following Warning message.
    I request the iSetup Team to clarify whether there is any restriction in iSetup that the same org as BG and OU cannot be transferred.
    If yes, then how to migrate the same...
    The above situation happens for the org classified as OU and IO. In this case the INV org API give the warning message.
    Regards,
    Senthil
    Name: HR_OperatingUnit
    Type: BC4J
    Path: oracle.apps.per.isetup.schema.server.OperatingUnitAM
    Time Taken(seconds): 1.0
    Importing rows from xml file, and validating rows ......
    Message not found. Application: AZ, Message Name: AZW_FWK_USER_ROW_EXCEPTION. Tokens: VONAME = Operating Unit; KEY = Name = 'POC Business Group'
    Group Name = 'POC Business Group'
    ; EXCEPTION = The organization 'POC Business Group' is a business group, please use the business group API to handle it
    Transaction rolled back
    Processed API:HR_OperatingUnit
    Generating Deployment Report...
    Generation of Deployment Report process completed.
    Status: WARNING
    ******************************************

    It is a known issue and has been fixed as a part of HRMS 12.0.7. You may apply HRMS 12.0.7 or request for back-port on top specific version.

  • Create(java.io.InputStream) in Scanner cannot be applied to (java.io.File)

    Ahhh!!!
    Ahem, when I try to compile the file below, "PhoneDirectory.java", I get the following compilation error message:
    PhoneDirectory.java:12: create(java.io.InputStream) in Scanner cannot be applied to (java.io.File)
        Scanner fin = Scanner.create(file);After quite a bit of tweaking... I'm right back where I started. I'm a seasoned programmer, as far as concepts are concerned, but rather new to JAVA.
    The error seems to be occuring where a new instance of "Scanner" is supposed to be created. It uses file I/O, and I had only used the Scanner class for the keyboard input in the past.
    Looking at the Scanner class, everything seems to be right to me. I'm probably missing some simple fundamental concept, and I've been pulling my hair out trying to get it... Please help me shed some light on this situation!
    =========
    PhoneDirectory.java
    =========
    import java.io.*;
    // Read a file of names and phone numbers
    // into an array. Sort them into ascending
    // order using bubble sort.
    // Print names and numbers before and after sort.
    public class PhoneDirectory {
      public static void main (String[] args) {
        PhoneEntry[] directory = new PhoneEntry[200];
        File file = new File("c:\\jessica\\phonenum.txt");
        Scanner fin = Scanner.create(file);
        int numberEntries = 0;
        // read array from file
        while (fin.hasNextInt())
          directory[numberEntries++] = new PhoneEntry(fin);
        // print array as read
        for (int i=0; i<numberEntries; i++)
          System.out.println(directory);
    // sort by ordering defined in PhoneEntry,
    // in this case lastName firstName
    bubbleSort(directory, numberEntries);
    // print sorted array
    System.out.println(
    "============================================");
    for (int i=0; i<numberEntries; i++)
    System.out.println(directory[i]);
    static void bubbleSort(PhoneEntry[] a, int size) {
    // bubbleSortr: simple to write, but very inefficient.
    PhoneEntry x;
    for (int i=1; i<size; i++)
    for (int j=0; j<size-i; j++)
    if (a[j].compareToIgnoreCase(a[j+1]) > 0) {
    // swap
    x = a[j]; a[j] = a[j+1]; a[j+1] = x;
    =========
    PhoneEntry.java
    =========
    class PhoneEntry {
    // number, name entry for a line in a Phone Directory
      protected int area;
      protected int prefix;
      protected int number;
      protected String firstName;
      protected String lastName;
      public String toString() {
      // format name and phone number to printable string
        String x = lastName + ", " + firstName;
        x = x +
        " . . . . . . . . . . . . . . .".substring(x.length())
        + "(" + area + ") " + prefix + "-" + number;
        return x;
      public int compareToIgnoreCase(PhoneEntry v) {
      // alphabetically compare names in this to names in v
      // return negative for this < v, 0 for ==,
      //        positive for this > v
        int m = lastName.compareToIgnoreCase(v.lastName);
        if (m == 0) m = firstName.compareToIgnoreCase(v.firstName);
        return m;
      public PhoneEntry(Scanner fin) {
      // input a PhoneDirectory entry. Must be space delimited
      // area prefix suffix lastname firstname
        // number
        area = fin.nextInt();
        prefix = fin.nextInt();
        number = fin.nextInt();
        // read rest of line
        String name = fin.nextLine();
        // split name into lastName firstName
        int p = name.indexOf(' ');
        if (p > 0) {
            lastName = name.substring(0,p);
            firstName = name.substring(p+1);
        else {
            lastName = name;
            firstName = "";
    }=========
    Scanner.java
    =========
        This class does input from the keyboard.  To use it you
        create a Scanner using
        Scanner stdin = Scanner.create(System.in);
         then you can read doubles, ints, or strings as follows:
        double d; int i; string s;
        d = stdin.nextDouble();
        i = stdin.nextInt();
        s = stdin.nextLine();
        An unexpected input character will cause an exception.
        You cannot type a letter when it's expecting a double,
        nor can you type a decimal point when it's expecting an int.
    import java.io.*;
    public class Scanner {
    // Simplifies input by returning
    // the next value read from the
    // keyboard with each call.
      private String s;
      private int start=0, end = 0, next;
      private BufferedReader stdin;
      Scanner(InputStream stream) {
        start = end = 0;
        // set up for keyboard input
        stdin = new BufferedReader(
        new InputStreamReader(stream));
      public static Scanner create(InputStream stream) {
        return new Scanner(stream);
      double nextDouble() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         next = s.indexOf(' ',start);
         double d = Double.parseDouble(s.substring(start,next));
         start = next+1;
         return d;
      public int nextInt() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         next = s.indexOf(' ',start);
         int d = Integer.parseInt(s.substring(start,next));
         start = next+1;
         return d;
      public String nextLine() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         String t = s.substring(start,s.length()-1);
         start = end = 0;
         return t;
    }=========
    phonenum.txt
    =========
    336 746 6915 Rorie Tim
    336 746 6985 Johnson Gary
    336 781 2668 Hoyt James
    606 393 5355 Krass Mike
    606 393 5525 Rust James
    606 746 3635 Smithson Norman
    606 746 3985 Kennedy Amy
    606 746 4235 Behrends Leonard
    606 746 4395 Rueter Clarence
    606 746 4525 Rorie Lonnie

    I don't see a Scanner.create() method in the Scanner class but I do see a constructor with the signature you want. Change
    Scanner fin = Scanner.create(file);
    to
    Scanner fin = new Scanner(file);

  • Method cannot be applied error

    I am having trouble compiling my application because it says a sorting method I want to use cannot be applied to the array I want to sort.
    I have a class that was supplied by my instructor that contains a constuctor for an object called "automobile". This constructor has 4 args which are (string, string, double, double). The strings are for make and model of vehicle and the doubles are for gas tank size and range on a full tank. The constructor takes the double values and calculates the miles per gallon. In my application I am making an array of 15 vehicles called "automobile". When I print to an outpuBox the list of vehicles, everthing looks fine. The problem is I need to sort the array by the miles per gallon. Now I have made a seperate class the contains my "cocktail shaker sort", but when it seems that the array of vehicles I created cannot be used in the args of the sort method. Any help would be greatly appeciated. This thing was due a week ago and I've been pulling my hair for 3weeks.
    The error message is:
    Autos.java:64: cockTailSort(int[]) in CockTail cannot be applied to (Automobile[])
    CockTail.cockTailSort(automobile);
    1 error
    Below is my application and following that will be the cocktailshaker class.
    import javabook.*;
    import java.text.DecimalFormat;
    class Autos
    public static void main (String[] args){
    MainWindow mainWindow;
    InputBox inputBox;
    OutputBox outputBox;
    MessageBox messageBox;
    ResponseBox responseBox;
    String modelName, modelType;
    double gasTankCapacity, rangeOnFullTank;
    int count;
    mainWindow = new MainWindow ("Automobile input");
    inputBox = new InputBox (mainWindow);
    outputBox = new OutputBox (mainWindow);
    responseBox = new ResponseBox (mainWindow );
    messageBox = new MessageBox (mainWindow);
    messageBox.setVisible (false );
    mainWindow.setVisible ( true ) ;
    outputBox.setVisible ( true ) ;
    Automobile[] automobile = new Automobile [3];
    int i=0;
    count =1;
    for (i = 0 ; i < automobile.length ; i ++){
    modelName = inputBox.getString ("Enter Model Name for vehicle #" + count);
    modelType = inputBox.getString ("Model Type for #" + count);
    gasTankCapacity = inputBox.getDouble("Gas capacity for #" + count);
    rangeOnFullTank = inputBox.getDouble("Fulltank range for #" + count);
    automobile[ i ] = new Automobile ( modelName, modelType,gasTankCapacity,rangeOnFullTank );
    count ++;
    CockTail.cockTailSort(automobile);
    for (i = 0 ; i < automobile.length ; i ++){
    automobile.displayAutomobile(outputBox);
    Here is the sort:
    import javabook.*;
    class CockTail
    public CockTail()
    public static void cockTailSort (int a [] )
    boolean sorted = false;
    int top = a.length -1, bottom =0;
    for (int pass =1; bottom < top && !sorted; pass ++)
    sorted = true;
    if (pass % 2 != 0) // odd # passes
    for (int i = bottom; i < top; i ++)
    if (a[i] > a[i + 1])
    sorted = false;
    int temp = a[i];
    a[i] = a[i + 1];
    a[i + 1] = temp;
    top --;
    else // even-numbered passes
    for (int i = top; i > bottom; i--)
    if (a[i - 1] > a[i])
    sorted =false;
    int temp = a[i];
    a[i] = a[i - 1];
    a[i - 1] = temp;
    bottom ++;

    Well I changed it to what you said and it didn't work. I really appreciate your though.
    Here are the source codes :
    import javabook.*;
    import java.util.*;
    import java.text.DecimalFormat;
    class Autos
    * Setting data members and constructors
    public static void main (String[] args){
    MainWindow mainWindow;
    InputBox inputBox;
    OutputBox outputBox;
    MessageBox messageBox;
    ResponseBox responseBox;
    String modelName, modelType;
    double gasTankCapacity, rangeOnFullTank;
    int count;
    mainWindow = new MainWindow ("Automobile input");
    inputBox = new InputBox (mainWindow);
    outputBox = new OutputBox (mainWindow);
    responseBox = new ResponseBox (mainWindow );
    messageBox = new MessageBox (mainWindow);
    messageBox.setVisible (false );
    mainWindow.setVisible ( true ) ;
    outputBox.setVisible ( true ) ;
    outputBox.printLine("This program will ask for data for 15 vehicles and ");
    outputBox.printLine("calculate the Miles Per Galllon for each vehicle and ");
    outputBox.printLine("compare the MPGs to be displayed in a sorted list in an outpuBox.");
    outputBox.printLine("you will be asked to enter the vehicles model, model type");
    outputBox.printLine("gas tank capacity and total range on a full tank.");
    // create an automobile array
    Automobile[] automobile = new Automobile [3];
    * Loop for data inputs an array creation
    int i=0;
    count =1;
    for (i = 0 ; i < automobile.length ; i ++){
    modelName = inputBox.getString ("Enter Model Name for vehicle #" + count);
    modelType = inputBox.getString ("Model Type for #" + count);
    gasTankCapacity = inputBox.getDouble("Gas capacity for #" + count);
    rangeOnFullTank = inputBox.getDouble("Fulltank range for #" + count);
    automobile[ i ] = new Automobile ( modelName, modelType,gasTankCapacity,rangeOnFullTank );
    count ++;
    *Code for cocktail sort method call
    CockTail.cockTailSort(automobile); // Error in code
    * Display data and MPG's in outputBox
    for (i = 0 ; i < automobile.length ; i ++){
    automobile.displayAutomobile(outputBox);
    Here is the cocktail shaker sort:
    import javabook.*;
    import java.util.*;
    class CockTail
    //public CockTail()
    public static void cockTailSort (Automobile[] a )
    boolean sorted = false;
    int top = a.length -1, bottom =0;
    for (int pass =1; bottom < top && !sorted; pass ++)
    sorted = true;
    if (pass % 2 != 0) // odd # passes
    for (int i = bottom; i < top; i ++)
    if (a[i] .compareto( a[i + 1])==1)
    sorted = false;
    Automobile temp = a[i];
    a[i] = a[i + 1];
    a[i + 1] = temp;
    top --;
    else // even-numbered passes
    for (int i = top; i > bottom; i--)
    if (a[i] .compareto( a[i - 1])==1)
    sorted =false;
    Automobile temp = a[i];
    a[i] = a[i - 1];
    a[i - 1] = temp;
    bottom ++;
    Here is what I know of the Automobile class:
    // JBuilder API Decompiler stub source generated from class file
    // Aug 6, 2002
    // -- implementation of methods is not available
    // Imports
    import java.lang.String;
    import javabook.OutputBox;
    class Automobile {
    // Fields
    private String modelName;
    private String modelType;
    private double gasTankCapacity;
    private double rangeOnFullTank;
    private double milesPerGallon;
    // Constructors
    public Automobile() { }
    public Automobile(String p0, String p1, double p2, double p3) { }
    // Methods
    public int compareto(Automobile p0) { }
    public void displayAutomobile(OutputBox p0) { }

  • CompareTo(Comparable) cannot be applied to...

    When I try to compile my set of files, while trying to create a priority queue, I get the following errors:
    Lijst.java:53: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
        if (lst == null || x.compareTo (lst.wrd) <= 0 ) {
                            ^
    Lijst.java:58: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
        while (h.succ != null && x.compareTo (h.succ.wrd) > 0) {
                                  ^
    Lijst.java:69: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
        if (lst == null || x.compareTo (lst.wrd) < 0 ) {
                            ^
    Lijst.java:74: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
        while (h.succ != null && x.compareTo (h.succ.wrd) > 0) {
                                  ^
    Lijst.java:78: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
        if (h.succ == null || x.compareTo (h.succ.wrd) < 0) {But x was typecasted to a Comparable in Lijst.java:
      void voegIn (Object y) {
        Comparable x = (Comparable) y;
        if (lst == null || x.compareTo (lst.wrd) <= 0 ) {
          zetVoor (x);
          return;
      }Why does Java forget that typecast???

    But that's why I've tried to typecast it to a
    Comparable. Because the argument of the compareTo
    function will be of type Toestand which implements
    Comparable.
    What's the alternative for this, if this is all
    wrong??Looks like you'll need to cast both the reference to
    the object whose method you're invoking and the
    reference to the argument. Comparable foo = (Comparable)bar;
    bar.compareTo((Comparable)lst.wrd); Or something like that.And of course this only works if lst.wrd points to an object that actually does implement Comparable.

  • When I type I cannot add text when I select the text area and double click. Why?

    When I type I cannot add text when I select the text area and double click. Why?

    Premiere Elements 11  trial version for macMac computer photos uploaded to the timeline just finetrying to make a new title, streaming or in a framedouble clicked on the text in the box and nothing shows up when I type on my keyboard. I can delete the words that are there but not type in new ones. I selected the type and size, etc.
    Thanks if you can figure it out. I gave up!
    I may just un-install it all together if I can't get to work.Joanne
    Date: Thu, 9 May 2013 17:59:08 -0700
    From: [email protected]
    To: [email protected]
    Subject: When I type I cannot add text when I select the text area and double click. Why?
        Re: When I type I cannot add text when I select the text area and double click. Why?
        created by A.T. Romano in Premiere Elements - View the full discussion
    Joanne Murray J2 What version of Premiere Elements are you using and on what operating system (including 32 or 64 bit) is your Premiere Elements installed? Forgive the questions if you have been there and done that, but I do not want to take anything for granted that might hinder a speedy resolution to your issue. Are you opening an already created title that is sitting on the Timeline in order to edit it in the Titler or are you trying to create a new Title (Default Text or other)? Do you know how to work with the Selection Tool and Type Tool in the Titler? Once I know what version of Premiere Elements that you are using, I will give you specific how to details. Thanks. ATR
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5307494#5307494
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5307494#5307494
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5307494#5307494. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Premiere Elements by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Maybe you are looking for

  • DMZ to outside Cisco ASA 5505

    Hi, i have problem configuring DMZ to access outside. I'm not able to ping from DMZ network to DMZ interface (gateway) neither am i able to contact the internet with DMZ hosts I'm able to ping from LAN to LAN gateway (inspect ICMP service policy) int

  • Superdrive stopped burning DVD no longer recognized by computer

    I am using an i Book G4. I have been consistently burning DVD's on the superdrive for several days. Today in iDVD it said there was no superdrive on the computer. I can however play DVD's on the drive. Is this a soft ware or hard ware problem? I don'

  • Stretching audio in FCE

    I have a video file of a brass band performance that I have put into FCE. However the audio quality is not the best, and want to replace it with a separately recorded audio file of the same band playing the same music. I have dropped the new audio in

  • Speech Analysis issue in Adobe Premiere Pro CS6

    I'm trying to use the speech analysis in Adobe Premiere Pro CS6. When Media Encoder starts up, it is only exporting an .f4v file. It will not export a .cit file. What do I need to do to correct this?

  • Why is Firefox randomly 'connecting...' after being on any webpage for an amount of time?

    I'm not entirely sure when this first started, although it is recently... When I am on any loaded webpage on Firefox, the tab will turn to "Connecting..." after set intervals. Is this Firefox's doing, as I am fairly certain there are no refresh comma