Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with a program using C The question is: Write a program to check whether there is an agreement between the number and letter

Please help with a program using C

The question is: Write a program to check whether there is an agreement between the number and letter of a given NIF. The program must represent the 8 digits DNI as an integer and the letter as a different variable of char data type.

image text in transcribedimage text in transcribed

Exercise 11. DNI The DNI (Documento National de Identidad, National Identification Number) is an identification card issued to all Spanish citizens. Every citizen is assigned an 8 digit id number, the DNI number. The NIF number (Numero de identificacion Fiscal, Taxpayer ldentification Number) is a complementary i number used for income tax collection, composed by adding to the DNI and a matching letter as described below Write a program to check whether there is an agreement between the number and letter of a given NIF The program must represent the 8 digits DNI as an integer and the letter as a different variable of char data type. The program will ask the user for a DNI number and check if the value is positive and has 8 digits a the most. If these conditions are not fulfilled, a new value will be requested This has to be coded as a function that reads the DNI number and returns 1 ifthe DNI is valid, 0 otherwise After verifying that the DNI is correct, the program will ask for the letter to form the NIF, and check that the value entered is an alphabetic character (using the function isalpha, details below) and that it matches the DNI to form a valid NIF To determine the matching letter for a given DN use the already existing function calculateLetterNif available in Aula Global. In addition, you must implement a new function (verifyLetterNif that takes the letter and the number of DNI entered by the user and prints out whether the letter matches the DNI provided Notes The matching letter is computed from the remainder resulting from dividing the number b 23, according to the following table (you don't need to implement this yourself, download the function from Aula Global: Remainder 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Letter TRI W A G M Y F P D X BIN J S Q V H L C K Ed You can use following functions from the standard library ctype.h: int isalpha(int c); It returns true if the input parameter c is a letter. int toupper (int c); It returns the uppercase char corresponding to the one provided as input You can use the following code template to develop your program #include

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

Students also viewed these Databases questions

Question

16. What makes them unique? (special features of the group)

Answered: 1 week ago