# Script to translate into Java for Project 4 import random class LottoSelection: # num_balls is the total number of balls # available for drawing with replacement # num_draws is the number of balls that are # drawn, typically 4, 5, or 6. def __init__(self, num_balls, num_draws): self.num_balls = num_balls if num_draws > 6: self.num_draws = 6 else: self.num_draws = num_draws self._balls = [0, 0, 0, 0, 0, 0] def __str__(self): output = '' for i in range(0, self.num_draws): output += str(self._balls[i]) + ' ' return output def draw_balls(self): for i in range(0, self.num_draws): self._balls[i] = \ random.randrange(self.num_balls) # main script lotto = LottoSelection(20, 5) lotto.draw_balls( ) print(lotto) lotto.num_draws = 6 lotto.num_balls = 30 lotto.draw_balls( ) print(lotto)