 lihp World Chat Champion
Joined: 22 Sep 2010 Karma :   
|
 Posted: 20:27 - 21 Nov 2010 Post subject: Sprocket Calculator |
 |
|
Was bored so wrote a quick Java Application to calculate new top speed with different sprockets. You'll need to know your front and rear sprocket sizes currently, and what you plan to go to, as well as relevant top speed for which ever gear you are calculating.
| Code: |
// Sprocket calculator
class Sprockets
{
public static void main (String[] args)
{
// Check correct syntax at runtime
if (args.length != 5)
{
System.out.println("Syntax: java Sprockets OrigRear OrigFront NewRear NewFront TopSpeed");
return;
}
//Set Variables and calculations
double OrigRear = Double.parseDouble(args [0]);
double OrigFront = Double.parseDouble(args [1]);
double NewRear = Double.parseDouble(args [2]);
double NewFront = Double.parseDouble(args [3]);
double TopSpeed = Double.parseDouble(args [4]);
double OrigRatio = OrigRear / OrigFront;
double NewRatio = NewRear / NewFront;
double n = OrigRatio - NewRatio;
double u = OrigRatio / TopSpeed;
double p = OrigRatio + n;
double NewTopSpeed = p / u;
int RoundedTopSpeed = (int)NewTopSpeed;
//Print Result
System.out.println ("New top speed is " + RoundedTopSpeed + " MPH.");
}
}
|
You'll need to copy and paste to a text editor save it as a *.java file and then compile and run it. It will work on all formats.
I've attached the *.class file, though it's uploaded as a *.txt you will need to rename it to *.class
You need Java Runtime Enviroment and run it from command line
Java Sprockets [original rear sprocket teeth] [original front sprocket teeth] [new rear] [new front] [top speed]
For example
Java Sprockets 59 16 59 18 60 |
|
 Acemastr World Chat Champion
Joined: 01 Oct 2008 Karma :  
|
 Posted: 20:43 - 21 Nov 2010 Post subject: |
 |
|
https://www.gearingcommander.com/
Been around for years ____________________ 2017 KTM 350 XC-F - 2014 Yamaha R6 - 2005 Yamaha YZ125
2016 Toyota Tacoma Limited |
|
 yandy_yay Brolly Dolly

Joined: 01 Aug 2008 Karma :  
|
|
 lihp World Chat Champion
Joined: 22 Sep 2010 Karma :   
|
|