Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Ticket Number Validation A ticket company is responsible for selling tickets for airlines, tours and other travel related services. Because ticket agents frequently mistype
Java
Ticket Number Validation A ticket company is responsible for selling tickets for airlines, tours and other travel related services. Because ticket agents frequently mistype long ticket numbers, the company has asked you to write a program that indicates invalid ticket number entries. The program should then check for validation using the following manner: 1. Enter a number (e.g. 123454) 2. Remove the last digit (Dropping 4 results in the value 12345) 3. Determine the remainder when the ticket number is divided by 7 (in this example, 12345 divided by 7 leaves a remainder of 4) 4. If the remainder in step 3 is identical to the dropped number, then the ticket is valid. Otherwise, the ticket is invalid. (in this example, since the dropped value 4 is identical to the remainder, then this ticket number is valid.) Samples of the output are shown below: Output 1: Enter 6-digit ticket number: 147103 The ticket number 147103 is valid. lastDigit = 3 remainder - 3 Output 2: Enter 6-digit ticket number: 154123 The ticket number 154123 is invalid. lastDigit = 3 remainder - 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started