SRL Archive - Archive

Blazefree - SRL Member Application


Blazefree

2012-02-25 18:12:39

How Long have You Played Runescape?
7 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
Java
Matlab


Are you a member of any other communities?
No


Tell us about yourself…
From: Blazefree
I'm a Junior in college studying Computer Engineering and Software Development. I enjoy writing music, playing guitar, singing, watching NHL, NFL, NCAAB. I've played RS since 2005 and I still play to this day.



Please show us one (or multiple) of your scripts.
Finding the date:

import java.util.*;

public class MyDate {
private int day, month, year;

//Constructors
private MyDate() {
// get the current date string Thu Mar 17 08:07:52 GMT-05:00 2011
String s = new java.util.Date(System.currentTimeMillis()).toString();
String a[] = s.split(" ");

day = new Integer(a[2]);

year = new Integer(a[5]);



if(a[1].equals("Jan"))
month = 1;
else if(a[1].equals("Feb"))
month = 2;
else if(a[1].equals("Mar"))
month = 3;
else if(a[1].equals("Apr"))
month = 4;
else if(a[1].equals("May"))
month = 5;
else if(a[1].equals("Jun"))
month = 6;
else if(a[1].equals("Jul"))
month = 7;
else if(a[1].equals("Aug"))
month = 8;
else if(a[1].equals("Sep"))
month = 9;
else if(a[1].equals("Oct"))
month = 10;
else if(a[1].equals("Nov"))
month = 11;
else if(a[1].equals("Dec"))
month = 12;
// ...
}

public MyDate(String s){
//String[] a = s.split(" ");
//return a[1] + " " + a[2] + ", " + a[5];
String months, days, years;
int w = s.indexOf(' ');
months = s.substring(0, w-1);
int p = s.indexOf(' ',w+1);
days = s.substring(w+1,p);
years = s.substring(p+1, s.length()-1);


}

public MyDate(int m,int d,int y){
this.month = m;
this.day = d;
this.year = y;
}

//Getter Methods
public MyDate(MyDate md){
day = md.getDay();
month = md.getMonth();
year = md.getYear();
}
public int getMonth(){
return this.month;
}
public int getDay(){
return this.day;
}
public int getYear(){
return this.year;
}

//Instance Methods (other)
public String toString(){
return new String(month+"/"+day+"/"+year);
}
public boolean equals(Object o){
boolean m,d,y;
MyDate a = new MyDate((MyDate)o);
if (a.getMonth() == this.getMonth())
m = true;
else
m = false;
if (a.getDay() == this.getDay())
d = true;
else
d = false;
if (a.getYear() == this.getYear())
y = true;
else
y = false;
return d && m && y;

}
public int compareTo(Object o){
int result = -99;

MyDate a = new MyDate((MyDate)o);
if (this.year != year)
{
if (this.year > year)
result = 0;
else
result = -1;
}
else if (this.month != month)
{
if (this.month > month)
result = 0;
else result = -1;
}
else
{
if (this.day > day)
result = 0;
else if (this.day < day)
result = 0;
else
result = 0;
}
return result;
}


//Class Method (other)
public static void main(String[] args){

String md = new java.util.Date(System.currentTimeMillis()).toString();

MyDate[] myarray = new MyDate[3];
myarray[1] = new MyDate(5,12,1993);
myarray[2] = new MyDate(2,2,2011);

String[] j = md.split(" ");
for(String t :j){
}
String m = j[1];
String d = j[2];
String y = j[5];

System.out.println(m+" "+d+","+y);
for(int i = 0; i < myarray.length; i++)
System.out.println(myarray[i]);
System.out.println(myarray[1].compareTo(myarray[2]));

}
}




Math program

import java.util.*;
public class Calling
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Declarations
double a, b, c, discr, root1, root2;
//Input a,b,c
System.out.println("Enter value a, b, and c");
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
discr = Math.sqrt((b*b)-(4*a*c));
if(discr == 0)
{
System.out.println("The equation has one repeated root");
root1 = ((-b + discr)/2*a);
System.out.println("Root = " + root1);
}
else if(discr > 0)
{
System.out.println("Then the equation has two real roots");
root1 = ((-b + discr)/2 * a);
root2 = ((-b - discr)/2 * a);
System.out.println("Root 1 = " + root1);
System.out.println("Root 2 = " + root2);
}
else
System.out.println("The equation has two complex roots");
}
}




Clock


//object ADT
// ----Abstract Data Type
//Calendar day "State"
public class Clock extends Object {

private int hours, minutes, seconds;

public Clock() {
}

public Clock(int hours, int minutes, int seconds) {
this.hours = hours;
this.minutes = minutes;
this.seconds = seconds;
}

public void incrementSeconds() {
seconds++;
if(seconds >= 60) {
seconds = 0;
incrementMinutes();
}
}

public void incrementMinutes() {
minutes++;
if(minutes >= 60) {
minutes = 0;
incrementHours();
}
}

public void incrementHours() {
hours++;
if(hours >= 24) {
hours = 0;
}
}
public void pause(){
int totalSec = hours * 60 * 60 + minutes * 60 + seconds;
try{
Thread.sleep(totalSec *1000);
} catch(InterruptedException e){
e.printStackTrace();
}
}

public String toString() {
return String.format("%d:%d:%d", hours, minutes, seconds);
}

}

Hobbit

2012-02-25 18:16:10

Sorry, we only accept scripts written for Simba that use SRL.

Please read some tutorials and try again in a few weeks :)
http://villavu.com/forum/forumdisplay.php?f=95

Cheers
Hobbit