Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: i like to play this game with my phone and i wanted to make a program to help me

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default i like to play this game with my phone and i wanted to make a program to help me

    import java.util.*;
    import java.io.*;
    import java.lang.*;
    public class Tester
    {
        public static void main(String Args[])
        {
            Scanner KbReader = new Scanner(System.in);
            System.out.println("Hello I(Aaron James Rasmussen) have made this program to help with your cost/time/profit deals");
            System.out.println("How much money do you have?");
            int money = KbReader.nextInt();
            System.out.println("What is the maximum number of available tanks you have?");
            int tank = KbReader.nextInt();
            System.out.println("What level are you?");
            int level = KbReader.nextInt();
    this is the io portion and starting skeleton
    int maxfish = tank * 50;
            int catfishcost = 30000;
            int greensnappercost = 10;
            int whitebunnyfishcost = 55;
            int royalgrammacost = 100000;
            int walruscost = 15000;
            int sharkcost = 10000;
            int bandedbutterflycost = 80;
            int swordfishcost = 12000;
            int dolphincost = 35000;
            int penguincost = 42000;
            int electriceelcost = 75000;
            int boxfishcost = 26000;
            int scottfairyfishcost = 48000;
            int chromiscost = 175;
            int goldendwarfcost = 280;
            int bluehippofishcost = 3500;
            int pinkskunkclownfishcost = 2500000;
            int lolipopfishcost = 25000;
            int purpletangcost = 3000;
            int borboniusanthiascost = 1500000;
    this is where it defines the price of every fish
    int availableshark = 0;
            int availablebandedbutterfly = 0;
            int availableswordfish = 0;
            int availabledolphin = 0;
            int availablepenguin = 0;
            int availableelectriceel = 0;
            int availablechromis = 0;
            int availablegoldendwarf = 0;
    these are for those fish that have level requirements seen below
    int availablecatfish = catfishcost / money;
            if(availablecatfish > maxfish)
                availablecatfish = maxfish;
            availablecatfish = Math.round(availablecatfish);
            int availablegreensnapper = greensnappercost / money;
            if(availablegreensnapper > maxfish)
                availablegreensnapper = maxfish;
            availablegreensnapper = Math.round(availablegreensnapper);
            int availablewhitebunnyfish = whitebunnyfishcost / money;
            if(availablewhitebunnyfish > maxfish)
                availablewhitebunnyfish = maxfish;
            availablewhitebunnyfish = Math.round(availablewhitebunnyfish);
            int availableroyalgramma = royalgrammacost / money;
            if(availableroyalgramma > maxfish)
                availableroyalgramma = maxfish;
            availableroyalgramma = Math.round(availableroyalgramma);
            int availablewalrus = walruscost / money;
            if(availablewalrus > maxfish)
                availablewalrus = maxfish;
            availablewalrus = Math.round(availablewalrus);
            if(level > 39)
                {
                availableshark = sharkcost / money;
                if(availableshark > maxfish)
                    availableshark = maxfish;
                }
            else
                availableshark = 0;
            availableshark = Math.round(availableshark);
            if(level > 8)
                {
                availablebandedbutterfly = bandedbutterflycost / money;
                if(availablebandedbutterfly > maxfish)
                    availablebandedbutterfly = maxfish;
                }
            else
                availablebandedbutterfly = 0;
            availablebandedbutterfly = Math.round(availablebandedbutterfly);
            if(level > 29)
                {
                availableswordfish = swordfishcost / money;
                if(availableswordfish > maxfish)
                    availableswordfish = maxfish;
                }
            else
                availableswordfish = 0;
            availableswordfish = Math.round(availableswordfish);
            if(level > 54)
                {
                availabledolphin = dolphincost / money;
                if(availabledolphin > maxfish)
                    availabledolphin = maxfish;
                 }
            else
                availabledolphin = 0;
            availabledolphin = Math.round(availabledolphin);
            if(level > 59)
                {
                 availablepenguin = penguincost / money;
                 if(availablepenguin > maxfish)
                    availablepenguin = maxfish;
                }
            else
                availablepenguin = 0;
            availablepenguin = Math.round(availablepenguin);
            if(level > 64)
                {
                availableelectriceel = electriceelcost / money;
                if(availableelectriceel > maxfish)
                    availableelectriceel = maxfish;
                }
            else
                availableelectriceel = 0;
            availableelectriceel = Math.round(availableelectriceel);
            int availableboxfish = boxfishcost / money;
            if(availableboxfish > maxfish)
                availableboxfish = maxfish;
            availableboxfish = Math.round(availableboxfish);
            int availablescottfairyfish = scottfairyfishcost / money;
            if(availablescottfairyfish > maxfish)
                availablescottfairyfish = maxfish;
            availablescottfairyfish = Math.round(availablescottfairyfish);
            if(level > 11)
                {
                 availablechromis = chromiscost / money;
                 if(availablechromis > maxfish)
                    availablechromis = maxfish;
                 }
            else
                 availablechromis = 0;
            availablechromis = Math.round(availablechromis);
            if(level > 18)
                {
                availablegoldendwarf = goldendwarfcost / money;
                if(availablegoldendwarf > maxfish)
                    availablegoldendwarf = maxfish;
                }
            else
                availablegoldendwarf = 0;
            availablegoldendwarf = Math.round(availablegoldendwarf);
            int availablebluehippofish = bluehippofishcost / money;
            if(availablebluehippofish > maxfish)
                availablebluehippofish = maxfish;
            availablebluehippofish = Math.round(availablebluehippofish);
            int availablepinkskunkclownfish = pinkskunkclownfishcost / money;
            if(availablepinkskunkclownfish > maxfish)
                availablepinkskunkclownfish = maxfish;
            availablepinkskunkclownfish = Math.round(availablepinkskunkclownfish); 
            int availablelolipopfish = lolipopfishcost / money;
            if(availablelolipopfish > maxfish)
                availablelolipopfish = maxfish;
            availablelolipopfish = Math.round(availablelolipopfish);  
            int availablepurpletang = purpletangcost / money;
            if(availablepurpletang > maxfish)
                availablepurpletang = maxfish;
            availablepurpletang = Math.round(availablepurpletang);    
            int availableborboniusanthias = borboniusanthiascost / money;
            if(availableborboniusanthias > maxfish)
                availableborboniusanthias = maxfish;
            availableborboniusanthias = Math.round(availableborboniusanthias);
    here is where it how many fish im able to buy of each and makes sure that it doesnt go past the maximum fish allowed
    double catfishprofit = (availablecatfish * 34500 * 1.2 - (availablecatfish * catfishcost)) / (10 / 3);
            double greensnapperprofit = (availablegreensnapper * 15 * 1.2 - (availablegreensnapper * greensnappercost)) * 3;
            double whitebunnyfishprofit = (availablewhitebunnyfish * 58 * 1.2 - (availablewhitebunnyfish * whitebunnyfishcost)) * (24 / 7);
            double royalgrammaprofit = (availableroyalgramma * 105000 * 1.2 - (availableroyalgramma * royalgrammacost)) / 3;
            double walrusprofit = (availablewalrus * 15300 * 1.2 - (availablewalrus * walruscost)) / 3;
            double sharkprofit = (availableshark * 11000 * 1.2 - (availableshark * sharkcost)) / 7;
            double bandedbutterflyprofit = (availablebandedbutterfly * 190 * 1.2) - (availablebandedbutterfly * bandedbutterflycost);
            double swordfishprofit = (availableswordfish * 13800 * 1.2 - (availableswordfish * swordfishcost)) / 4;
            double dolphinprofit = (availabledolphin * 42000 * 1.2 - (availabledolphin * dolphincost)) / 7;
            double penguinprofit = (availablepenguin * 48720 * 1.2 - (availablepenguin * penguincost)) / 5;
            double electriceelprofit = (availableelectriceel * 112500 * 1.2 - (availableelectriceel * electriceelcost)) / 4;
            double boxfishprofit = (availableboxfish * 26139 * 1.2 - (availableboxfish * boxfishcost)) / 2;
            double scottfairyfishprofit = (availablescottfairyfish * 48240 * 1.2 - (availablescottfairyfish * scottfairyfishcost)) / 2.5;
            double chromisprofit = (availablechromis * 290 * 1.2) - (availablechromis * chromiscost);
            double goldendwarfprofit = (availablegoldendwarf * 518 * 1.2) - (availablegoldendwarf * goldendwarfcost);
            double bluehippofishprofit = (availablebluehippofish * 3885 * 1.2 - (availablebluehippofish * bluehippofishcost)) / 2.5;
            double pinkskunkclownfishprofit = (availablepinkskunkclownfish * 2625000 * 1.2 - (availablepinkskunkclownfish * pinkskunkclownfishcost)) / 5;
            double lolipopfishprofit = (availablelolipopfish * 26250 * 1.2 - (availablelolipopfish * lolipopfishcost)) / 4;
            double purpletangprofit = (availablepurpletang * 3135 * 1.2 - (availablepurpletang * purpletangcost)) / 3;
            double borboniusanthiasprofit = (availableborboniusanthias * 1516500 * 1.2 - (availableborboniusanthias * borboniusanthiascost)) / 3;
    ok here is where the profit per fish is defined this should show how much profit each fish would get with defined money
    if(catfishprofit >= greensnapperprofit && catfishprofit >= whitebunnyfishprofit && catfishprofit >= royalgrammaprofit && catfishprofit >= walrusprofit && catfishprofit >= sharkprofit && catfishprofit >= bandedbutterflyprofit && catfishprofit >= swordfishprofit && catfishprofit >= dolphinprofit && catfishprofit >= penguinprofit && catfishprofit >= electriceelprofit && catfishprofit >= boxfishprofit && catfishprofit >= scottfairyfishprofit && catfishprofit >= chromisprofit && catfishprofit >= goldendwarfprofit && catfishprofit >= bluehippofishprofit && catfishprofit >= pinkskunkclownfishprofit && catfishprofit >= lolipopfishprofit && catfishprofit >= purpletangprofit && catfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is catfish for $" + catfishprofit + " a day");
            else if(greensnapperprofit >= catfishprofit && greensnapperprofit >= whitebunnyfishprofit && greensnapperprofit >= royalgrammaprofit && greensnapperprofit >= walrusprofit && greensnapperprofit >= sharkprofit && greensnapperprofit >= bandedbutterflyprofit && greensnapperprofit >= swordfishprofit && greensnapperprofit >= dolphinprofit && greensnapperprofit >= penguinprofit && greensnapperprofit >= electriceelprofit && greensnapperprofit >= boxfishprofit && greensnapperprofit >= scottfairyfishprofit && greensnapperprofit >= chromisprofit && greensnapperprofit >= goldendwarfprofit && greensnapperprofit >= bluehippofishprofit && greensnapperprofit >= pinkskunkclownfishprofit && greensnapperprofit >= lolipopfishprofit && greensnapperprofit >= purpletangprofit && greensnapperprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is greensnapper for $" + greensnapperprofit + " a day");
            else if(whitebunnyfishprofit >= greensnapperprofit && whitebunnyfishprofit >= catfishprofit && whitebunnyfishprofit >= royalgrammaprofit && whitebunnyfishprofit >= walrusprofit && whitebunnyfishprofit >= sharkprofit && whitebunnyfishprofit >= bandedbutterflyprofit && whitebunnyfishprofit >= swordfishprofit && whitebunnyfishprofit >= dolphinprofit && whitebunnyfishprofit >= penguinprofit && whitebunnyfishprofit >= electriceelprofit && whitebunnyfishprofit >= boxfishprofit && whitebunnyfishprofit >= scottfairyfishprofit && whitebunnyfishprofit >= chromisprofit && whitebunnyfishprofit >= goldendwarfprofit && whitebunnyfishprofit >= bluehippofishprofit && whitebunnyfishprofit >= pinkskunkclownfishprofit && whitebunnyfishprofit >= lolipopfishprofit && whitebunnyfishprofit >= purpletangprofit && whitebunnyfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is whitebunnyfish for $" + whitebunnyfishprofit + " a day");
            else if(royalgrammaprofit >= greensnapperprofit && royalgrammaprofit >= whitebunnyfishprofit && royalgrammaprofit >= catfishprofit && royalgrammaprofit >= walrusprofit && royalgrammaprofit >= sharkprofit && royalgrammaprofit >= bandedbutterflyprofit && royalgrammaprofit >= swordfishprofit && royalgrammaprofit >= dolphinprofit && royalgrammaprofit >= penguinprofit && royalgrammaprofit >= electriceelprofit && royalgrammaprofit >= boxfishprofit && royalgrammaprofit >= scottfairyfishprofit && royalgrammaprofit >= chromisprofit && royalgrammaprofit >= goldendwarfprofit && royalgrammaprofit >= bluehippofishprofit && royalgrammaprofit >= pinkskunkclownfishprofit && royalgrammaprofit >= lolipopfishprofit && royalgrammaprofit >= purpletangprofit && royalgrammaprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is royalgramma for $" + royalgrammaprofit + " a day");
            else if(walrusprofit >= greensnapperprofit && walrusprofit >= whitebunnyfishprofit && walrusprofit >= royalgrammaprofit && walrusprofit >= catfishprofit && walrusprofit >= sharkprofit && walrusprofit >= bandedbutterflyprofit && walrusprofit >= swordfishprofit && walrusprofit >= dolphinprofit && walrusprofit >= penguinprofit && walrusprofit >= electriceelprofit && walrusprofit >= boxfishprofit && walrusprofit >= scottfairyfishprofit && walrusprofit >= chromisprofit && walrusprofit >= goldendwarfprofit && walrusprofit >= bluehippofishprofit && walrusprofit >= pinkskunkclownfishprofit && walrusprofit >= lolipopfishprofit && walrusprofit >= purpletangprofit && walrusprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is walrus for $" + walrusprofit + " a day");
            else if(sharkprofit >= greensnapperprofit && sharkprofit >= whitebunnyfishprofit && sharkprofit >= royalgrammaprofit && sharkprofit >= walrusprofit && sharkprofit >= catfishprofit && sharkprofit >= bandedbutterflyprofit && sharkprofit >= swordfishprofit && sharkprofit >= dolphinprofit && sharkprofit >= penguinprofit && sharkprofit >= electriceelprofit && sharkprofit >= boxfishprofit && sharkprofit >= scottfairyfishprofit && sharkprofit >= chromisprofit && sharkprofit >= goldendwarfprofit && sharkprofit >= bluehippofishprofit && sharkprofit >= pinkskunkclownfishprofit && sharkprofit >= lolipopfishprofit && sharkprofit >= purpletangprofit && sharkprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is shark for $" + sharkprofit + " a day");
            else if(bandedbutterflyprofit >= greensnapperprofit && bandedbutterflyprofit >= whitebunnyfishprofit && bandedbutterflyprofit >= royalgrammaprofit && bandedbutterflyprofit >= walrusprofit && bandedbutterflyprofit >= sharkprofit && bandedbutterflyprofit >= catfishprofit && bandedbutterflyprofit >= swordfishprofit && bandedbutterflyprofit >= dolphinprofit && bandedbutterflyprofit >= penguinprofit && bandedbutterflyprofit >= electriceelprofit && bandedbutterflyprofit >= boxfishprofit && bandedbutterflyprofit >= scottfairyfishprofit && bandedbutterflyprofit >= chromisprofit && bandedbutterflyprofit >= goldendwarfprofit && bandedbutterflyprofit >= bluehippofishprofit && bandedbutterflyprofit >= pinkskunkclownfishprofit && bandedbutterflyprofit >= lolipopfishprofit && bandedbutterflyprofit >= purpletangprofit && bandedbutterflyprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is bandedbutterfly for $" + bandedbutterflyprofit + " a day");
            else if(swordfishprofit >= greensnapperprofit && swordfishprofit >= whitebunnyfishprofit && swordfishprofit >= royalgrammaprofit && swordfishprofit >= walrusprofit && swordfishprofit >= sharkprofit && swordfishprofit >= bandedbutterflyprofit && swordfishprofit >= catfishprofit && swordfishprofit >= dolphinprofit && swordfishprofit >= penguinprofit && swordfishprofit >= electriceelprofit && swordfishprofit >= boxfishprofit && swordfishprofit >= scottfairyfishprofit && swordfishprofit >= chromisprofit && swordfishprofit >= goldendwarfprofit && swordfishprofit >= bluehippofishprofit && swordfishprofit >= pinkskunkclownfishprofit && swordfishprofit >= lolipopfishprofit && swordfishprofit >= purpletangprofit && swordfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is swordfish for $" + swordfishprofit + " a day");
            else if(dolphinprofit >= greensnapperprofit && dolphinprofit >= whitebunnyfishprofit && dolphinprofit >= royalgrammaprofit && dolphinprofit >= walrusprofit && dolphinprofit >= sharkprofit && dolphinprofit >= bandedbutterflyprofit && dolphinprofit >= swordfishprofit && dolphinprofit >= catfishprofit && dolphinprofit >= penguinprofit && dolphinprofit >= electriceelprofit && dolphinprofit >= boxfishprofit && dolphinprofit >= scottfairyfishprofit && dolphinprofit >= chromisprofit && dolphinprofit >= goldendwarfprofit && dolphinprofit >= bluehippofishprofit && dolphinprofit >= pinkskunkclownfishprofit && dolphinprofit >= lolipopfishprofit && dolphinprofit >= purpletangprofit && dolphinprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is dolphin for $" + dolphinprofit + " a day");
            else if(penguinprofit >= greensnapperprofit && penguinprofit >= whitebunnyfishprofit && penguinprofit >= royalgrammaprofit && penguinprofit >= walrusprofit && penguinprofit >= sharkprofit && penguinprofit >= bandedbutterflyprofit && penguinprofit >= swordfishprofit && penguinprofit >= dolphinprofit && penguinprofit >= catfishprofit && penguinprofit >= electriceelprofit && penguinprofit >= boxfishprofit && penguinprofit >= scottfairyfishprofit && penguinprofit >= chromisprofit && penguinprofit >= goldendwarfprofit && penguinprofit >= bluehippofishprofit && penguinprofit >= pinkskunkclownfishprofit && penguinprofit >= lolipopfishprofit && penguinprofit >= purpletangprofit && penguinprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is penguin for $" + penguinprofit + " a day");
            else if(electriceelprofit >= greensnapperprofit && electriceelprofit >= whitebunnyfishprofit && electriceelprofit >= royalgrammaprofit && electriceelprofit >= walrusprofit && electriceelprofit >= sharkprofit && electriceelprofit >= bandedbutterflyprofit && electriceelprofit >= swordfishprofit && electriceelprofit >= dolphinprofit && electriceelprofit >= penguinprofit && electriceelprofit >= catfishprofit && electriceelprofit >= boxfishprofit && electriceelprofit >= scottfairyfishprofit && electriceelprofit >= chromisprofit && electriceelprofit >= goldendwarfprofit && electriceelprofit >= bluehippofishprofit && electriceelprofit >= pinkskunkclownfishprofit && electriceelprofit >= lolipopfishprofit && electriceelprofit >= purpletangprofit && electriceelprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is electriceel for $" + electriceelprofit + " a day");
            else if(boxfishprofit >= greensnapperprofit && boxfishprofit >= whitebunnyfishprofit && boxfishprofit >= royalgrammaprofit && boxfishprofit >= walrusprofit && boxfishprofit >= sharkprofit && boxfishprofit >= bandedbutterflyprofit && boxfishprofit >= swordfishprofit && boxfishprofit >= dolphinprofit && boxfishprofit >= penguinprofit && boxfishprofit >= electriceelprofit && boxfishprofit >= catfishprofit && boxfishprofit >= scottfairyfishprofit && boxfishprofit >= chromisprofit && boxfishprofit >= goldendwarfprofit && boxfishprofit >= bluehippofishprofit && boxfishprofit >= pinkskunkclownfishprofit && boxfishprofit >= lolipopfishprofit && boxfishprofit >= purpletangprofit && boxfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is boxfish for $" + boxfishprofit + " a day");
            else if(scottfairyfishprofit >= greensnapperprofit && scottfairyfishprofit >= whitebunnyfishprofit && scottfairyfishprofit >= royalgrammaprofit && scottfairyfishprofit >= walrusprofit && scottfairyfishprofit >= sharkprofit && scottfairyfishprofit >= bandedbutterflyprofit && scottfairyfishprofit >= swordfishprofit && scottfairyfishprofit >= dolphinprofit && scottfairyfishprofit >= penguinprofit && scottfairyfishprofit >= electriceelprofit && scottfairyfishprofit >= boxfishprofit && scottfairyfishprofit >= catfishprofit && scottfairyfishprofit >= chromisprofit && scottfairyfishprofit >= goldendwarfprofit && scottfairyfishprofit >= bluehippofishprofit && scottfairyfishprofit >= pinkskunkclownfishprofit && scottfairyfishprofit >= lolipopfishprofit && scottfairyfishprofit >= purpletangprofit && scottfairyfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is scottfairyfish for $" + scottfairyfishprofit + " a day");
            else if(chromisprofit >= greensnapperprofit && chromisprofit >= whitebunnyfishprofit && chromisprofit >= royalgrammaprofit && chromisprofit >= walrusprofit && chromisprofit >= sharkprofit && chromisprofit >= bandedbutterflyprofit && chromisprofit >= swordfishprofit && chromisprofit >= dolphinprofit && chromisprofit >= penguinprofit && chromisprofit >= electriceelprofit && chromisprofit >= boxfishprofit && chromisprofit >= scottfairyfishprofit && chromisprofit >= catfishprofit && chromisprofit >= goldendwarfprofit && chromisprofit >= bluehippofishprofit && chromisprofit >= pinkskunkclownfishprofit && chromisprofit >= lolipopfishprofit && chromisprofit >= purpletangprofit && chromisprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is chromis for $" + chromisprofit + " a day");
            else if(goldendwarfprofit >= greensnapperprofit && goldendwarfprofit >= whitebunnyfishprofit && goldendwarfprofit >= royalgrammaprofit && goldendwarfprofit >= walrusprofit && goldendwarfprofit >= sharkprofit && goldendwarfprofit >= bandedbutterflyprofit && goldendwarfprofit >= swordfishprofit && goldendwarfprofit >= dolphinprofit && goldendwarfprofit >= penguinprofit && goldendwarfprofit >= electriceelprofit && goldendwarfprofit >= boxfishprofit && goldendwarfprofit >= scottfairyfishprofit && goldendwarfprofit >= chromisprofit && goldendwarfprofit >= catfishprofit && goldendwarfprofit >= bluehippofishprofit && goldendwarfprofit >= pinkskunkclownfishprofit && goldendwarfprofit >= lolipopfishprofit && goldendwarfprofit >= purpletangprofit && goldendwarfprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is goldendwarf for $" + goldendwarfprofit + " a day");
            else if(bluehippofishprofit >= greensnapperprofit && bluehippofishprofit >= whitebunnyfishprofit && bluehippofishprofit >= royalgrammaprofit && bluehippofishprofit >= walrusprofit && bluehippofishprofit >= sharkprofit && bluehippofishprofit >= bandedbutterflyprofit && bluehippofishprofit >= swordfishprofit && bluehippofishprofit >= dolphinprofit && bluehippofishprofit >= penguinprofit && bluehippofishprofit >= electriceelprofit && bluehippofishprofit >= boxfishprofit && bluehippofishprofit >= scottfairyfishprofit && bluehippofishprofit >= chromisprofit && bluehippofishprofit >= goldendwarfprofit && bluehippofishprofit >= catfishprofit && bluehippofishprofit >= pinkskunkclownfishprofit && bluehippofishprofit >= lolipopfishprofit && bluehippofishprofit >= purpletangprofit && bluehippofishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is bluehippofish for $" + bluehippofishprofit + " a day");
            else if(pinkskunkclownfishprofit >= greensnapperprofit && pinkskunkclownfishprofit >= whitebunnyfishprofit && pinkskunkclownfishprofit >= royalgrammaprofit && pinkskunkclownfishprofit >= walrusprofit && pinkskunkclownfishprofit >= sharkprofit && pinkskunkclownfishprofit >= bandedbutterflyprofit && pinkskunkclownfishprofit >= swordfishprofit && pinkskunkclownfishprofit >= dolphinprofit && pinkskunkclownfishprofit >= penguinprofit && pinkskunkclownfishprofit >= electriceelprofit && pinkskunkclownfishprofit >= boxfishprofit && pinkskunkclownfishprofit >= scottfairyfishprofit && pinkskunkclownfishprofit >= chromisprofit && pinkskunkclownfishprofit >= goldendwarfprofit && pinkskunkclownfishprofit >= bluehippofishprofit && pinkskunkclownfishprofit >= catfishprofit && pinkskunkclownfishprofit >= lolipopfishprofit && pinkskunkclownfishprofit >= purpletangprofit && pinkskunkclownfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is pinkskunkclownfish for $" + pinkskunkclownfishprofit + " a day");
            else if(lolipopfishprofit >= greensnapperprofit && lolipopfishprofit >= whitebunnyfishprofit && lolipopfishprofit >= royalgrammaprofit && lolipopfishprofit >= walrusprofit && lolipopfishprofit >= sharkprofit && lolipopfishprofit >= bandedbutterflyprofit && lolipopfishprofit >= swordfishprofit && lolipopfishprofit >= dolphinprofit && lolipopfishprofit >= penguinprofit && lolipopfishprofit >= electriceelprofit && lolipopfishprofit >= boxfishprofit && lolipopfishprofit >= scottfairyfishprofit && lolipopfishprofit >= chromisprofit && lolipopfishprofit >= goldendwarfprofit && lolipopfishprofit >= bluehippofishprofit && lolipopfishprofit >= pinkskunkclownfishprofit && lolipopfishprofit >= catfishprofit && lolipopfishprofit >= purpletangprofit && lolipopfishprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is lolipopfish for $" + lolipopfishprofit + " a day");
            else if(purpletangprofit >= greensnapperprofit && purpletangprofit >= whitebunnyfishprofit && purpletangprofit >= royalgrammaprofit && purpletangprofit >= walrusprofit && purpletangprofit >= sharkprofit && purpletangprofit >= bandedbutterflyprofit && purpletangprofit >= swordfishprofit && purpletangprofit >= dolphinprofit && purpletangprofit >= penguinprofit && purpletangprofit >= electriceelprofit && purpletangprofit >= boxfishprofit && purpletangprofit >= scottfairyfishprofit && purpletangprofit >= chromisprofit && purpletangprofit >= goldendwarfprofit && purpletangprofit >= bluehippofishprofit && purpletangprofit >= pinkskunkclownfishprofit && purpletangprofit >= lolipopfishprofit && purpletangprofit >= catfishprofit && purpletangprofit >= borboniusanthiasprofit)
                System.out.println("Your best choice is purpletang for $" + purpletangprofit + " a day");
            else if(borboniusanthiasprofit >= greensnapperprofit && borboniusanthiasprofit >= whitebunnyfishprofit && borboniusanthiasprofit >= royalgrammaprofit && borboniusanthiasprofit >= walrusprofit && borboniusanthiasprofit >= sharkprofit && borboniusanthiasprofit >= bandedbutterflyprofit && borboniusanthiasprofit >= swordfishprofit && borboniusanthiasprofit >= dolphinprofit && borboniusanthiasprofit >= penguinprofit && borboniusanthiasprofit >= electriceelprofit && borboniusanthiasprofit >= boxfishprofit && borboniusanthiasprofit >= scottfairyfishprofit && borboniusanthiasprofit >= chromisprofit && borboniusanthiasprofit >= goldendwarfprofit && borboniusanthiasprofit >= bluehippofishprofit && borboniusanthiasprofit >= pinkskunkclownfishprofit && borboniusanthiasprofit >= lolipopfishprofit && borboniusanthiasprofit >= catfishprofit && borboniusanthiasprofit >= purpletangprofit)
                System.out.println("Your best choice is borboniusanthias for $" + borboniusanthiasprofit + " a day");
        }
    }
    the last part is all decision on which one is the best answer to the viewer
    Last edited by Imreallyawesome; August 12th, 2011 at 06:19 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    Please edit your code and wrap it in code tags. See: BB Code List - Java Programming Forums
    or Go Advanced and use the #icon

    Are you showing off your program or do you have a question?

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    im not showing them off i coulden't get it to work it gives me wrong answers for the right type and the how much profit

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    Copy and Post the console from when you execute the program and add comments to it describing what is wrong and show what it should be.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  5. #5
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    i edited it so its easierish lol sorry that it looks like huge texts blocks i really want this to work it would help me alot

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    Copy and Post the console from when you execute the program and add comments to it describing what is wrong and show what it should be.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  7. #7
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    when i execute i get this

    Hello I(Aaron James Rasmussen) have made this program to help with your cost/time/profit deals
    How much money do you have?
    30000
    What is the maximum number of available tanks you have?
    15
    What level are you?
    17
    Your best choice is pinkskunkclownfish for $1.079E7 a day
    but it shouldn't be that because 1 i cant afford that and 2 the profit is way off if you look at the code its way off

  8. #8
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    i use BlueJ btw my school used it in teaching it has a built in compiler much faster then command prompt

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    but it shouldn't be that
    What should it be?

  10. #10
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    well i cant afford the that fish and it should be probably banded butterfly's thats what i wanted to use this for to figure out which would be the best according to how much i have and how much profit i can make depending on the fish and time

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    well i cant afford
    Can you translate that into something about your program and its output.
    For example: the programs prints out 213412 but it should print out 233.

    The rest of your post makes no sense to me.

  12. #12
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    ok the program should have said "Your best choice is bandedbutterfly for $#### a day"
    or maybe even "Your best choice is greensnpper for $#### a day"
    each fish makes different profit over different time and the best profit of course per fish would be the expensive one but you can have 50 per tank and have as many tanks per level so i made a cap to how many you could have to help me choose

  13. #13
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    im going to change how i posted it to make it more clear or at least try to sorry this is my first post

  14. #14
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    ok i changed it i hope that helped please help me figure out the problem

  15. #15
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    If the program should have said something different, that means that your logic and testing of values is wrong. To figure out what the program is doing, you need to add lots of printlns to show the values of variables as they change. Add lots of them.
    System.out.println("variable name=" + variable);

    One problem you will have is you are doing a lot of integer divisions. There is no remainder from integer divisions. For example 9/5 = 1 or 4/7 = 0

  16. The Following User Says Thank You to Norm For This Useful Post:

    Imreallyawesome (August 12th, 2011)

  17. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    If you have an interactive debugger, you need to learn how to use it. Your code has too many variables and if statements with long conditions to easily debug.

    You need to use an input that you know what the output should be for testing. Then add printlns at every point in your code where that input will cause a condition to be true. When the code doesn't work correctly the printed out values will show you where your problem is.

  18. #17
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    thanks for the info but i cant do fractional fishes so how can i get around that

  19. #18
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    would dividing them then rounding them round down? could i just do that?

  20. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    How would a merchant do it? Round up or down?

  21. #20
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    whats the uh idk what to call it for integer its .nextInt what is the double version

  22. #21
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    Look at the API doc for the class and see.
    Java Platform SE 6

  23. #22
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    alright i switched the ints for doubles and now instead of making the profit 0 if i cant afford the fish it made it 0 for levels even if i have the required level any ideas? it still gave me the pinkskunkclownfish with huge profit even tho i cant afford 1 egg

  24. #23
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    This is how you will have to do it:
    You need to use an input that you know what the output should be. Then add printlns at every point in your code where that input will cause a condition to be true and variables will be changed. When the code doesn't work correctly the printed out values will show you where your problem is.

  25. #24
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    ok i figured out where the problem is but the error doesnt make sense i do that the money you have / the cost of the fish but none of the responses make sense could you look please?

  26. #25
    Junior Member
    Join Date
    Aug 2011
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: i like to play this game with my phone and i wanted to make a program to help me

    o wow i put it backwards it all works now, woohoo! thanks for the help tho it was very kind of you to deal with me lol

Page 1 of 2 12 LastLast

Similar Threads

  1. trying to make game
    By knoxy5467 in forum Java Theory & Questions
    Replies: 3
    Last Post: June 20th, 2011, 09:26 AM
  2. anyone interested in partnering up to make a phone app?
    By pentagon in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: December 20th, 2010, 10:17 PM
  3. Trying to make Jeopardy Game
    By wbroman in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 8th, 2010, 06:40 AM
  4. hey - Mobile phone drinking game
    By pazzy in forum Java ME (Mobile Edition)
    Replies: 9
    Last Post: August 4th, 2009, 09:41 AM
  5. [SOLVED] How to start writing java mobile application?
    By Koâk in forum Java ME (Mobile Edition)
    Replies: 15
    Last Post: July 30th, 2009, 01:52 AM