Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives Practice for-loop You are hired by an educational software company to write a Java program to use a so-called check sum technique for catching

image text in transcribed

Objectives Practice for-loop You are hired by an educational software company to write a Java program to use a so-called check sum technique for catching typing errors of student ID that is an n-digit number. This company sells services to colleges who need to validate student IDs whose number of digits, n, vary in different colleges depending on the size of student population. The last digit (i.e., the rightmost digit), called checksum digit, is always used for validity check. Take XYZ College as an example, it assigns a seven digit number to each student. The seventh digit (i.e., the rightmost digit) is determined from the other digits with the use of the following formula 7th digits (1 * (1st digit) + 2 * (2nd digit) + + 6 * (6th digit)) % 10 Your program should prompt users to enter an n-digit number as a student ID, and then display the validity of the entered ID. You can assume n will be in the range of 6 and 10 inclusive. The checksum digit is part of student ID. Your algorithm is to match the rightmost digit in the entered ID with the computed checksum digit. If there is no match, then your program shall report the entered ID being invalid For example, the entered ID 1234567 is invalid because the computed 7th digit is 1 ( (1 1 + 2 * 2 + 3 * 3 + 4 * 4 + 5 * 5 + 6 * 6) % 10) and is different from the actual 7th digit which is 7. However, if the entered ID is 1234561 your program shall display a message of acceptance User interface specifications: . Input The program prompts for a student ID. You can assume users will enter n consecutive digital characters where 6 Sn s 10 o "The data input line is immediately below the prompt message line. In other words, after the prompt message is displayed, your program should force users to enter a student ID on a new line immediately below the prompt message. Output o Display a message to report the validity of the entered student ID. The output should be descriptive and friendly to end users. Code specifications .The header comment lines at the top of the file contain a brief description of the program. The description should be one or 2 lines long describing the purpose of the program . Use descriptive variable name(s)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions