Instructions
Good news! You have are nearly finished with the semester! Today’s problem is going to be to modify a program to match the actual check used to verify Social Insurance Numbers.
Don’t worry, the first part of the solution has been taken care of for you. You just need to modify it to also check the bits in BOLD font.
Update the validateSIN() function to reflect that modification.
Details
Input
Processing
Output
Sample input/output:
| Input | Output |
| 181-111-212 |
SIN: 181-111-212 |
|
974-432-432 |
SIN: 974-432-432 |
There is given code
def validateSIN ( sin ):
"""
FUNCTION: sumPostCodeNumbers( string) -> boolean
Args:
@param sin (str): containing the SIN of form "999-999-999"
Returns:
@return boolean: True if valid SIN, False otherwise
"""
checkSum = 0
isValid = False
sin = sin.replace("-", "")
for i in range(9) :
multiplier = 1 + i % 2
digit = int( sin[i] )
numberToAdd = digit * multiplier
checkSum += numberToAdd
if checkSum % 10 == 0 :
isValid = True
return isValid
#=========================================================================
# PLEASE END YOUR WORK HERE
#=========================================================================
def main() :
SIN = input()
sinIsValid = validateSIN(SIN)
print("SIN: " + SIN)
if sinIsValid :
print("VALID")
else :
print("-INVALID-")
return
#-----------------#
# Body of program #
#-----------------#
main()
def validateSIN(sin):
"""
FUNCTION: sumPostCodeNumbers( string) -> boolean
Args:
@param sin (str): containing the SIN of form "999-999-999"
Returns:
@return boolean: True if valid SIN, False otherwise
"""
sin = sin.replace('-', '')
total = 0
for i in range(len(sin)):
n = int(sin[i])
if i % 2 == 1:
n *= 2
total += (n // 10) + (n % 10)
return total % 10 == 0
# =========================================================================
# PLEASE END YOUR WORK HERE
# =========================================================================
def main():
SIN = input()
sinIsValid = validateSIN(SIN)
print("SIN: " + SIN)
if sinIsValid:
print("VALID")
else:
print("-INVALID-")
return
# -----------------#
# Body of program #
# -----------------#
main()

Instructions Good news! You have are nearly finished with the semester! Today’s problem is going to...
Instructions In this problem, you will update the declaration for a function called validateSIN (), using the@paran and @re turn COmments and write the appropriate code for the function to check if a given SIN is valid or not You can test to see if a SIN is valid by using the following calculation. (WARNING: While this Is similiar to the ISBN validation calculation, It Is not the same. There are several differences] Remove hyphens so just digits remain ultiply...
Program Set 2 10 points) Credit card number validation Program Credit card numbers follow certain patterns: It must have between 13 and 16 digits, and the number must start with: 4 for Visa cards 5 for MasterCard credit cards 37 for American Express cards 6 for Discover cards In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. The algorithm is useful to determine whether a card number is entered correctly or whether a credit card...
For this portion of the lab, you will reuse the program you wrote before That means you will open the lab you wrote in the previous assignment and change it. You should NOT start from scratch. Also, all the requirements/prohibitions from the previous lab MUST also be included /omitted from this lab. Redesign the solution in the following manner: 1. All the functions used are value-returning functions. 2. Put the functions in an external module and let the main program...
Instructions We will carry on working with functions! Once more, all input and output has been taken care of for you. All you need to do is finish off the function tableMin that finds the minimum value within a table (2-D list). Details Input Input has been handled for you the list has been populated. It reads in N as well as the data needed to fill an NxN integer table. Processing Complete the tableMin function. Note that you have...
Given java code is below, please use it!
import java.util.Scanner;
public class LA2a {
/**
* Number of digits in a valid value sequence
*/
public static final int SEQ_DIGITS = 10;
/**
* Error for an invalid sequence
* (not correct number of characters
* or not made only of digits)
*/
public static final String ERR_SEQ = "Invalid
sequence";
/**
* Error for...
/***************************************************
Name:
Date:
Homework #7
Program name: HexUtilitySOLUTION
Program description: Accepts hexadecimal numbers as input.
Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE
Enter BYE (case insensitive) to exit the program.
****************************************************/
import java.util.Scanner;
public class HexUtilitySOLUTION {
public static void main(String[] args) {
// Maximum length of input string
final byte INPUT_LENGTH = 4;
String userInput = ""; // Initialize to null string
Scanner input = new Scanner(System.in);
// Process the inputs until BYE is entered
do {...
You are going to write a method (to be called validateBoard) that is going to validate whether or not a Tic-Tac-Toe board is possible. Tic- Tac-Toe is played on a 3 x 3 board and players take turns placing either an x or an o on the board. We will assume that in Tic-Tac-Toe the player placing x will go first arld that o will go second. (Learn more about the game here) As the player placing x pieces goes...
write programs with detailed instructions on how to
execute.
code is java
What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...
Course Class Create a class called Course. It will not have a main method; it is a business class. Put in your documentation comments at the top. Be sure to include your name. Course must have the following instance variables named as shown in the table: Variable name Description crn A unique number given each semester to a section (stands for Course Registration Number) subject A 4-letter abbreviation for the course (e.g., ITEC, PHED, CHEM) number A 4-digit number associated...
Banks issue credit cards with 16 digit numbers. If you've never thought about it before you may not realize it, but there are specific rules for what those numbers can be. For example, the first few digits of the number tell you what kind of card it is - all Visa cards start with 4, MasterCard numbers start with 51 through 55, American Express starts with 34 or 37, etc. Automated systems can use this number to tell which company...