1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elixir [45]
2 years ago
5

Write a lottery program that will ask the user if they would like to pick 5 numbers (1-30) or if they would like to choose EZ Pi

ck where the computer randomly picks their 5 numbers at a cost of $1.00. Then you will give them a chance to also play the Next Chance drawing for an extra $1.00. They do not choose additional numbers for the Next Chance drawing. Once they have all of their selections complete, have the computer game generate the five random winning numbers and if they opted for the Next Chance drawing, select 4 more random numbers. Display all of the users numbers, all of the winning numbers, and display how much, if any, that the player has won based on the following information:
Computers and Technology
1 answer:
Llana [10]2 years ago
6 0

Answer:

Explanation:

The following code is written in Python and creates arrays for the user's numbers and the next chance numbers, it also creates a cost variable and a did_you_win variable. The function takes in the winning numbers as an array parameter. It asks all the necessary questions to generate data for all the variables and then compares the user's numbers to the winning numbers in order to detect if the user has won. Finally, it prints all the necessary information.

import random

def lottery(winning_numbers):

   user_numbers = []

   next_chance_drawing = []

   cost = 0

   did_you_win = "No"

   #print("Would you like to choose your own 5 numbers? Y or N")

   answer = input("Would you like to choose your own 5 numbers? Y or N: ")

   if answer.capitalize() == "Y":

       for x in range(5):

           user_numbers.append(input("Enter number " + str(x+1) + ": "))

   else:

       for x in range(5):

           user_numbers.append(random.randint(0,31))

           cost += 1

   next_chance = input("Would you like to enter a Next Chance drawing for $1.00? Y or N: ")

   if next_chance.capitalize() == "Y":

       for x in range(4):

           next_chance_drawing.append(random.randint(0, 31))

           cost += 1

           

   if user_numbers == winning_numbers or next_chance_drawing == winning_numbers:

       did_you_win = "Yes"

   print("User Numbers: " + str(user_numbers))

   print("Next Chance Numbers: " + str(next_chance_drawing))

   print("Cost: $" + str(cost))

   print("Did you win: " + did_you_win)

You might be interested in
You are to calculate the property tax for tax payers. You will ask the county tax clerk if they want to run the program and init
andre [41]

Answer:

Explanation:

The following code is written in Java. It creates the loop as requested and validates the information provided before continuing, if the information is invalid it prints "Invalid Information to the screen" and asks the user to enter the information again. Finally, outputing all the requested information at the end of the program. The code has been tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int totalValues = 0;

       int totalTaxes = 0;

       int count = 0;

       while(true) {

           int lotNumber, value;

           double tax;

           System.out.println("Would you like to add an Entry: 1=Yes 0=No");

           int answer = in.nextInt();

           if (answer == 1) {

               System.out.println("Please enter lot number: ");

               lotNumber = in.nextInt();

               if ((lotNumber >= 0) && (lotNumber <= 999999)) {

                   System.out.println("Please enter assessed value: ");

                   value = in.nextInt();

                   tax = value * 0.05;

                   System.out.println("Lot Number: " + lotNumber);

                   System.out.println("Property Value: " + value);

                   System.out.println("Property Tax: " + tax);

                   totalTaxes += tax;

                   totalValues += value;

                   count += 1;

               } else {

                   System.out.println("Invalid Lot Number");

               }

           } else {

               break;

           }

       }

       int average = totalTaxes / count;

       System.out.println("Total Property Values: " + totalValues);

       System.out.println("Total Property Taxes: " + totalTaxes);

       System.out.println("Average Property Tax" + average);

   }

}

8 0
2 years ago
How did mechanical clocks assist in completing work? How was work done previously?
lozanna [386]

Answer

Timekeeping has been a part of society since Ancient Egypt. The use of spring-powered mechanisms allowed clocks to be made smaller ... Essentially, the church bells and the mechanical clock now became the monitor of the working day.

Explanation:

4 0
2 years ago
Does the sticker list an automatic or manual transmission?
pantera1 [17]
Automatic, three speed transmission
5 0
3 years ago
Read 2 more answers
Which statement is true regarding Artificial Intelligence (AI)?
Effectus [21]
Data is the fundamental reason AI succeeds or fails.
This statement is true regarding Artificial Intelligence (AI)
6 0
2 years ago
Press ____ to select the entire worksheet.<br> F1<br> F4<br> ALT+A<br> CTRL+A
andreev551 [17]
<span>The answer is CTRL + A, this selects whole worksheet (A means all). In computing, a Control key is a transformer key which, when pushed in combination with one more key, achieves a singular operation (for example, Ctrl + A; like the Shift key, the Control key infrequently achieves any purpose when pushed by itself.</span>
5 0
3 years ago
Other questions:
  • A level breach of security could be expected to have a severe or catastrophic adverse effect on organizational operations, organ
    12·1 answer
  • This is going to get taken down but I dont care add me on discord cause ima bored<br> -Red-#9847
    12·1 answer
  • Write a Java program that prompts the user to enter a sequence of non-negative numbers (0 or more), storing them in an ArrayList
    5·1 answer
  • Which of the following is used to move to end of the row?​
    8·1 answer
  • Select the correct answer.
    12·2 answers
  • What do you hope that people see in your digital footprint 5 years from now? ​
    5·1 answer
  • Need answer ASAP. I’ll mark brainliest if correct
    7·1 answer
  • Determine what is printed by the following code.
    8·1 answer
  • B) The company's chief financial officer recognizes the need for an upgrade to the smart watches, but does not understand why th
    8·1 answer
  • [2]<br> (c) Describe how the microprocessor can determine when to sound the clock alarm.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!