Quiz 2

Please write your name and lab section letter at the top of the page.

  1. A certain football team in St Louis has scored t touchdowns (worth 6 points apiece; t is much smaller than the fans would like), gotten p "points after" (worth 1 point apiece), and successfully scored on f field goals (worth 3 points apiece). In football, a team can score a "point after" only after a touchdown.

    Fill in the following method to compute the team's score:

      public int score(int t, int p, int f) {
    
         if ( /* your answer on paper for what goes here */ )
             Transcript.println("You can't have that many points after");
    
         return  /*  your answer on paper for what goes here */   ;
      }
    
  2. A certain hockey team in St Louis has played 5 games: g1, g2, g3, g4, and g5 are the scores of those games. Fill in the method below to compute their average score for the 5 games:
      double average(int g1, int g2, int g3, int g4, int g5) {
    
          return  /*  your answer on paper for what goes here */   ;
    
      }