Have solved first 8 problems. no problem, all in a day's work.
stuck on number 9.
Wednesday, June 29, 2011
Saturday, June 25, 2011
Random number generator resulted in that I should learn sql. I changed the default workspace in the eclipse.
New set of files to work with, will upload code, and will look back on to optimize the code for returning the getName function.
package decisionrandom;
import java.util.Random;
import java.util.ArrayList;
public class Randomm {
static int weight;
static String name;
static int totval = 0;
static ArrayList<Randomm> total = new ArrayList<Randomm>();
static Randomm alg = new Randomm(30,"algorithms");
static Randomm PHP = new Randomm(5,"PHP");
static Randomm Javascript = new Randomm(5,"Javascript");
static Randomm sql = new Randomm(5,"SQL");
Random rand = new Random();
public static void loop(){
for(int i=0;i<total.size();i++){
totval += getWeight(total.get(i));
}
}
public Randomm(int i1,String s1){
weight = i1;
name = s1;
}
public static int getWeight(Randomm r1){
return weight;
}
public static String getName(Randomm r1){
return name;
}
public static String checker(){
if(totval <= 30)
return(getName(alg));
else if(totval<=35)
return(getName(PHP));
else if(totval<=40)
return(getName(Javascript));
else if(totval<=45)
return(getName(sql));
else
return("noresult");
}
public static void main(String[] args){
total.add(alg);
total.add(PHP);
total.add(Javascript);
total.add(sql);
loop();
System.out.println(checker());
}
}
New set of files to work with, will upload code, and will look back on to optimize the code for returning the getName function.
package decisionrandom;
import java.util.Random;
import java.util.ArrayList;
public class Randomm {
static int weight;
static String name;
static int totval = 0;
static ArrayList<Randomm> total = new ArrayList<Randomm>();
static Randomm alg = new Randomm(30,"algorithms");
static Randomm PHP = new Randomm(5,"PHP");
static Randomm Javascript = new Randomm(5,"Javascript");
static Randomm sql = new Randomm(5,"SQL");
Random rand = new Random();
public static void loop(){
for(int i=0;i<total.size();i++){
totval += getWeight(total.get(i));
}
}
public Randomm(int i1,String s1){
weight = i1;
name = s1;
}
public static int getWeight(Randomm r1){
return weight;
}
public static String getName(Randomm r1){
return name;
}
public static String checker(){
if(totval <= 30)
return(getName(alg));
else if(totval<=35)
return(getName(PHP));
else if(totval<=40)
return(getName(Javascript));
else if(totval<=45)
return(getName(sql));
else
return("noresult");
}
public static void main(String[] args){
total.add(alg);
total.add(PHP);
total.add(Javascript);
total.add(sql);
loop();
System.out.println(checker());
}
}
<p> algorithms for programming or internet access/database work, php, sql, more extensive HTML and javascript. not sure </p>
planning on programming a temporary random number generator, assigning weights to all of the values, and determining my next course of action. of course, this is with the knowledge that the PRNG in the JAVA library is predetermined, but it should be sufficient for my purpose.
planning on programming a temporary random number generator, assigning weights to all of the values, and determining my next course of action. of course, this is with the knowledge that the PRNG in the JAVA library is predetermined, but it should be sufficient for my purpose.
Subscribe to:
Posts (Atom)