Assignment-2 Solution

$30.00

Description

Question1

Suppose that you have a text file named contacts.txt listing name (maximum 15

characters), last name (maximum 15 characters) and birth date (in the format

dd.mm,yyyy) of people. We do not know how many records are given in that text

file but we know that there are at most 100 records in that file. A sample text file

is provided below.

contacts.txt

PATRICIA JOHNSON 01022000

LINDA WILLIAMS 02041980

BARBARA BROWN 09011995

ELIZABETH JONES 29051960

JENNIFER MILLER 15081985

MARIA DAVIS 19061999

Write a C program and:

Create a structure named date, to store day, month and year of the date.

Create another structure named contact to store each persons name,

lastname and birth date information.

Write a function named loadContact to read all records of the text file

contacts.txt in an appropriate way.

Your main program should then list all contacts whose age is in between 18

and 25 in the format provided in sample run below.

Sample run for the given input file:

P. JOHNSON, 18

B. BROWN, 23

M. DAVIS, 19

Question-2

Write a C program to implement an encryption algorithm described below. In this

encryption technique, each letter of a given input word is replaced by a letter

some fixed number of positions down the alphabet.

Image missing

Your program will input a word and an integer value as input values. The integer value indicates the number of position each letter of the word has been moved down. You are given the following sample runs as examples.

Sample Run1

Enter a word: computer

Enter a number: 4

Encrypted text: gsqtyxiv

Sample Run2

Enter a word: ZOEY

Enter a number: 4 Encrypted text: DSIC

Sample Run3

Enter a word: CScience Enter a number: 5 Encrypted text: HXhnjshj

How to submit

Please also use the following file format while naming the zip file:

LastNameFirstnameX_Y.zip where LastNameFirstname is your last name with the first letter in capital, followed by your first name with the first letter in capital; the X is the course code; the Y is the assignment #. (ex: SerceFatmaCS351_2.zip)

Upload the zip file to CANVAS.

How to evaluate

Your program should

meet the requirements as shown in sample runs

include comments to explain your program

be easy to follow

work for all possible inputs

include proper input and output messages