SlideShare a Scribd company logo
1 of 14
Download to read offline
Here is support files
a3_birthdaylib.h
#ifndef A3_Q1_H
#define A3_Q1_H
#include <stdlib.h> //needed for handling dynamic memory
#include <string.h> //needed for some string functions
//the structure used for holding one birthday entry
typedef struct {
short year;
short month;
short day;
char* name;
char* knownFor;
} Birthday;
//Creates a Birthday struct variable storing three short representing
// year, month, and day respectively, a char* array representing a name,
// and a char* array representing a trait (knownFor)
//Returns the address of the dynamically (i.e., uses malloc) created variable
//For example:
//Given the code:
//Birthday* person = create_Birthday(1985, 1, 1,
// "J. Edgar Hoover",
// "First director of the FBI");
//printf("%d-%d-%dn%sn%sn", person->year, person->month, person->day,
// person->name, person->knownFor);
//will result in an output like this:
//1985-1-1
//J. Edgar Hoover
//First director of the FBI
Birthday* create_Birthday(short year, short month, short day,
char* name, char* knownFor);
//Releases the memory created to store the 2 members name and knownFor using
// the address of a Birthday struct variable
//Note that the person parameter can be NULL
// and if this is the case the function should do nothing.
//Also, this function does not release the memory used for the Birthday struct variable,
// but only those used by the members name and knownFor.
//To properly release all the memory dynamically allocated for the struct variable,
// call the free() function with the address of the Birthday struct variable right
// after this function returns.
void clear_Birthday(Birthday* person);
//helper function to look up a birthday entry by month and day
//returns a dynamic array storing all the indexes with the same month and day, NULL if not found
//To make the size known to the caller, put a -1 as the last item. For example,
// if indexes 2, 4, 6 match with the month and day, the array would be {2, 4, 6, -1}
int* lookupBirthdayByMD(Birthday **array, int size, short month, short day);
//helper function for qsort to compare birthdays by month and day
int compareBirthdaysByMD(const void *p1, const void *p2);
//helper function for qsort to compare birthdays by name
int compareBirthdaysByName(const void *p1, const void *p2);
#endif
FamousBdays
1895,1,1
J. Edgar Hoover
First director of the FBI
1892,1,3
J. R. R. Tolkien
Author of "Lord of the Rings"
2003,1,3
Greta Thunberg
Swedish environmental activist
1642,1,4
Issac Newton
Formulated the 3 laws of motion
1946,1,5
Diane Keaton
Played as Kay Adams in The Godfather
1964,1,7
Nicolas Cage
Played as Dr. Stanley Goodspeed in The Rock
1935,1,8
Elvis Presley
King of Rock 'n Roll
1945,1,10
Rod Stewart
Performed Sailing
1964,1,12
Jeff Bezos
Founder and CEO of amazon.com
1968,1,14
LL Cool J
Played as Sam Hanna in NCIS Los Angeles
1929,1,15
Martin Luther King Jr.
Civil rights activist, gave the "I have a dream" speech in 1963
1706,1,17
Benjamin Franklin
One of the Founding Fathers of the US, face on a few US currencies
1946,1,19
Dolly Parton
Composed I Will Always Love You
1930,1,20
Edwin Buzz Adrian
One of the first astronauts who landed and walked on moon
1737,1,23
John Hancock
First to sign the Declaration of Independence
1756,1,27
Wolfgang Amadeus Mozart
One of the greatest composers
1954,1,29
Oprah Winfrey
Famous American talk show host
1906,2,4
Clyde Tombaugh
Astronomer who discovered Pluto in 1930
1812,2,7
Charles Dickens
Author of A Christmas Caorl and Oliver Twist
1950,2,10
Mark Spitz
Won 7 gold medals in swimming at the 1972 Summer Olympics
1847,2,11
Thomas Alva Edison
Inventor of the light bulb
1809,2,12
Abraham Lincoln
16th US President
1859,2,14
George Washington Gale Ferris Jr.
Invented the Ferris Wheel
1963,2,17
Michael Jordan
One of the greatest NBA players
1745,2,18
Alessandro Volta
Inventor of the electric battery and discoverer of methane
1988,2,20
Rihanna
Performed Diamonds
1685,2,23
George Frederic Handel
Composer of the Hallelujah Chorus
1955,2,24
Steve Jobs
Co-founder of Apple Computer
1802,2,26
Victor Hugo
Author of Les Miserables
1994,3,1
Justin Bieber
Performed Baby, Sorry
1968,3,2
Daniel Craig
Played as James Bond 5 times
1847,3,3
Alexander Graham Bell
Inventor of the telephone
1475,3,6
Michelangelo
Sculpted the David marble sculpture and painted the ceiling of the Sistine Chapel
1934,3,9
Yuri Gagarin
First man in space
1879,3,14
Albert Einstein
One of the greatest physicists of all time, developed the theory of relativity
1951,3,17
Kurt Russell
Played as Mr. Nobody in The Fast and the Furious
1955,3,19
Bruce Willis
Played as John McClane in Die Hard
1976,3,22
Reese Witherspoon
Played as Elle Woods in Legally Blonde
1874,3,24
Harry Houdini
Famous magician, best known for escape acts
1947,3,25
Elton John
Has a biopic about his life called Rocketman
1931,3,26
Leonard Nimoy
Played as Spock in Star Trek
1845,3,27
Wilhelm Roentgen
Discovered X-rays
1962,3,30
Vincent van Gogh
Painted the Sunflowers
1483,4,6
Raphael
Painted the Portrait of Baldassare Castiglione
1947,4,12
Tom Clancy
Author of The Hunt for Red October, inspired the game The Division
1899,4,13
Alfred Mosher Butts
Invented Scrabble
1452,4,15
Leonardo da Vinci
Painted Mona Lisa
1889,4,16
Charlie Chaplin
Best known for his comedic silent acts
1782,4,21
Friedrich Froebel
Started the first Kindergarten in 1837
1564,4,23
William Shakespeare
The greatest writer in the English language, created Romeo and Juliet
1981,4,30
Kunal Nayyar
Played as Raj Koothrappali in Big Bang Theory
1988,5,5
Adele
Performed Rolling in the Deep
1856,5,6
Robert Edwin Peary Sr.
First person to reach the North Pole
1840,5,7
Pyotr Ilyich Tchaikovsky
Composed the 1812 Overture
1960,5,10
Bono
Memeber of U2
1964,5,13
Stephen Colbert
Host of The Daily Show
1944,5,14
George Lucas
Created Star Wars
1953,5,16
Pierce Brosnan
Played as James Bond 5 times
1984,5,26
Sally Ride
First woman in space in 1983
1917,5,29
John F. Kennedy
35th US President
1976,5,31
Colin Farrell
Played as Danny Witwer in Minority Report
1892,6,6
Donald F. Duncan Sr.
Created the Duncan Yo-Yo
1952,6,7
Liam Neeson
Played as Bryan Mills in Taken
1963,6,9
Johnny Depp
Played as Jack Sparrow in Pirates of the Caribbean
1974,6,15
Neil Patrick Harris
Played as Barney Stinson in How I Met Your Mother
1967,6,20
Nicole Kidman
Played as Atlanna in Aquaman
1964,6,22
Dan Brown
Author of The DaVinci Code
1910,6,26
Roy Plunkett
Invented Teflon
1971,6,28
Elon Musk
CEO of Tesla, Inc.
1985,6,30
Michael Phelps
Won 8 gold medals in swimming at the 2008 Summer Olympics
1932,7,2
Dave Thomas
Founded Wendy's
1962,7,3
Tom Cruise
Played as Ethan Hunt in Mission Impossible
1946,7,6
Sylvester Stallone
Played as Robert Balboa in Rocky
1831,7,8
John Pemberton
Invented Coca-Cola
1956,7,9
Tom Hanks
Played as Forest Gump in Forest Gump
1944,7,13
Erno Rubik
Inventor of Rubik's Cube
1952,7,17
David Hasselhoff
Played as Michael Knight in Knight Rider
1918,7,18
Nelson Mandela
Winner of The Nobel Peace Prize 1993
1919,7,20
Sir Edmund Hillary
First person to reach the peak of Mount Everest
1899,7,21
Ernest Hemingway
Winner of The Nobel Literature Price 1954
1989,7,23
Daniel Radcliffe
Played as Harry Potter in Harry Potter movies
1970,7,24
Jennifer Lopez
Performed If You Had My Love
1967,7,25
Matt LeBlanc
Played as Joey Tribbiani in Friends
1943,7,26
Mick Jagger
Lead singer of the Rolling Stones
1945,7,28
Jim Davis
Created Garfield
1972,7,29
Wil Wheaton
Played as a fictional version of himself in The Big Bang Theory
1947,7,30
Arnold Schwarzenegger
Played as The Terminator in Terminator movies
1965,7,31
J. K. Rowling
Author of Harry Potter
1961,8,4
Barack Obama
44th US President
1930,8,5
Neil Armstrong
First person to walk on the moon
1975,8,7
Charlize Theron
Played as Cipher in Fast & Furious 9
1963,8,9
Whitney Houston
Performed I Will Always Love You
1950,8,11
Stephen Wozniak
Co-founder of Apple Computer
1899,8,13
Alfred Hitchcock
The Master of Suspense
1769,8,15
Napoleon
Emperor of the French from 1804 until 1814 and again in 1815
1954,8,18
Patrick Swayze
Played as Johnny Castle in Dirty Dancing
1921,8,19
Gene Roddenberry
Created Star Trek
1978,8,23
Kobe Bryant
One of the greatest basketball players of all time
1930,8,25
Sean Connery
Played as Captain John Patrick Mason in The Rock
1910,8,27
Mother Teresa
Winner of The Nobel Peace Prize 1979
1958,8,29
Michael Jackson
The King of Pop
1964,9,2
Keanu Reeves
Played as Neo in The Matrix movies
1956,9,16
David Copperfield
Made the Statue of Liberty disappear in his magic show
1929,9,19
Adam West
Played as Batman in the Batman TV series
1866,9,21
H. G. Wells
Author of The Time Machine
1936,9,24
Jim Henson
Creator of the Muppets
1951,9,25
Mark Hamill
Played as Luke Skywalker in Star Wars
1924,10,1
Jimmy Carter
39th US President
1902,10,5
Ray Kroc
Founder of McDonald's
1846,10,6
George Westinghouse
Developed AC electric power
1931,10,7
Desmond Tutu
Winner of the Noble Peace Price 1984
1985,10,8
Bruno Mars
Performed Just the Way You Are
1940,10,9
John Lennon
Member of the Beatles
1957,10,13
Chris Carter
Creator of The X-Files
1927,10,14
Roger Moore
Played as James Bond 7 times
1960,10,18
Jean-Claude Van Damme
Played as Jean Vilain in The Expendables 2
1833,10,21
Alfred Nobel
Established The Nobel Prizes
1942,10,23
Michael Crichton
Writer of Jurrasic Park
1881,10,25
Pablo Picasso
Greatest artist of the 20th century
1955,10,28
Bill Gates
Co-founder of Microsoft
1922,11,8
Christian Barnard
Performed the first heart transplant in 1967
1974,11,11
Leonardo DiCaprio
Played as Jack Dawson in Titanic
1967,11,12
David Schwimmer
Played as Ross Geller in Friends
1765,11,14
Robert Fulton
Inventor of the steamboat
1968,11,18
Owen Wilson
Played as Mobius M. Mobius in Loki TV series
1961,11,19
Meg Ryan
Played as Annie Reed in Sleepless in Seattle
1889,11,20
Edwin Hubble
Has a space telescope named in his honor
1984,11,22
Scarlett Johansson
Played as Black Widow in the Marvel Cinematic Universe
1967,12,2
Lucy Liu
Played as Dr. Joan Watson in Elementary TV series
1996,12,11
Hailee Steinfeld
Played as Kate Bishop in Hawkeye TV series
1989,12,13
Taylor Swift
Performed Love Story and You Belong with Me
1832,12,15
Alexandre Gustave Eiffel
Designed the Eiffel Tower
1964,12,18
Brad Pitt
Played as Tyler Durden in Fight Club
1980,12,19
Jake Gyllenhaal
Played as Mysterio in Spider-Man: Far From Home
1821,12,25
Clara Barton
Founder of the American Red Cross
1954,12,28
Denzel Washington
Played as Robert McCall in The Equalizer
1984,12,30
LeBron James
One of the greatest NBA basketball players
1977,12,31
Psy
Performed Gangnam Style
Makefile
all: test1
test1: a3_birthdayLookupSystem.c a3_birthdaylib.c
gcc -Wall -std=c99 -fsanitize=leak -o test1 a3_birthdayLookupSystem.c a3_birthdaylib.c
clean:
rm -f test1
The assignment will be graded automatically. Make sure that your code compiles without
warnings/errors and produces the required output. Also use the file names and structures
indicated as requested. Deviation from that might result in 0 mark. Your code MUST compile and
run in the CSIL machines with the Makefile provided. It is possible that even with warnings your
code would compile. But this still indicates there is something wrong with you code and you have
to fix them, or marks will be deducted. Your code MUST be readable and have reasonable
documentation (comments) explaining what it does. Use your own judgement, for example, no
need to explain i+=2 is increasing i by 2 , but explain how variables are used to achieve
something, what a certain loop is doing, and the purpose of each #include. Description There is
only 1 question in this assignment. However, there are several files you need to submit. Write your
answer in the corresponding file as instructed along with your student information. You can include
any libraries that are covered in class (i.e., stdio, stdlib, string, math, stdbool). You can also write
your own helper functions. Only one of these files should contain the main function. Question 1 [20
marks] In this question you are going to extend the program you made in Assignment 2 by
providing more functionalities. You are again going to write your own main function so the program
runs. Create a program that reads all the birthday information from a file and provide an interface
for the user to query birthdays. Your program must support the following functionalities as options:
- Option 1: to load a birthday file - ask the user to input the name of the file containing birthday
information and load the entries from that file (report # of entries). Note that the file can be
nonexistent (if so the program should print the error and keep running), but if it exists you can
assume the format inside that file is consistent (birthday, name, known-for), with each string at
most 100 characters. it is possible for the user to load a different file by choosing this option again.
- Option 2: to list birthdays sorted by Month-Day - list the birthday entries from Jan 1 to Dec 31. If a
day has no entry, there is no need to print anything. If on that day there are more than one
birthday entry, any order within that day is acceptable. - Option 3: to list birthdays sorted by Name
- list the birthday entries sorted by name las determined by strcmp). If with the same name there
are more than one birthday entry, any order within that name is acceptable. - Option 4: to lookup a
birthday - ask the user for a month and then a day, then report all entries with the same birthday
(regardless of the year). There can be more than one entry on any day. - If one or more entries are
found, print all the information. Any order is acceptable. - If no entry is found, print "No such
birthday on record." There is no need to check if the input date is valid (e.g., 2-31 will just result in
the no-entry case). - Option 5: to terminate the program - thank the user and end the
program.Your program must meet these requirements: - Include the provided header file (.h file)
and use the functions defined in the corresponding implementation file (.c file) in your driver file
(where main is), do not redefine those functions. - Use a dynamic array of Birthday struct pointers
to store the birthday information. This is the recommended approach (instead of a static array with
a fixed size) as we might change the number of entries in the provided file, and dynamic arrays
can accommodate that variation. - There must be no memory leaks (e.g., your program requests
some memory but does not release them all before it terminates). We have set up the Makefile so
that if that happens after running your program it will tell you some memory leaks are detected. -
Start with a fancy banner. There is no specific requirement besides it must include your name,
9digit SFU ID, and your SFU email address. Let your creativity shine, just nothing offensive. - The
sorting for Options 2&3 must be done using the built-in qsort. Meaning you have to write your own
compare functions for qsort to use. And here are some hints for you to write your code: - The
interface is essentially a do-while loop where in each iteration it asks for an option and determines
what to do, with a repeating conditional of the terminating option has not been inputted. It is a
common approach for menu-based interfaces. - Since each item in the dynamic array for the
birthday entries are pointers, be careful with how you are casting the pointer variables in the
compare functions (they are pointers to the items). - The scanf() function works slightly differently
between different formats. One difference is how it handles leading and trailing newlines (look up
"dangling newline character" if you are curious). One option to get around this is put a space in
front of the format string (e.g., "%d", "%s"). You are encouraged to explore different ways to get
around this issue. Here are some sample input and output (you can assume user input is always
valid):Figure 3. Looking up for Jan 2 and Jan 3. Include the function definitions corresponding to
a3_birthdaylib.h (and your helper functions, if any) in a source file named as a3_birthdaylib.c.
Include your main function (and your helper functions, if any) in another source file named as
a3_birthdayLookupSystem.c. We call this the driver file because this is where the program starts.
To determine where to place a helper function, think about its purpose. If it provides functionality
with Birthday structs (e.g., create/clear Birthday, compare Birthdays), it is a library function; if it
provides functionality of the program (e.g., print a fancy banner), it is a program function. Coding
Style [4 marks] Your program should be properly indented, have clear and meaningful variable
names (e.g., no singleletter variable names except loop iterators) and enough white space and
comments to make it easy to read. Named constants should be used where appropriate. Each line
of code should not exceed 80 characters. White space should be used in a consistent manner.
Keep your code concise and efficient. If your code is unnecessarily long or inefficient (e.g., hard-
code for all possible cases, extraneous function calls), we might deduct marks. To help you to get
into the habit of good coding style, we will read your code and marks will be deducted if your code
is not styled properly.Using the Makefile and Other Supplied Files The Makefile provided in this
assignment is used by a command in the CSIL machines called "make" to quickly compile your
code. It is especially useful if you have multiple source files. To use it, type the following command
in the prompt (make sure you are in the directory with all the files of Assignment 3): [: The example
above illustrates how Question 1 is compiled into an executable called "test1" when using the
Makefile. Replace the "test1" with "test2", "test3", ...etc. for other questions. You can then run the
executable by typing "./test1" to test your code for Question 1 . If you make changes to your code,
use the make command again. You can also use "make all" if you want to compile all your code at
once. The header file a3_birthdaylib.h is there to make the compilation work. Take a look at it for
information about how each function should work. You might have to modify it and you will have to
submit it this time. Submission Submit only the 3 source files (a3_birthdaylib.h, a3_birthdaylib.c,
a3_birthdayLookupSystem.c) to CourSys. Refer to the corresponding Canvas assignment entry for
details. Assignment late penalty: 10% per calendar day (each 0 to 24 hour period past due), max 2
days late. Academic Honesty It is expected that within this course, the highest standards of
academic integrity will be maintained, in keeping with SFU's Policy S10.01, "Code of Academic
Integrity and Good Conduct." In this class, collaboration is encouraged for in-class exercises and
the team components of the assignments, as well as task preparation for group discussions.
However, individual work should be completed by the person who submits it. Any work that is
independent work of the submitter should be clearly cited to make its source clear. All referenced
work in reports and presentations must be appropriately cited, to include websites, as well as
figures and graphs in presentations. If there are any questions whatsoever, feel free to contact the
course instructor about any possible grey areas. Some examples of unacceptable behavior: -
Handing in assignments/exercises that are not 100% your own work (in design, implementation,
wording, etc.), without a clear/visible citation of the source. - Using another student's work as a
template or reference for completing your own work. - Using any unpermitted resources during an
exam. - Looking at, or attempting to look at, another student's answer during an exam. -
Submitting work that has been submitted before, for any course at any institution.

More Related Content

Similar to Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf

Mechnius 12 prelims
Mechnius 12 prelimsMechnius 12 prelims
Mechnius 12 prelims
QuizzCongoz
 
Prelims with answers
Prelims with answersPrelims with answers
Prelims with answers
headrushda
 
AYME school quiz Prelims
AYME school quiz PrelimsAYME school quiz Prelims
AYME school quiz Prelims
Navin Sridhar
 
Famous inventions
Famous inventionsFamous inventions
Famous inventions
UNKINGLISH
 
Mega-Whats 2009 Questions
Mega-Whats 2009 QuestionsMega-Whats 2009 Questions
Mega-Whats 2009 Questions
Arul Mani
 
Predictions
PredictionsPredictions
Predictions
jgustin
 

Similar to Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf (20)

Ameircan Inventions which changed the world
Ameircan Inventions which changed the worldAmeircan Inventions which changed the world
Ameircan Inventions which changed the world
 
Mechnius 12 prelims
Mechnius 12 prelimsMechnius 12 prelims
Mechnius 12 prelims
 
Dihing quiz 1
Dihing quiz 1Dihing quiz 1
Dihing quiz 1
 
CET Quiz Club Set #2
CET Quiz Club Set #2CET Quiz Club Set #2
CET Quiz Club Set #2
 
Waves'14 Open Prelims
Waves'14 Open PrelimsWaves'14 Open Prelims
Waves'14 Open Prelims
 
Bvcoe vikram sarabhai quiz
Bvcoe vikram sarabhai quizBvcoe vikram sarabhai quiz
Bvcoe vikram sarabhai quiz
 
The Dr. Vikram Sarabhai Rotating Shield Quiz 2010 (2nd round)
The Dr. Vikram Sarabhai Rotating Shield Quiz 2010 (2nd round)The Dr. Vikram Sarabhai Rotating Shield Quiz 2010 (2nd round)
The Dr. Vikram Sarabhai Rotating Shield Quiz 2010 (2nd round)
 
Landmark Quiz 2009 Bangalore Prelims1
Landmark Quiz 2009 Bangalore Prelims1Landmark Quiz 2009 Bangalore Prelims1
Landmark Quiz 2009 Bangalore Prelims1
 
Madras School of Economics General Quiz 2014 Finals
Madras School of Economics General Quiz 2014 FinalsMadras School of Economics General Quiz 2014 Finals
Madras School of Economics General Quiz 2014 Finals
 
MELAS QUIZ ( EQL S2 )
MELAS QUIZ ( EQL S2 )MELAS QUIZ ( EQL S2 )
MELAS QUIZ ( EQL S2 )
 
Fresher cooker'14 prelims
Fresher cooker'14 prelims  Fresher cooker'14 prelims
Fresher cooker'14 prelims
 
20170106 Indian Social Club - Grand Finale
20170106  Indian Social Club - Grand Finale20170106  Indian Social Club - Grand Finale
20170106 Indian Social Club - Grand Finale
 
Don Quizzote 2011: Prelims
Don Quizzote 2011: PrelimsDon Quizzote 2011: Prelims
Don Quizzote 2011: Prelims
 
Prelims with answers
Prelims with answersPrelims with answers
Prelims with answers
 
AYME school quiz Prelims
AYME school quiz PrelimsAYME school quiz Prelims
AYME school quiz Prelims
 
My session sept'14
My session sept'14My session sept'14
My session sept'14
 
Famous inventions
Famous inventionsFamous inventions
Famous inventions
 
Mega-Whats 2009 Questions
Mega-Whats 2009 QuestionsMega-Whats 2009 Questions
Mega-Whats 2009 Questions
 
Kalavaibhavam quiz finals
Kalavaibhavam quiz finals Kalavaibhavam quiz finals
Kalavaibhavam quiz finals
 
Predictions
PredictionsPredictions
Predictions
 

More from geetakannupillai1

Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdf
geetakannupillai1
 
Hi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdfHi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdf
geetakannupillai1
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
geetakannupillai1
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdf
geetakannupillai1
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
geetakannupillai1
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdf
geetakannupillai1
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdf
geetakannupillai1
 

More from geetakannupillai1 (20)

Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdfHidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
 
Hi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdfHi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdf
 
Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdf
 
High involvement and low involvement marketing Point Di.pdf
High involvement and low involvement marketing Point  Di.pdfHigh involvement and low involvement marketing Point  Di.pdf
High involvement and low involvement marketing Point Di.pdf
 
Hi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdfHi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdf
 
help please Please respond to this post by choosing any o.pdf
help please  Please respond to this post by choosing any o.pdfhelp please  Please respond to this post by choosing any o.pdf
help please Please respond to this post by choosing any o.pdf
 
Hi There Please help me with 1 The python code AND .pdf
Hi There   Please help me with 1 The python code  AND .pdfHi There   Please help me with 1 The python code  AND .pdf
Hi There Please help me with 1 The python code AND .pdf
 
Hi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdfHi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdf
 
Hi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdfHi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdf
 
Hi Experts Could some one please explain with a practical e.pdf
Hi Experts  Could some one please explain with a practical e.pdfHi Experts  Could some one please explain with a practical e.pdf
Hi Experts Could some one please explain with a practical e.pdf
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
 
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
Heteraride st ynetimin rol  Soru seenekleri    1  kat.pdfHeteraride st ynetimin rol  Soru seenekleri    1  kat.pdf
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
 
Herzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdfHerzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdf
 
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdfHerhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
 
Help with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdfHelp with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdf
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdf
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdf
 
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdfHelper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf

  • 1. Here is support files a3_birthdaylib.h #ifndef A3_Q1_H #define A3_Q1_H #include <stdlib.h> //needed for handling dynamic memory #include <string.h> //needed for some string functions //the structure used for holding one birthday entry typedef struct { short year; short month; short day; char* name; char* knownFor; } Birthday; //Creates a Birthday struct variable storing three short representing // year, month, and day respectively, a char* array representing a name, // and a char* array representing a trait (knownFor) //Returns the address of the dynamically (i.e., uses malloc) created variable //For example: //Given the code: //Birthday* person = create_Birthday(1985, 1, 1, // "J. Edgar Hoover", // "First director of the FBI"); //printf("%d-%d-%dn%sn%sn", person->year, person->month, person->day, // person->name, person->knownFor); //will result in an output like this: //1985-1-1 //J. Edgar Hoover //First director of the FBI Birthday* create_Birthday(short year, short month, short day, char* name, char* knownFor); //Releases the memory created to store the 2 members name and knownFor using // the address of a Birthday struct variable //Note that the person parameter can be NULL // and if this is the case the function should do nothing. //Also, this function does not release the memory used for the Birthday struct variable, // but only those used by the members name and knownFor. //To properly release all the memory dynamically allocated for the struct variable, // call the free() function with the address of the Birthday struct variable right // after this function returns. void clear_Birthday(Birthday* person); //helper function to look up a birthday entry by month and day
  • 2. //returns a dynamic array storing all the indexes with the same month and day, NULL if not found //To make the size known to the caller, put a -1 as the last item. For example, // if indexes 2, 4, 6 match with the month and day, the array would be {2, 4, 6, -1} int* lookupBirthdayByMD(Birthday **array, int size, short month, short day); //helper function for qsort to compare birthdays by month and day int compareBirthdaysByMD(const void *p1, const void *p2); //helper function for qsort to compare birthdays by name int compareBirthdaysByName(const void *p1, const void *p2); #endif FamousBdays 1895,1,1 J. Edgar Hoover First director of the FBI 1892,1,3 J. R. R. Tolkien Author of "Lord of the Rings" 2003,1,3 Greta Thunberg Swedish environmental activist 1642,1,4 Issac Newton Formulated the 3 laws of motion 1946,1,5 Diane Keaton Played as Kay Adams in The Godfather 1964,1,7 Nicolas Cage Played as Dr. Stanley Goodspeed in The Rock 1935,1,8 Elvis Presley King of Rock 'n Roll 1945,1,10 Rod Stewart Performed Sailing 1964,1,12 Jeff Bezos Founder and CEO of amazon.com 1968,1,14 LL Cool J Played as Sam Hanna in NCIS Los Angeles 1929,1,15 Martin Luther King Jr.
  • 3. Civil rights activist, gave the "I have a dream" speech in 1963 1706,1,17 Benjamin Franklin One of the Founding Fathers of the US, face on a few US currencies 1946,1,19 Dolly Parton Composed I Will Always Love You 1930,1,20 Edwin Buzz Adrian One of the first astronauts who landed and walked on moon 1737,1,23 John Hancock First to sign the Declaration of Independence 1756,1,27 Wolfgang Amadeus Mozart One of the greatest composers 1954,1,29 Oprah Winfrey Famous American talk show host 1906,2,4 Clyde Tombaugh Astronomer who discovered Pluto in 1930 1812,2,7 Charles Dickens Author of A Christmas Caorl and Oliver Twist 1950,2,10 Mark Spitz Won 7 gold medals in swimming at the 1972 Summer Olympics 1847,2,11 Thomas Alva Edison Inventor of the light bulb 1809,2,12 Abraham Lincoln 16th US President 1859,2,14 George Washington Gale Ferris Jr. Invented the Ferris Wheel 1963,2,17 Michael Jordan One of the greatest NBA players 1745,2,18 Alessandro Volta
  • 4. Inventor of the electric battery and discoverer of methane 1988,2,20 Rihanna Performed Diamonds 1685,2,23 George Frederic Handel Composer of the Hallelujah Chorus 1955,2,24 Steve Jobs Co-founder of Apple Computer 1802,2,26 Victor Hugo Author of Les Miserables 1994,3,1 Justin Bieber Performed Baby, Sorry 1968,3,2 Daniel Craig Played as James Bond 5 times 1847,3,3 Alexander Graham Bell Inventor of the telephone 1475,3,6 Michelangelo Sculpted the David marble sculpture and painted the ceiling of the Sistine Chapel 1934,3,9 Yuri Gagarin First man in space 1879,3,14 Albert Einstein One of the greatest physicists of all time, developed the theory of relativity 1951,3,17 Kurt Russell Played as Mr. Nobody in The Fast and the Furious 1955,3,19 Bruce Willis Played as John McClane in Die Hard 1976,3,22 Reese Witherspoon Played as Elle Woods in Legally Blonde 1874,3,24 Harry Houdini
  • 5. Famous magician, best known for escape acts 1947,3,25 Elton John Has a biopic about his life called Rocketman 1931,3,26 Leonard Nimoy Played as Spock in Star Trek 1845,3,27 Wilhelm Roentgen Discovered X-rays 1962,3,30 Vincent van Gogh Painted the Sunflowers 1483,4,6 Raphael Painted the Portrait of Baldassare Castiglione 1947,4,12 Tom Clancy Author of The Hunt for Red October, inspired the game The Division 1899,4,13 Alfred Mosher Butts Invented Scrabble 1452,4,15 Leonardo da Vinci Painted Mona Lisa 1889,4,16 Charlie Chaplin Best known for his comedic silent acts 1782,4,21 Friedrich Froebel Started the first Kindergarten in 1837 1564,4,23 William Shakespeare The greatest writer in the English language, created Romeo and Juliet 1981,4,30 Kunal Nayyar Played as Raj Koothrappali in Big Bang Theory 1988,5,5 Adele Performed Rolling in the Deep 1856,5,6 Robert Edwin Peary Sr.
  • 6. First person to reach the North Pole 1840,5,7 Pyotr Ilyich Tchaikovsky Composed the 1812 Overture 1960,5,10 Bono Memeber of U2 1964,5,13 Stephen Colbert Host of The Daily Show 1944,5,14 George Lucas Created Star Wars 1953,5,16 Pierce Brosnan Played as James Bond 5 times 1984,5,26 Sally Ride First woman in space in 1983 1917,5,29 John F. Kennedy 35th US President 1976,5,31 Colin Farrell Played as Danny Witwer in Minority Report 1892,6,6 Donald F. Duncan Sr. Created the Duncan Yo-Yo 1952,6,7 Liam Neeson Played as Bryan Mills in Taken 1963,6,9 Johnny Depp Played as Jack Sparrow in Pirates of the Caribbean 1974,6,15 Neil Patrick Harris Played as Barney Stinson in How I Met Your Mother 1967,6,20 Nicole Kidman Played as Atlanna in Aquaman 1964,6,22 Dan Brown
  • 7. Author of The DaVinci Code 1910,6,26 Roy Plunkett Invented Teflon 1971,6,28 Elon Musk CEO of Tesla, Inc. 1985,6,30 Michael Phelps Won 8 gold medals in swimming at the 2008 Summer Olympics 1932,7,2 Dave Thomas Founded Wendy's 1962,7,3 Tom Cruise Played as Ethan Hunt in Mission Impossible 1946,7,6 Sylvester Stallone Played as Robert Balboa in Rocky 1831,7,8 John Pemberton Invented Coca-Cola 1956,7,9 Tom Hanks Played as Forest Gump in Forest Gump 1944,7,13 Erno Rubik Inventor of Rubik's Cube 1952,7,17 David Hasselhoff Played as Michael Knight in Knight Rider 1918,7,18 Nelson Mandela Winner of The Nobel Peace Prize 1993 1919,7,20 Sir Edmund Hillary First person to reach the peak of Mount Everest 1899,7,21 Ernest Hemingway Winner of The Nobel Literature Price 1954 1989,7,23 Daniel Radcliffe
  • 8. Played as Harry Potter in Harry Potter movies 1970,7,24 Jennifer Lopez Performed If You Had My Love 1967,7,25 Matt LeBlanc Played as Joey Tribbiani in Friends 1943,7,26 Mick Jagger Lead singer of the Rolling Stones 1945,7,28 Jim Davis Created Garfield 1972,7,29 Wil Wheaton Played as a fictional version of himself in The Big Bang Theory 1947,7,30 Arnold Schwarzenegger Played as The Terminator in Terminator movies 1965,7,31 J. K. Rowling Author of Harry Potter 1961,8,4 Barack Obama 44th US President 1930,8,5 Neil Armstrong First person to walk on the moon 1975,8,7 Charlize Theron Played as Cipher in Fast & Furious 9 1963,8,9 Whitney Houston Performed I Will Always Love You 1950,8,11 Stephen Wozniak Co-founder of Apple Computer 1899,8,13 Alfred Hitchcock The Master of Suspense 1769,8,15 Napoleon
  • 9. Emperor of the French from 1804 until 1814 and again in 1815 1954,8,18 Patrick Swayze Played as Johnny Castle in Dirty Dancing 1921,8,19 Gene Roddenberry Created Star Trek 1978,8,23 Kobe Bryant One of the greatest basketball players of all time 1930,8,25 Sean Connery Played as Captain John Patrick Mason in The Rock 1910,8,27 Mother Teresa Winner of The Nobel Peace Prize 1979 1958,8,29 Michael Jackson The King of Pop 1964,9,2 Keanu Reeves Played as Neo in The Matrix movies 1956,9,16 David Copperfield Made the Statue of Liberty disappear in his magic show 1929,9,19 Adam West Played as Batman in the Batman TV series 1866,9,21 H. G. Wells Author of The Time Machine 1936,9,24 Jim Henson Creator of the Muppets 1951,9,25 Mark Hamill Played as Luke Skywalker in Star Wars 1924,10,1 Jimmy Carter 39th US President 1902,10,5 Ray Kroc
  • 10. Founder of McDonald's 1846,10,6 George Westinghouse Developed AC electric power 1931,10,7 Desmond Tutu Winner of the Noble Peace Price 1984 1985,10,8 Bruno Mars Performed Just the Way You Are 1940,10,9 John Lennon Member of the Beatles 1957,10,13 Chris Carter Creator of The X-Files 1927,10,14 Roger Moore Played as James Bond 7 times 1960,10,18 Jean-Claude Van Damme Played as Jean Vilain in The Expendables 2 1833,10,21 Alfred Nobel Established The Nobel Prizes 1942,10,23 Michael Crichton Writer of Jurrasic Park 1881,10,25 Pablo Picasso Greatest artist of the 20th century 1955,10,28 Bill Gates Co-founder of Microsoft 1922,11,8 Christian Barnard Performed the first heart transplant in 1967 1974,11,11 Leonardo DiCaprio Played as Jack Dawson in Titanic 1967,11,12 David Schwimmer
  • 11. Played as Ross Geller in Friends 1765,11,14 Robert Fulton Inventor of the steamboat 1968,11,18 Owen Wilson Played as Mobius M. Mobius in Loki TV series 1961,11,19 Meg Ryan Played as Annie Reed in Sleepless in Seattle 1889,11,20 Edwin Hubble Has a space telescope named in his honor 1984,11,22 Scarlett Johansson Played as Black Widow in the Marvel Cinematic Universe 1967,12,2 Lucy Liu Played as Dr. Joan Watson in Elementary TV series 1996,12,11 Hailee Steinfeld Played as Kate Bishop in Hawkeye TV series 1989,12,13 Taylor Swift Performed Love Story and You Belong with Me 1832,12,15 Alexandre Gustave Eiffel Designed the Eiffel Tower 1964,12,18 Brad Pitt Played as Tyler Durden in Fight Club 1980,12,19 Jake Gyllenhaal Played as Mysterio in Spider-Man: Far From Home 1821,12,25 Clara Barton Founder of the American Red Cross 1954,12,28 Denzel Washington Played as Robert McCall in The Equalizer 1984,12,30 LeBron James
  • 12. One of the greatest NBA basketball players 1977,12,31 Psy Performed Gangnam Style Makefile all: test1 test1: a3_birthdayLookupSystem.c a3_birthdaylib.c gcc -Wall -std=c99 -fsanitize=leak -o test1 a3_birthdayLookupSystem.c a3_birthdaylib.c clean: rm -f test1 The assignment will be graded automatically. Make sure that your code compiles without warnings/errors and produces the required output. Also use the file names and structures indicated as requested. Deviation from that might result in 0 mark. Your code MUST compile and run in the CSIL machines with the Makefile provided. It is possible that even with warnings your code would compile. But this still indicates there is something wrong with you code and you have to fix them, or marks will be deducted. Your code MUST be readable and have reasonable documentation (comments) explaining what it does. Use your own judgement, for example, no need to explain i+=2 is increasing i by 2 , but explain how variables are used to achieve something, what a certain loop is doing, and the purpose of each #include. Description There is only 1 question in this assignment. However, there are several files you need to submit. Write your answer in the corresponding file as instructed along with your student information. You can include any libraries that are covered in class (i.e., stdio, stdlib, string, math, stdbool). You can also write your own helper functions. Only one of these files should contain the main function. Question 1 [20 marks] In this question you are going to extend the program you made in Assignment 2 by providing more functionalities. You are again going to write your own main function so the program runs. Create a program that reads all the birthday information from a file and provide an interface for the user to query birthdays. Your program must support the following functionalities as options: - Option 1: to load a birthday file - ask the user to input the name of the file containing birthday information and load the entries from that file (report # of entries). Note that the file can be nonexistent (if so the program should print the error and keep running), but if it exists you can assume the format inside that file is consistent (birthday, name, known-for), with each string at most 100 characters. it is possible for the user to load a different file by choosing this option again. - Option 2: to list birthdays sorted by Month-Day - list the birthday entries from Jan 1 to Dec 31. If a day has no entry, there is no need to print anything. If on that day there are more than one birthday entry, any order within that day is acceptable. - Option 3: to list birthdays sorted by Name - list the birthday entries sorted by name las determined by strcmp). If with the same name there are more than one birthday entry, any order within that name is acceptable. - Option 4: to lookup a birthday - ask the user for a month and then a day, then report all entries with the same birthday (regardless of the year). There can be more than one entry on any day. - If one or more entries are found, print all the information. Any order is acceptable. - If no entry is found, print "No such birthday on record." There is no need to check if the input date is valid (e.g., 2-31 will just result in the no-entry case). - Option 5: to terminate the program - thank the user and end the
  • 13. program.Your program must meet these requirements: - Include the provided header file (.h file) and use the functions defined in the corresponding implementation file (.c file) in your driver file (where main is), do not redefine those functions. - Use a dynamic array of Birthday struct pointers to store the birthday information. This is the recommended approach (instead of a static array with a fixed size) as we might change the number of entries in the provided file, and dynamic arrays can accommodate that variation. - There must be no memory leaks (e.g., your program requests some memory but does not release them all before it terminates). We have set up the Makefile so that if that happens after running your program it will tell you some memory leaks are detected. - Start with a fancy banner. There is no specific requirement besides it must include your name, 9digit SFU ID, and your SFU email address. Let your creativity shine, just nothing offensive. - The sorting for Options 2&3 must be done using the built-in qsort. Meaning you have to write your own compare functions for qsort to use. And here are some hints for you to write your code: - The interface is essentially a do-while loop where in each iteration it asks for an option and determines what to do, with a repeating conditional of the terminating option has not been inputted. It is a common approach for menu-based interfaces. - Since each item in the dynamic array for the birthday entries are pointers, be careful with how you are casting the pointer variables in the compare functions (they are pointers to the items). - The scanf() function works slightly differently between different formats. One difference is how it handles leading and trailing newlines (look up "dangling newline character" if you are curious). One option to get around this is put a space in front of the format string (e.g., "%d", "%s"). You are encouraged to explore different ways to get around this issue. Here are some sample input and output (you can assume user input is always valid):Figure 3. Looking up for Jan 2 and Jan 3. Include the function definitions corresponding to a3_birthdaylib.h (and your helper functions, if any) in a source file named as a3_birthdaylib.c. Include your main function (and your helper functions, if any) in another source file named as a3_birthdayLookupSystem.c. We call this the driver file because this is where the program starts. To determine where to place a helper function, think about its purpose. If it provides functionality with Birthday structs (e.g., create/clear Birthday, compare Birthdays), it is a library function; if it provides functionality of the program (e.g., print a fancy banner), it is a program function. Coding Style [4 marks] Your program should be properly indented, have clear and meaningful variable names (e.g., no singleletter variable names except loop iterators) and enough white space and comments to make it easy to read. Named constants should be used where appropriate. Each line of code should not exceed 80 characters. White space should be used in a consistent manner. Keep your code concise and efficient. If your code is unnecessarily long or inefficient (e.g., hard- code for all possible cases, extraneous function calls), we might deduct marks. To help you to get into the habit of good coding style, we will read your code and marks will be deducted if your code is not styled properly.Using the Makefile and Other Supplied Files The Makefile provided in this assignment is used by a command in the CSIL machines called "make" to quickly compile your code. It is especially useful if you have multiple source files. To use it, type the following command in the prompt (make sure you are in the directory with all the files of Assignment 3): [: The example above illustrates how Question 1 is compiled into an executable called "test1" when using the Makefile. Replace the "test1" with "test2", "test3", ...etc. for other questions. You can then run the executable by typing "./test1" to test your code for Question 1 . If you make changes to your code,
  • 14. use the make command again. You can also use "make all" if you want to compile all your code at once. The header file a3_birthdaylib.h is there to make the compilation work. Take a look at it for information about how each function should work. You might have to modify it and you will have to submit it this time. Submission Submit only the 3 source files (a3_birthdaylib.h, a3_birthdaylib.c, a3_birthdayLookupSystem.c) to CourSys. Refer to the corresponding Canvas assignment entry for details. Assignment late penalty: 10% per calendar day (each 0 to 24 hour period past due), max 2 days late. Academic Honesty It is expected that within this course, the highest standards of academic integrity will be maintained, in keeping with SFU's Policy S10.01, "Code of Academic Integrity and Good Conduct." In this class, collaboration is encouraged for in-class exercises and the team components of the assignments, as well as task preparation for group discussions. However, individual work should be completed by the person who submits it. Any work that is independent work of the submitter should be clearly cited to make its source clear. All referenced work in reports and presentations must be appropriately cited, to include websites, as well as figures and graphs in presentations. If there are any questions whatsoever, feel free to contact the course instructor about any possible grey areas. Some examples of unacceptable behavior: - Handing in assignments/exercises that are not 100% your own work (in design, implementation, wording, etc.), without a clear/visible citation of the source. - Using another student's work as a template or reference for completing your own work. - Using any unpermitted resources during an exam. - Looking at, or attempting to look at, another student's answer during an exam. - Submitting work that has been submitted before, for any course at any institution.