I felt the need to do Java some justice. :)
#Java - 486 437 421 414
Java - 486 437 421 414
Golfed
import java.util.*;class GuessANumber{static<T>void p(T p){System.out.println(p);}static int i(){return new Scanner(System.in).nextInt();}public static void main(String[]a){int c,g,f=101,i=0;p("Pick (1) or guess (2)?");c=i();if(c==1)p("Pick a number (1-100)");g=c==1?i():new Random().nextInt(100);while(f!=g&&i++<5){p("Guess:");f=c==2?i():f>g?f/2:f+f/2;if(c==1)p(f);p(f>g?"lower":"higher");}if(f==g)p("correct");}}
Slightly Ungolfed
import java.util.*;
class a{
static<T>void p(T p){
System.out.println(p);
}
static int i(){
return new Scanner(System.in).nextInt();
}
public static void main(String[]a){
int c,g,f=101,i=0;
p("Pick (1) or guess (2)?");
c=i();
if(c==1)p("Pick a number (1-100)");
g=c==1?i():new Random().nextInt(100);
while(f!=g&&i++<5){
p("Guess:");
f=c==2?i():f>g?f/2:f+f/2;
if(c==1)p(f);
p(f>g?"lower":"higher");
}
if(f==g)p("correct");
}
}