Please help code is repeating

I am making code to try to make a game and my problem is that my code
will not let it change the hit everytime so im getting the first guy to hit 1 then next hits 8 and so one and always repeats.
Another problem is that I would like it to attack with out me telling it how much times to attack. I am using Object oriented programming.
Here is the code for my objects:
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.Random;
import static java.lang.Math.*;
import java.awt.*;
import java.awt.color.*;
class rockCrab {
     //Wounding formula
     double sL = 70;                                   // my Strength Level
     double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
     double aB = 0;                                 // equipment stats
     double eS = (sL * bP) + 3;                         // effective strength
     double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
     //Attack formula
     double aL = 50;                                   // my Attack Level
     double eD = 1;                                   // enemy's Defence
     double eA = aL / eD;                              // effective Attack
     double eB = 0;                                   // equipment bonus'
     double bA = ((eA/10) * (eB/10));                    // base attack
     //The hit formula
     double fA = random() * bA;
     double fH = random() * bD;
     double done = rint(fH - fA);
     //health formula
     double health = floor(10 + sL/10 * aL/10);
     rockCrab() {
     void attack() {
          health = floor(10 + sL/10 * aL/10);
          double done = rint(fH - fA);
          fA = random() * bA;
          fH = random() * bD;
          done = rint(fH - fA);
          System.out.println("Rockcrab hit" +done);
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.Random;
import static java.lang.Math.*;
import java.awt.*;
import java.awt.color.*;
class self {
     //Wounding formula
     double sL = 1;                                   // my Strength Level
     double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
     double aB = 0;                                 // equipment stats
     double eS = (sL * bP) + 3;                         // effective strength
     double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
     //Attack formula
     double aL = 1;                                   // my Attack Level
     double eD = 1;                                   // enemy's Defence
     double eA = aL / eD;                              // effective Attack
     double eB = 0;                                   // equipment bonus'
     double bA = ((eA/10) * (eB/10));                    // base attack
     //The hit formula
     double fA = random() * bA;
     double fH = random() * bD;
     double done = rint(fH - fA);
     //health formula
     double health = floor(10 + sL/10 * aL/10);
     self() {
     void attack() {
          health = floor(10 + sL/10 * aL/10);
          fA = random() * bA;
          fH = random() * bD;
          done = rint(fH - fA);
          System.out.println("You hit" +done);
}Here is the main code that writes what the objects do:
class fight {
     public static void main(String[] args) {
          self instance1 = new self();
          rockCrab instance2 = new rockCrab();
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health);
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("rockCrabs health: " + instance1.health);
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health);
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("rockCrabs health: " + instance1.health);
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health);
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("rockCrabs health: " + instance1.health);
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health);
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("rockCrabs health: " + instance1.health);
}Edited by: rade134 on Jun 4, 2009 10:29 AM
Edited by: rade134 on Jun 4, 2009 10:37 AM
Edited by: rade134 on Jun 4, 2009 10:42 AM

Here is my new code for the object named object
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.Random;
import static java.lang.Math.*;
import java.awt.*;
import java.awt.color.*;
class object {
     //Wounding formula
     double sL = 70;                                   // my Strength Level
     double bP = 1;                                   // bonus for prayer (is 1 times prayer bonus)
     double aB = 0;                                 // equipment stats
     double eS = (sL * bP) + 3;                         // effective strength
     double bD = floor(1.3 + (eS/10) + (aB/80) + ((eS*aB)/640));     // my base damage
     //Attack formula
     double aL = 50;                                   // my Attack Level
     double dL = 1;                                   // my Defence
     double eB = 0;                                   // equipment bonus'
     double bA = ((aL/10) * (eB/10));                    // base attack
     //The hit formula
     double fA = random() * bA;
     double fH = random() * bD;
     double done = rint(fH);
     //health formula
     double health = floor(10 + sL/10 * aL/10);
     object(double SL, double AL, double DL) {
          sL = SL;
          aL = AL;
          dL = DL;
     void attack() {
          if (fA > fH) {
               done = 0;
          System.out.println("You hit" +done);
}The code for my main method is this:
class fight {
     public static void main(String[] args) {
          object instance1 = new object(5,7,10);
          object instance2 = new object(10,7,5);
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health + "\n");
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("your health: " + instance1.health+ "\n");
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health+ "\n");
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("your health: " + instance1.health+"\n");
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health+"\n");
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("your health: " + instance1.health+"\n");
          instance2.health = instance2.health - instance1.done;
          System.out.println("You hit: " +instance1.done);
          System.out.println("rockCrabs health: " + instance2.health+"\n");
          instance1.health = instance1.health - instance2.done;
          System.out.println("RockCrab hit: " +instance2.done);
          System.out.println("your health: " + instance1.health+"\n");
}          It still delivers the same output even though I have changed it to one object all together

Similar Messages

  • HT1338 I receive this message ,repeatedly,when I try to update an App through App store:Error code 1009.Please help,what should I do?

    I receive this message ,repeatedly,when I try to update an App through App store:Error code 1009.Please help,what should I do?

    The App Store is not available in Iran.

  • Trying to update photoshop and repeatedly get error code U44M1P7, can anyone please help resolve this?

    Trying to update photoshop and repeatedly get error code U44M1P7, can you please help resolve this?

    JJMack, Thanks for the info. Let this old man digest it and see if I can put the info into action. I'll give you a feedback. Thanks for your help in this matter. I am not a tech savvy person. 
    Rueben Rueben D. Olivas Home Ph:  1-671-969-2452
    Cell Ph:  1-671-747-2453La Luz Photography
    Email: [email protected]/Guam Firehouse Cook: http://guamfirehousecook.blogspot.com/BBQGuam: http://bbqguam.blogspot.com/My Photostream: http://ruebenolivas.megashot.net/photostream

  • Help java vendingMachine code runs doesn't work Why please help

    import java.util.*;
    public class Vend
         double costALL = 40.00;
         int invALL = 3;
         String nameALL = "ALLURE OF DARKNESS";
         double costJUD = 90.75;
         int invJUD = 2;
         String nameJUD = "JUDGMENT DRAGON ";
         double costCHA = 75.50;
         int invCHA = 3;
         String nameCHA = "CHARGE OF THE LIGHT BIRGADE";
         double costCRU = 399.99;
         int invCRU = 1;
         String nameCRU = "CRUSH CARD)";
         double costGORZ = 245.29;
         int invGORZ = 1;
         String nameGORZ = "GORZ THE EMISSARY OF DARKNESS";
         double costDAD = 220.00;
         int invDAD = 2;
         String nameDAD = "DARK ARMED DRAGON";
         double savedDeckpts = 100.00;
         double input = 0.00;
         double change = 0;
         int choice = 0;
         public static void main(String[] args)
              Vend machine = new Vend();
         public Vend()
              System.out.println(" Hello Duelist, my name is Yusie Fudo.This is the one and only Specific Rare Yu-Gi-Oh! card vending.Each card in this vending machine is sealed in a special card container.These cards are up to date with the currnet ban list and pack release's.");
              System.out.println(" in order to get cards, you will be asked to pay using your Deck Points, which are stored on your Acadmey Duel Disc");
              System.out.println("Please insert Deck Points equal to the card(s) you would like to purchase or just insert 1,703.87 Deck points");
              Scanner input = new Scanner(System.in);
              double insert = input.nextDouble();
              savedDeckpts = savedDeckpts + insert;
              change = insert - change;
              while(choice != 7 && insert > 0)
                   System.out.println(" You still have " + change + " Deck Points");
                   System.out.println("Press 1 if you would like the card ALLURE OF DARKNESS from the PhanTom of DarkNess booster pack(40.00 Dp)");
                   System.out.println("Press 2 if you would like the card JUDGMENT DRAGON from the Light Of DesTruction booster pack(90.75 Dp)");
                   System.out.println("Press 3 if you would like the card CHARGE OF THE LIGHT BIRGADE from The DuelistGeneSis booster pack(75.50 Dp)");
                   System.out.println("Press 4 if you would like the card CRUSH CARD from the limited edition GoLD series booster pack(399.99 Dp)");
                   System.out.println("Press 5 if you would like the card GORZ THE EMISSARY OF DARKNESS from the Dark LeGends booster pack(245.29 Dp)");
                   System.out.println("Press 6 if you would like the card DARK ARMED DRAGON from the PhanTom of DarkNess booster pack(220.00 Dp)");
                   System.out.println("Press 7 if you would like to have your Deck points added back to your Duel Disc");
                   System.out.println("Press 8 if you would like to check how many cards are left in the machine");
                   System.out.println("(*note you need exodius the ulitimate forbbiden one's card code inorder to use option 8)");
                   choice = input.nextInt();
                   if(choice == 1 && choice <= 8 && choice >= 1 && insert >= 40.00)
                        System.out.println("Congrats Duelist you have chosen to buy the card ALLURE OF DARKNESS from the PhanTom of DarkNess booster pack");
                        invALL = invALL - 1;
                        change = change - costALL;      
                   else if(insert < 40.00 && choice == 1)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 2 && choice <= 8 && choice >= 1 && insert >= 90.75)
                        System.out.println("Congrats Duelist you have chosen to buy the card JUDGMENT DRAGON from the Light Of DesTruction booster pack");
                        invJUD = invJUD - 1;
                        change = change - costJUD;      
                   else if(insert < 40.00 && choice == 2)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 3 && choice <= 8 && choice >= 1 && insert >= 75.50)
                        System.out.println("Congrats Duelist you have chosen to buy the card CHARGE OF THE LIGHT BIRGADE from The DuelistGeneSis booster pack");
                        invCHA = invCHA - 1;
                        change = change - costCHA;      
                   else if(insert < 40.00 && choice == 3)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 4 && choice <= 8 && choice >= 1 && insert >= 399.99)
                        System.out.println("Congrats Duelist you have chosen to buy the card CRUSH CARD from the limited edition GoLD series booster pack");
                        invCRU = invCRU - 1;
                        change = change - costCRU;      
                   else if(insert < 40.00 && choice == 4)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 5 && choice <= 8 && choice >= 1 && insert >= 245.29)
                        System.out.println("Congrats Duelist you have chosen to buy the card GORZ THE EMISSARY OF DARKNESS from the Dark LeGends booster pack");
                        invGORZ = invGORZ - 1;
                        change = change - costGORZ;      
                   else if(insert < 40.00 && choice == 5)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 6 && choice <= 8 && choice >= 1 && insert >= 220.00)
                        System.out.println("Congrats Duelist you have chosen to buy the DARK ARMED DRAGON from the PhanTom of DarkNess booster pack");
                        invDAD = invDAD - 1;
                        change = change - costDAD;      
                   else if(insert < 40.00 && choice == 6)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                   if(choice == 7 && choice <= 8 && choice >= 1 )
                        System.out.println(" You have chosen to have your Deck Points added back to your Duel Disc");
                        System.out.println("You have revceived " + change + " Deck Points back");
                        change = change * 0;
                   if(choice == 8 && choice <= 8 && choice >= 1)
                        System.out.println("You have selected to see how many of what cards are left");
                        password();
              public void password()
              System.out.println("Please input ExodiusCardCode at this time");
              Scanner pass = new Scanner(System.in);
              String password = pass.next();
              if(password.equals("blackout"))
                   System.out.println("There are " + invALL + "ALLURE OF DARKNESS ");
                   System.out.println("There are " + invJUD + "JUDGMENT DRAGON ");
                   System.out.println("There are " + invCHA + "CHARGE OF THE LIGHT BIRGADE ");
                   System.out.println("There are " + invCRU + "CRUSH CARD ");
                   System.out.println("There are " + invGORZ + "GORZ THE EMISSARY OF DARKNESS ");
                   System.out.println("There are " + invDAD + "DARK ARMED DRAGON ");
                   System.out.println("The machine has DP" + savedDeckpts + " Inside");
    }

    hi my name is exodiamaster3.14 my code runs but when it runs it tells me
    System.out.println(" Hello Duelist, my name is Yusie Fudo.This is the one and only Specific Rare Yu-Gi-Oh! card vending.Each card in this vending machine is sealed in a special card container.These cards are up to date with the currnet ban list and pack release's.");
              System.out.println(" in order to get cards, you will be asked to pay using your Deck Points, which are stored on your Acadmey Duel Disc");
              System.out.println("Please insert Deck Points equal to the card(s) you would like to purchase or just insert 1,703.87 Deck points");
    say i type in 500 it then gives me all my choices of what to buy. when you press 1-6 it just repeats it self on what you can chose.it does subtract the money but won't show that you bought it. and when you chose option 8 it does not show what is left in the machine. this is my problem please help b/c i am very stuck. thanks again.

  • PLEASE Help with HTML code for email background image...

    Hi there!
    i have a background image that I want to pop into an html email widget for the email's background...  here is the web link I created in Photoshop: file:///C:/Users/Rachel/Desktop/iMuse%20Clients/LeadMachine360/Email%20Signatures/tileabl e-metal-textures-2.html
    If anyone could please help me out that would be AWESOME!  I've attached pics of the background & I'm using Infusionsoft email builder which allows for HTML widgets.  I have a code that I use for my landing pages & webforms which works, tried that but no dice!
    Any help would be much appreciated - I'm an html newbie!
    Here is the code that I use for landing pages & works great, tried it for the email & it was a fail:
    <style>
      #mainContent .background, {
          background: url('file:///C:/Users/Rachel/Desktop/iMuse%20Clients/LeadMachine360/Email%20Signatures/ti leable-metal-textures-2.html') no-repeat center center fixed;
        background-size: cover;
    </style>
    <script src="file:///C:/Users/Rachel/Desktop/iMuse%20Clients/LeadMachine360/Email%20Signatures/ti leable-metal-textures-2.html">
    </script>
    <script>
      jQuery(document).ready(
          function(){
          jQuery(' table.bodyContainer').removeAttr('bgcolor');
    </script>
    thanks in advance!
    Muse

    Not sure what you expect. Your URL is absolute and pointing to a local file resource. It's not a proper relative HTML link. Beyond that it's toatlly unclear how you actually plan to load your image and where they are hosted, so nobody can tell you anything. Either way, there is an obviously painful lack of understanding of even the most basic web techniques, so the best advise anyone would give you is to spend some time with a web search and actualyl learn some of that stuff...
    Mylenium

  • Cannot restore my brand new iphone 4s ,got stuck in DFU mode and itunes shows error code (-1) please help?

    Cannot restore my brand new iphone 4s ,got stuck in DFU mode and itunes shows error code (-1) please help?
    repeatedly tried from diffierent computers and the same error code pops up (error -1)

    That's a hardware problem which will require a trip to the Apple store for evaluation, unless your phone has been jailbroken, then it's a corrupt hosts file (and we can't help you with that here as it is against the forum's terms of use).

  • Stuck up in the code.Please help me.

    Hi,
    IF pa0168-bplan = 'P005' then send 'ST' to RDSTDCover field.
    send BEGDA OF PA0168 if 'ST' was sent for RDSTDCover, else send blanks for field RDSTDStrDte
    send ENDDA of PA0168 if 'ST' was sent for RDSTDCover& ENDDA is not equal to 12/12/9999.  Else send blanks for field RDSTDStpDte.
    If RDSTDCover = 'ST' Send '100525' for field RDSTDRptNum.
    if RDSTDCover = 'ST' Send 'N' for field RDSTDContPlan.
    if RDSTDCover = 'ST' do the following:
       If PA0001-BURKS='1009' go to Table Z_PR_legcode to retrieve previous Company Code Text       for PA0002-PERID.
    I was coded like this
    loop at p0168 into w0168
                    where begda <= v_rundat and
                          endda >= v_rundat.
        if w0168-bplan = 'p005'
          w_MetLife_detail-rdstdcover = 'ST'
        endif.
      endloop.
    but i was stuck up here.Please help me on this.

    Hi,
      Thanks for your reply.Again same condtions are repeating for LTD plan 'P006'.Where i write this conditions.
    IF pa0168-bplan = 'P006' then send 'LT' to RDLTDCover field.
    send BEGDA OF PA0168 to RDLTDStrDte if 'LT' was sent for RDLTDCover, else send blanks. 
    send ENDDA of PA0168 to RDLTDStpDte.if 'LT' was sent for RDLTDCover& ENDDA is not equal to 12/12/9999.  Else send blanks for field.
    If RDLTDCover = 'LT' Send '98340' for field RDLTDRptNum.
    if RDLTDCover = 'LT' Send 'N' for field RDLTDContPlan.
    if RDLTDCover = 'LT' do the following:
       If PA0001-BURKS='1009' go to Table Z_PR_legcode to retrieve previous Company Code Text for PA0002-PERID.
    Regards,
    Sujan

  • Error 213:5 code. Please help asap

    I keep getting an Error 213:5 code for my mac which is awesome. Please help.

    Gbsterns the file permissions for the SLStore folder under your current user account have become compromised.  Please see Configuration error 16 when you start a Creative Cloud (CC) or Creative Suite (CS) application - http://helpx.adobe.com/x-productkb/policy-pricing/configuration-error-cs5.html for additional information.
    If you continue to face difficulties then can you please post which Adobe software title you are trying to install?  Also the operating system would be beneficial.  Finally to avoid repeats if you can also list any additional steps you have performed to resolve your current difficulties it would be appreciated.
    Finally you may also want to review Activation & deactivation help - http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html which discusses Activation errors such as 213:5.

  • I want to set up home sharing on a laptop but it won't let me. Error code (-3252) comes up. Please help.

    I want to set up home sharing on a laptop (nothing on this iTunes library apart from the purchases from the iTunes store made on my ipod touch) but it won't let me. Error code (-3252) comes up. Please help.

    What version of iPhoto?
    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • I an getting an error with photo merge in PS cc . It gives me a code tmp00000001 using from photoshop and if I try from bridge it tell me that I need to select more than one image. It is not recognizing the photos I am selecting in bridge. please help. my

    A new problem with CS5 forced me to download PScc but the problem is still there.  I am getting tmp00000001 in photo merge when importing multiple files from inside PS and if trying from bridge I am getting a pop up box telling me I need to select more than 1 file. Photoshop potomerge is not recognizing my selections from bridge..!! please help.. my knowledge of computers is a 3 on a scale of 1-10

    if i run this particular code
    ( SELECT
    AccountDetails.CUSTOMERNUMBER, AccountDetails.ACCOUNTNUMBER, CUSTOMERDETAILS.CDTITLE, CUSTOMERDETAILS.CDFIRSTNAME, CUSTOMERDETAILS.CDLASTNAME, AccountDetails.ACCOUNTTYPE,
    AccountDetails.ORIGINALCONTRACTENDDATE, AccountDetails.CONTRACTTERM, AccountDetails.CONTRACTENDDATE, AccountDetails.BRANCHAREA, AccountDetails.PRODUCTTYPE,
    AccountDetails.HOUSEBANKACCOUNT, AccountDetails.CARMODEL, AccountDetails.CARLICENCE, AccountDetails.ARREARSBALANCE, AccountDetails.CODEBTOR, AccountDetails.GUARANTORNUMBER
    FROM AccountDetails
    JOIN CUSTOMERDETAILS ON AccountDetails.CUSTOMERNUMBER = CUSTOMERDETAILS.CUSTOMERS1
    WHERE EXISTS
    ( SELECT *
    FROM Dcaaccountallocation
    JOIN DebtEpisodes ON DebtEpisodes.ACCOUNTID = Dcaaccountallocation.ACCOUNTID
    WHERE Dcaaccountallocation.dcaid = 41
    AND Dcaaccountallocation.status = 2
    AND DebtEpisodes.DCASentDate IS NULL
    AND Dcaaccountallocation.ACCOUNTID = AccountDetails.ACCOUNTNUMBER
    AND DebtEpisodes.DCAORLAWYER = 'DCA'
    This returns 1 row of data
    However if i run a small part of the above code...
    SELECT *
    FROM Dcaaccountallocation
    JOIN DebtEpisodes ON DebtEpisodes.ACCOUNTID = Dcaaccountallocation.ACCOUNTID
    WHERE Dcaaccountallocation.dcaid = 41
    AND Dcaaccountallocation.status = 2
    It returns a lot of rows with a status of 2
    Now i presume what I am going to do is to ensure that all the fields provide satisfactory requirements, with regards to the above code. Although I have many records in all the stated tables already.
    :(

  • Output not what I want, please try and help, code supplied... :-)

    Hello everyone, please help me if u can, Im desperate. Essentially wot Im tryin to do, is create a cd collection program, whereby details of the cd are entered (price, quantity, title and artist) and I would like to return statistical data on the cd collection, such as total number of cds, most expensive and cheapest cds etc. As you can I see I have used arrays to find out the cheapest cd and most expensive cd, it seems to compile k but Im not getting the results/output I want. Its displaying the price fine, but I also want the quantity, title and artist details to be outputted as well, like I do in the cd list using the cdDetails method. Ive tried many ways but still cant do it.
    If anybody can help please do if you've got a minute, I will gladfully reward you with duke dollars.
    Below is the latest edition of my code:
    Thanks in advance,
    Larry
    import avi.*;
    public class CDCollection
    private String title = "Unknown";
    private String artist = "Unknown";
    private int quan = 0;
    private double price = 0;
    CDCollection(double cdPrice, int cdQuan, String cdTitle, String cdArtist)
    title = cdTitle;
    artist = cdArtist;
    quan = cdQuan;
    price = cdPrice;
    public double getPrice()
    return this.price;
    public static double findHighest(CDCollection[] cds)
    double highestSoFar = -1; // lower than any valid
    for (int i = 0; i < cds.length; i++)
    if (cds.getPrice() > highestSoFar)
              highestSoFar = cds [i].getPrice();
    return highestSoFar;
    public static double findLowest(CDCollection[] cds)
    double lowestSoFar = 1000; // lower than any valid
    for (int i = 0; i < cds.length; i++)
    if (cds[i].getPrice() < lowestSoFar)
              lowestSoFar = cds [i].getPrice();
    return lowestSoFar;
    public void cdDetails(Window screen)
         screen.write("�"+price+"\t"+quan+"\t"+title+"\t"+artist+"\n");
    class CDMain
    public static void main(String[] args)
         Window screen = new Window ("CDMain", "bold", "black", 14);
    screen.showWindow();
         screen.write("CD List:\n\n");
    CDCollection[] cds = new CDCollection[3];
    cds[0] = new CDCollection (10.99,11,"All Killer No Filler","Sum 41");
    cds[0].cdDetails(screen);
    cds[1] = new CDCollection (12.99,8,"The best of","Sting");
    cds[1].cdDetails(screen);
    cds[2] = new CDCollection (13.99,4,"Best of","Beegees");
    cds[2].cdDetails(screen);
    double highest = CDCollection.findHighest(cds);
    screen.write("\nThe most expensive cd is: �"+highest+"");
    double lowest = CDCollection.findLowest(cds);
    screen.write("\nThe cheapest cd is: �"+lowest+"");

    The findLowest method should return the instance with the lowest
    price, not [only] the lowest price. That way you would
    have your information.
    public CDCollection double findLowest(CDCollection[] cds)
        CDCollection lowest;
        if (cds.length>0) {
            lowest = cds[0];
            for (int i=1; i<cds.length; i++) {
                 if (cds[ i].getPrice() < lowest.getPrice()) {
                      lowest = cds[ i];
        } else {
             // no cds --> no lowest --> return null
             lowest = null;
        return lowest;
    }findHighest: same struggle.

  • Ok. So my iTunes started acting up a few months ago. ALL of the songs I purchased from the iTunes store stop in the middle of the song and then go back to the begining (I keep it on repeat one song by the way). Please help!!! (Windows 7)

    Ok. So my iTunes started acting up a few months ago. ALL of the songs I purchased from the iTunes store stop in the middle of the song and then go back to the begining (I keep it on repeat one song by the way). Please help!!! (Windows 7) I would really like to hear my songs all the way through, but I can't . I tried the "Convert Protected ACC files to Purchased ACC files fix" but it DIDN'T work. I don't know what to do. It does it when I transfer the music onto my Classic too.

    What do you mean "doesn't recognize"?

  • My app store is not working after installing mavericks. When I open app store it repeatedly asking me to login with apple ID and to provide User name and Password for proxy authentication in a loop.I am a newbie to mac,Please help me.

    My app store is not working after installing mavericks. When I open app store it repeatedly asking me to login with apple ID and to provide User name and Password for proxy authentication in a loop.I am a newbie to mac,Please help me.

    Hmmmm... would appear that you need to be actually logged in to enable the additional menu features.
    Have you tried deletting the plists for MAS?
    This page might help you out...
    http://www.macobserver.com/tmo/answers/how_to_identify_and_fix_problems_with_the _mac_app_store
    Failing that, I will have to throw this back to the forum to see if anyone else can advise further.
    Let me know how you get on?
    Thanks.

  • Windows Update Error Code 80072F8F! I Did All The Steps And Will Not Fix Please HELP?

    No one seems they can not help me fix this error code I did many things and not one person has really
    helped me, I have a question at another forum but all they do is just ask me questions tell me steps to fix this but nothing worked at all, This happened on 8/30/2014 and ever since no one can help me fix this at all....I have no money to pay for the fix...I
    am on very very low limited disability income, No credit cards nothing. I need help now I paid a lot of money for my Windows 7 Ultimate and now since 8/30/2014 I got that error code no one has helped me....PLEASE help me please....And I am not sure where to
    go for help here thank you. I have done many things but nothing is fixing this issue. please help...And yes I did the clock and clock keeps perfect time, doing that clock did not fix this error code at all...

    Hi Angelsims,
    First I also want to get more information from you to help us to troubleshhot:
    1.Did this error occur on a single update or multiple updates? please also post the update name in issue.
    2.Please also post the steps you have followed to fix this issue.
    In addition, please try to use the general steps to troubleshoot the windows update issue, and refer to the steps below:
    The following outlines how to stop services pertaining to Windows Update, rename system folders, register related DLL files, and then restart the previously mentioned services. This troubleshooting generally applies to all Windows Update related issues.
     Stopping services pertaining to Windows Update
    1.     Click Start, click All Programs, click Accessories, right-click Command Prompt, and select Run as Administrator.
    2.     If you receive a notification from User Account Control simply click Continue.
    3.     At the command prompt, type the following, commands and then press ENTER after each command.
            net stop wuauserv
            net stop bits
            net stop cryptsvc
     Please do not close the Command Prompt window.
     Renaming folders pertaining to Windows Update
    1.     At the command prompt, type the following commands, and then press Enter after each command:
    2.     ren %systemroot%\System32\Catroot2 Catroot2.old
    3.     ren %systemroot%\SoftwareDistribution SoftwareDistribution.old
    4.     Please do not close the Command Prompt window.
     Registering DLL’s pertaining to Windows Update
    1.     Please copy and paste the following text into a new Notepad document, and save the file as WindowsUpdate.BAT
    2.     If saved correctly the icon will change from a Notepad file to BAT file which has two blue cogs as its     icon.
                                           -or-
    3.     You can manually type each command at the command prompt:
             regsvr32 c:\windows\system32\vbscript.dll /s
             regsvr32 c:\windows\system32\mshtml.dll /s
             regsvr32 c:\windows\system32\msjava.dll /s
             regsvr32 c:\windows\system32\jscript.dll /s
             regsvr32 c:\windows\system32\msxml.dll /s
             regsvr32 c:\windows\system32\actxprxy.dll /s
             regsvr32 c:\windows\system32\shdocvw.dll /s
             regsvr32 wuapi.dll /s
             regsvr32 wuaueng1.dll /s
             regsvr32 wuaueng.dll /s
            regsvr32 wucltui.dll /s
             regsvr32 wups2.dll /s
             regsvr32 wups.dll /s
             regsvr32 wuweb.dll /s
             regsvr32 Softpub.dll /s
            regsvr32 Mssip32.dll /s
             regsvr32 Initpki.dll /s
             regsvr32 softpub.dll /s
             regsvr32 wintrust.dll /s
             regsvr32 initpki.dll /s
            regsvr32 dssenh.dll /s
            regsvr32 rsaenh.dll /s
             regsvr32 gpkcsp.dll /s
             regsvr32 sccbase.dll /s
             regsvr32 slbcsp.dll /s
             regsvr32 cryptdlg.dll /s
             regsvr32 Urlmon.dll /s
             regsvr32 Shdocvw.dll /s
             regsvr32 Msjava.dll /s
             regsvr32 Actxprxy.dll /s
             regsvr32 Oleaut32.dll /s
            regsvr32 Mshtml.dll /s
             regsvr32 msxml.dll /s
             regsvr32 msxml2.dll /s
             regsvr32 msxml3.dll /s
             regsvr32 Browseui.dll /s
             regsvr32 shell32.dll /s
             regsvr32 wuapi.dll /s
             regsvr32 wuaueng.dll /s
             regsvr32 wuaueng1.dll /s
             regsvr32 wucltui.dll /s
             regsvr32 wups.dll /s
             regsvr32 wuweb.dll /s
             regsvr32 jscript.dll /s
             regsvr32 atl.dll /s
             regsvr32 Mssip32.dll /s 
     Restarting services pertaining to Windows Update
    1.     Click Start, click All Programs, click Accessories, right-click Command Prompt, and select Run as Administrator.
    2.     If you receive a notification from User Account Control simply click Continue.
    3.     At the command prompt, type the following, commands and then
    press ENTER after each command.
            net start wuauserv
            net start bits
            net start cryptsvc
             exit
    Please try the steps above, if the step failed, please post the error or failure information.
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang       

  • Can someone please help me re-install my Creative Design 5.5 on my Mac?  My MacBook Pro recently crashed and had to have the hard drive replaced.  The back up from Time Machine is not reinstalling the program.  Since I have the download paid, and codes, I

    Can someone please help me re-install my Creative Design 5.5 on my Mac?  My MacBook Pro recently crashed and had to have the hard drive replaced.  The back up from Time Machine is not reinstalling the program.  Since I have the download paid, and codes, I need direction on how to reinstall -- HELP?

    Hi bodegakc,
    If you have the serial number then please use the below mentioned link to download the product you are looking for .
    CS5.5
    Also before installing Please go to Applications-->Utilities--> Adobe installers and if there is any uninstaller for CS5.5 , you can remove it and do a fresh install.
    You can also use creative cloud cleaner tool before installing.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Thanks
    Nikhil Gupta

Maybe you are looking for

  • Why can I not do a Wi-Fi sync, and what should I expect when I do?

    My wife and I each have an iPad 2 and an iPhone 4 all with OIS 5, and I don't understand how iTunes wi-fi sync is supposed to work assuming that you can help me get it to work. Her laptop is running Windows Vista, and my pc is running Windows XP. My

  • High amperage?

    Since last friday I have these two problems with my three months old latest edition 15 inch Powerbook (all updates on board, including the latest battery update). After loading the battery, I only have approximately 90 minutes battery life (the perce

  • Iphone activation taking too long

    I got my iphone 4 on Saturday, the sales person said that the phone would be activated in 4hrs. 4hrs came and went and so i decided to call up and i was told to wait another 24hrs. 24hrs came and went and my iphone still was still not activated. I ha

  • Does Microsoft provide list of patch name, kb number, patch and product code for released hotfixes?

    Hi, I'm looking for collective information for all hotfixes released by Microsoft with information such as patch and product code for msiinstall, patch and product name, e.g.:Patch Code : {97EBAE10-0D01-458E-BBD7-74ADBE8A51C9} Product Code : {9014000

  • Dropped 12" powerbook - HD fine, powers up but display doesn't come on

    I'm trying to fix a dropped 12" powerbook. The battery corner took the impact. I've taken it apart and removed the HD which was fine and backed that up. When I turn on the powerbook it seems to power up fine, but the display doesn't turn on. Though i