# 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)
Get the answer
Category: computerinformation |
Author: Giiwedin Frigyes
Related Questions
# of pens cost of box 12- $25 50- $ ? 100- $175 the partially filled

# of protons # of neutrons # of electrons atomic number mass number 1

# starter. py '' draw random "art" in a mondrian style ''' import tur

Category
womensstudies
#!/bin/python3 import sys import os #write detecter implementation #write isin implementation #write closure function implementation for detect30 and
business
#!/bin/python3 import sys import os #write detector implementation #write isin implementation #write closure function implementation for detect30 and
ecology
##python##spiral_matrix(rows: int, cols: int, start: int) -> staticarray: no python built-in functions. only use the pre-defined staticarray class