ECE-3574: Applied Software Design Homework 1 solution

$29.99

Original Work ?

Download Details:

  • Name: HW1-qreqyz.zip
  • Type: zip
  • Size: 244.91 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (4 votes)

Exercise
Write a birthday reminder application called birthdays. Classes to reuse are QDate, QFile, QString,
QStringList, and QTextStream.
 Store name/birthday pairs in any format you like, in a file called birthdays.dat.
 birthdays without any command line arguments lists all birthdays coming up in the next 30
days.
 birthdays -a “yyyy-mm-dd” “John Smith” sets the birthday for “John Smith”.
 birthdays -n 40 shows birthdays coming up in the next 40 days.
 birthdays shows all birthdays that contain the substring
 birthdays -d “John Smith” should delete this entry from the file.
 birthdays -d “yyyy-MM-dd” should delete all entries with this birthday from the file.
 birthdays -m “John Smith” 40 shows birthdays coming up in the next 40 days from John
Smith’s birthday. This includes John Smith’s birthday.
 birthdays -u updates records as needed such that all birthday reminders correspond to the
person’s next birthday (i.e. changes dates in the past and dates more than 1 year in the future
to dates within the following year – exception birthdays on February 29th, which are allowed
to be up to four years in the future). If today is 2014 August 21st a birthday for today stays
the same where a birthday on 2015 August 21st becomes today.
 EXTRA CREDIT: make the previous command, birthdays -u also list what records it
updates. This time, a third column should be displayed, showing the time left until the
birthday, in this format: 8 months, 3 weeks, 2 days. If any of these numbers is zero, do not
display it (eg. 8 months, 2 days).
Notes
 All output should be in a format similar to a table (in two columns) like this:
Name Birthday
==== ========
John Smith 2014-11-04
Jenny Doe 2014-12-29
 For any illegal input, you have to raise exceptions and have a global exception handler deal
with them. The following situations must be taken into consideration:
1. Invalid dates and months, for example, 2010-11-31 or 2010-14-23.
2. The could be a full name, partial name or even a letter. Digits or other
special characters ( except – and ‘ ) are not allowed.
3. For birthdays –m “John Smith” 40, if the exact name is not found, an exception should
be raised.
 A birthday, B, is “coming up in the next X days” from date Y if Y ≤ B ≤ Y+X. So ./birthdays
–n 0 displays all and only birthdays today.
 If there are no birthdays in the specified time frame or matching the given , the
program should print a message. This is not considered an error, so an exception should not
be raised.
 When birthdays are selected by date (in the without arguments, -n and -m cases and
additionally the -u case if going for extra credit) they should be printed in chronological
order. When they are selected by , they should be printed in alphabetic order.
 There are never duplicate names. If the -a option is used twice for the same name the
program should update the corresponding birthday instead of a adding a new entry.
3
ECE-3574: Applied Software Design, Fall 2014
Homework 1
Grading Grid
 Homework 1 has a grading weight of 5 points
 Points awarded for each feature are further divided as follows:
1. The code compiles and runs according to specs – 50%
2. Correctness of the code – 50%
 Extra credit points will only be awarded for code that runs according to specs.
Feature Points
QT style programming and indentation 10
birthdays without arguments 10
birthdays -a 10
birthdays -n 8
birthdays 8
birthdays -d 8
birthdays -d 8
birthdays -m 8
birthdays -u 8
Correct output format 6
Correct output order 6
Errors treated correctly 10
Extra credit (no partial credit) 10
Total 110