Purchase Solution

Ticket Number Validator

Not what you're looking for?

Ask Custom Question

Write a Java application that indicates invalid ticket number entries. It prompts a ticket agent to enter a six-digit ticket number. Ticket numbers are designed so that if you drop the last digit of the number, then divide the number by 7, the remainder of the division will be identical to the last dropped digit.

Purchase this Solution

Solution Summary

Well commented, easy to understand implementation, that also handles negative number input. Few sample sessions are also provided that test different aspects of the logic.

Solution Preview

Please rename attached 438995-Ticket.java to Ticket.java before compiling and running it.

Few sample sessions with the program are pasted below.

> java Ticket
Enter a 6-digit positive ticket number : 999924
Ticket number is VALID.

> java Ticket
Enter a 6-digit positive ticket number : 9999992
Ticket number not a 6-digit positive number!

> java Ticket
Enter a 6-digit positive ticket number : 99999
Ticket number not a 6-digit positive number!

> java Ticket
Enter a 6-digit positive ticket number : -999924
Ticket number not a 6-digit positive ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C# variables and classes

This quiz contains questions about C# classes and variables.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Javscript Basics

Quiz on basics of javascript programming language.