daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import bowling.*;
  3. import java.io.*;
  4.  
  5. // Vi har bare én bane: Vi hadde ikke råd til mer.
  6. public class Bowling extends Game {
  7.    
  8.     String[] playerNames = new String[10];
  9.     BowlingBane bowlingBane;
  10.     ScoreCard scoreCard;
  11.    
  12.     public static void main(String[] args) throws Exception {
  13.        
  14.         // Hent inn playernames
  15.         Scanner sc = new Scanner(new InputStreamReader(System.in));
  16.         int players = 0;
  17.         String player = "";
  18.         while ((player = sc.nextLine()) != null)
  19.             playerNames[players++] = player;
  20.        
  21.         // Start opp bowlingbanen og scorecardsystemet
  22.         bowlingBane = new BowlingBane(playerNames, BowlingBane.DISCO);
  23.         card = new ScoreCard(bowlingBane.getId());
  24.        
  25.         // Game ON!
  26.         bowlingBane.start();
  27.         while (!bowlingBane.gameOver()) {
  28.             if (bowlingBane.checkPins() == BowlingBane.PINS_DOWN) {
  29.                 bowlingBane.resetPins();
  30.                 bowlingBane.sendThatBallUpPlease();
  31.                 scoreCard.logScores(bowlingBane.getRoundScores());
  32.             }
  33.         }
  34.        
  35.         // Send scores til sentralsystemet
  36.         SentralSystem.instance().offerScores(scoreCard.getScores());
  37.        
  38.         // Avslutt bowlingen
  39.         bowlingBane.reset();
  40.         System.exit();
  41.     }
  42. }
RAW Paste Data
Top