Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class InfCalc
- {
- public int endos;
- public int updates;
- public int currentSPDR;
- public double SPDRatDate;
- public int lowerTI;
- public int higherTI;
- public int i;
- public InfCalc(int currentSPDR, int endos, int updates)
- {
- this.currentSPDR = currentSPDR;
- this.endos = endos;
- this.updates = updates;
- SPDRatDate = Math.sqrt(((endos +1) * updates) + (currentSPDR * currentSPDR));
- lowerTI = (currentSPDR * currentSPDR);
- higherTI = (((currentSPDR + 1) * (currentSPDR + 1)) - 1);
- i = (int)SPDRatDate;
- }
- public int getSPDR()
- {
- return i;
- }
- public int getLowerTI()
- {
- return lowerTI;
- }
- public int getHigherTI()
- {
- return higherTI;
- }
- public static void main(String args[])
- {
- char run = 'y';
- while(run == 'y'){
- Scanner scan = new Scanner(System.in);
- 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();
- InfCalc result = new InfCalc(currentSPDR, endos, updates);
- System.out.println("In " + result.updates + " updates, your SPDR will be at least " + result.getSPDR());
- System.out.print("Your current true influence range is between ");
- System.out.println( + result.getLowerTI() + " and " + result.getHigherTI());
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment