EricJohnson

statistics

Jun 1st, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Statistics{
  2.     public int setTtlTime(int gametime){
  3.         int ttltime=0;
  4.         ttltime+=gametime;
  5.         return ttltime;
  6.     }
  7.    
  8.     public void getttltime(){
  9.     }
  10.    
  11.     public int setTtlHits(int shiphits){
  12.         int ttlhits=0;
  13.         ttlhits+=shiphits;
  14.         return ttlhits;
  15.     }
  16.    
  17.     public void getTtlHits(){
  18.     }
  19.     //use insertion sort
  20.     public int setHitMiss(int hitmiss[]){
  21.             int in=0, out=0;
  22.             int temp=0;
  23.             for(out=1; out<in; out++)   // out is dividing line
  24.             {
  25.                 temp = hitmiss[out];    // remove marked item
  26.                 in = out;           // start shifts at out
  27.                 while(in>0 && hitmiss[in-1] >= temp) // until one is smaller,
  28.                 {
  29.                     hitmiss[in] = hitmiss[in-1];      // shift item right,
  30.                     --in;            // go left one position
  31.                 }
  32.                 hitmiss[in] = temp;  
  33.                 // insert marked item
  34.             }
  35.             return temp;// end for
  36.     }
  37.    
  38.    
  39.     public void getAvgHitMiss(){
  40.     }
  41.    
  42.     public int setHighestScore(int highscore){
  43.         int temp=0;
  44.         temp=highscore;
  45.         if (highscore<temp){
  46.             highscore=temp;}
  47.         return highscore;
  48.     }
  49.    
  50.     public void getHighestScore(){
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment