Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This code is supposed to do a simple lottery matching: 1. User inputs a 4-digit lottery ticket. 2. If the ticket matches the 4

This code is supposed to do a simple lottery matching: 1. User inputs a 4-digit lottery ticket. 2. If the ticket matches the 4 digits of the winning number, print out a message that reads 1st Prize! . 3. If the ticket matches only 3 digits of the winning number, print out a message that reads 2nd Prize! . 4. If the ticket matches only 2 digits of the winning number, print out a message that reads 3rd Prize! . 5. In all other cases, print out a message that reads: No Prize! Better luck next time! The digits have to match in both number and position. For example, if the winning number i 1234 , the lottery ticket 1534 would be a 2nd Prize winner, but the ticket 5134 would be a 3rd Prize winner. Ticket 3415 has all the digits but in a different position from the original, so it would be a losing ticket. Your objective is to write code that checks the numbers and prints out the correct message. The existing code must not be changed and includes the winning ticket number, and code that takes the user's input. Your code must be written after the line that reads //TODO: Your code goes here . Make sure to comment your code to make clear what you intend to do with it!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here I use rand for generate lottery ticket and validate user inp... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial Accounting An Integrative Approach

Authors: C J Mcnair Connoly, Kenneth Merchant

2nd Edition

099950049X, 978-0999500491

More Books

Students also viewed these Accounting questions

Question

Have we identified actionable first steps?

Answered: 1 week ago

Question

What are the primary steps in doing an incremental analysis?

Answered: 1 week ago