Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- A program that allows NationStates players to calculate
- their regional influence levels in the future using
- current data. Some goodies for the raiders included ;)
- @auth Ambroscus Koth
- @vers 2.0
- @date 12/03/13
- */
- import java.util.ArrayList;
- import java.util.Scanner;
- public class InfCalc2
- {
- private String name;
- private int endos;
- private int updates;
- private int currentSPDR;
- private double SPDRatDate;
- private int lowerRI;
- private int higherRI;
- private double lowerRIatDate;
- private double higherRIatDate;
- private int lowerBR;
- private int higherBR;
- private double lowerBRatDate;
- private double higherBRatDate;
- private int caster1;
- private int caster2;
- private int caster3;
- private int caster4;
- private int caster5;
- public InfCalc2(String name, int currentSPDR, int endos, int updates)
- {
- this.name = name;
- this.currentSPDR = currentSPDR;
- this.endos = endos;
- this.updates = updates;
- SPDRatDate = Math.sqrt(((endos +1) * updates) + (currentSPDR * currentSPDR));
- caster1 = (int)SPDRatDate;
- lowerRI = (currentSPDR * currentSPDR);
- higherRI = (((currentSPDR + 1) * (currentSPDR + 1)) - 1);
- lowerRIatDate = (SPDRatDate * SPDRatDate);
- higherRIatDate = (((SPDRatDate + 1) * (SPDRatDate + 1)) - 1);
- caster2 = (int)lowerRIatDate;
- caster3 = (int)higherRIatDate;
- lowerBR = lowerRI * 2;
- higherBR = higherRI * 2;
- lowerBRatDate = lowerRIatDate * 2;
- higherBRatDate = higherRIatDate * 2;
- caster4 = (int)lowerBRatDate;
- caster5 = (int)higherBRatDate;
- }
- public String getName()
- {
- return name;
- }
- public int getSPDR()
- {
- return caster1;
- }
- public int getLowerRI()
- {
- return lowerRI;
- }
- public int getHigherRI()
- {
- return higherRI;
- }
- public int getLowerRIatDate()
- {
- return caster2;
- }
- public int getHigherRIatDate()
- {
- return caster3;
- }
- public int getLowerBR()
- {
- return lowerBR;
- }
- public int getHigherBR()
- {
- return higherBR;
- }
- public int getLowerBRatDate()
- {
- return caster4;
- }
- public int getHigherBRatDate()
- {
- return caster5;
- }
- public static void main(String args[])
- {
- ArrayList<InfCalc2> victims = new ArrayList<InfCalc2>();
- char run = 'y';
- while(run == 'y')
- {
- System.out.println("What do you want to do?");
- System.out.println(" 1. Just one nation calculation, please!");
- System.out.println(" 2. Invader Mode: Add many nations!");
- System.out.println(" 3. Invader Mode: Show me who I can banject!");
- System.out.println(" 4. Get me outta here!");
- Scanner scan = new Scanner(System.in);
- int num = scan.nextInt();
- if(num > 4 || num < 0)
- {
- System.out.println("ERROR: You're retarded, please try again.");
- }
- if(num == 1)
- {
- String name = null;
- System.out.println("Enter your current SPDR.");
- int currentSPDR = scan.nextInt();
- System.out.println("Enter your current number of endorsements.");
- int endos = scan.nextInt();
- System.out.println("Enter the number of updates.");
- int updates = scan.nextInt();
- InfCalc2 result = new InfCalc2(name, currentSPDR, endos, updates);
- System.out.println("In " + result.updates + " updates, your SPDR will be at least " + result.getSPDR());
- System.out.print("RI Range: ");
- System.out.println( + result.getLowerRI() + " to " + result.getHigherRI());
- System.out.print("Future RI Range: ");
- System.out.println( + result.getLowerRIatDate() + " to " + result.getHigherRIatDate());
- System.out.print("Banjection Range: ");
- System.out.println( + result.getLowerBR() + " to " + result.getHigherBR());
- System.out.print("Future Banjection Range: ");
- System.out.println( + result.getLowerBRatDate() + " to " + result.getHigherBRatDate());
- Scanner input = new Scanner(System.in);
- System.out.print("Would you like to do another calculation? ");
- System.out.println("y/n");
- run = input.nextLine().charAt(0);
- }//end case 1
- if(num == 2)
- {
- char moreNations = 'y';
- while(moreNations == 'y')
- {
- System.out.println("Enter the nation name.");
- String name = scan.next();
- System.out.println("Enter the nation's current SPDR.");
- int currentSPDR = scan.nextInt();
- System.out.println("Enter the nation's current number of endorsements.");
- int endos = scan.nextInt();
- System.out.println("Enter the number of updates.");
- int updates = scan.nextInt();
- InfCalc2 result = new InfCalc2(name, currentSPDR, endos, updates);
- victims.add(result);
- Scanner input = new Scanner(System.in);
- System.out.print("Would you like to add another nation? ");
- System.out.println("(y/n)");
- moreNations = input.nextLine().charAt(0);
- }
- }//end case 2
- if(num == 3)
- {
- for(int v = 0; v < victims.size(); v++)
- {
- InfCalc2 theDevoured = victims.get(v);
- String victimName = theDevoured.getName();
- int victimSPDR = theDevoured.getSPDR();
- int victimLowerRIatDate = theDevoured.getLowerRIatDate();
- int victimHigherRIatDate = theDevoured.getHigherRIatDate();
- int victimLowerBRatDate = theDevoured.getLowerBRatDate();
- int victimHigherBRatDate = theDevoured.getHigherBRatDate();
- System.out.println("Nation: " + victimName);
- System.out.println("SPDR: " + victimSPDR);
- System.out.println("Real Influence Range: " + victimLowerRIatDate + " to " + victimHigherRIatDate);
- System.out.println("Banjection Range: " + victimLowerBRatDate + " to " + victimHigherBRatDate);
- System.out.printf("\n===================== \n \n");
- }
- }//end case 3
- if(num == 4)
- {
- System.out.println("Whatever you say, kiddo.");
- System.exit(1);
- }//end case 3
- }//end while loop "run"
- }//end main
- }//end class
Advertisement
Add Comment
Please, Sign In to add comment