9月3学习内容


public void increment()
{
}
public int tally()
{
}
public class Counter{
  private final String name;
private int count;
public Counter(String name){
this.name = name;
count = 0;
}
public void increment(){
count++;
}
public int tally{
 return count;
public String toString(){
return name+"s count is""+count;}
}
}
}
}
public class Flips{
   public static void main (String[] args){
   int  Integer.parseInt(args [0];)
   Counter heads = new Counter ("Head");
   Counter tails = new Counter("Tail");
   for(int i = 1; i<=N; i++)
   StdRandom.bernoulli(0,5);
   heads.increment();
   else 
    tails.increment();
}
public class Flips{
   public static void main (String[] args){
   int  Integer.parseInt(args [0];)
   Counter heads = new Counter ("Head");
   Counter tails = new Counter("Tail");
   for(int i = 1; i<=N; i++)
   StdRandom.bernoulli(0,5);
   heads.increment();
   else 
    tails.increment();
    StdOut.println(heads);
    StdOut.println(tails);
}
符攀飞 符攀飞
大约 3 年前
236

扫描下方二维码手机阅读文章

0 0