[Solved] CIS1300 Assignment 1: A Temporal Challenge

$25

File Name: CIS1300_Assignment_1:_A_Temporal_Challenge.zip
File Size: 395.64 KB

SKU: [Solved] CIS1300 Assignment 1: A Temporal Challenge Category: Tag:
5/5 - (1 vote)

Time, time, time, see whats become of me While I looked around for my possibilities A Hazy Shade of Winter (Paul Simon)

Introduction

Today is Saturday, September 14, 2019 and the exam for CIS1300 is on December 9, 2019. How many days do you have before the exam? Well, you have 86 days! This count includes today but does not include the day of the exam. In other words:

From and including: Saturday, September 14, 2019 To, but not including Monday, December 9, 2019

Wouldnt it be nice to be able to ask how many days separated any two days? Wait no more, you are going to write this wonderfully useful program as your first assignment in CIS1300!

Functionality

You will write this program in increasingly more powerful forms. At each stage you will earn a grade so that it you do all stages you can earn 100% but if you cannot finish the last stage you can earn 80%.

For Stages A to D, both the start date and the end date are in the same year.

[60%] Stage A) ./daysCalculatorA dd1 mm1 yyyy1 dd2 mm2 yyyy2 where dd1 mm1 yyyy1 represents the start date and dd2 mm2 yyyy2 represents the end date. The program returns the number of days for

From and including: Start Date

To, but not including End Date

The output format is just the number. For example,

$ ./daysCalculatorA 14 9 2019 9 12 2019

86

$

[75%] Stage B) ./daysCalculatorB dd1 mm1 yyyy1 dd2 mm2 yyyy2 include where dd1 mm1 yyyy1 represents the start date and dd2 mm2 yyyy2 represents the end date and the string include tells the program to return the value for

From and including: Start Date

To, and including End Date

If include is not on the command line, the program will return the value for

From and including: Start Date

To, but not including End Date

This stage must also test that the start date occurs before the end date.

[85%] Stage C) ./daysCalculatorC dd1-mm1-yyyy1 dd2-mm2-yyyy2 include

where dd1-mm1-yyyy1 represents the start date as a string and dd2-mm2-yyyy2 represents the end date as a string and the string include tells the program to return the value for

From and including: Start Date

To, and including End Date

If include is not on the command line, the program will return the value for

From and including: Start Date

To, but not including End Date

[90%] Stage D) ./daysCalculatorD today dd2-mm2-yyyy2 include

OR ./daysCalculatorD dd1-mm1-yyyy1 today include

This is the same as Stage C except that either of the dates can be the string today

[100%] Stage E) ./daysCalculatorE dd1-mm1-yyyy1 dd2-mm2-yyyy2 include

This is the same as Stage C but the start date and the end date can be in different years. Remember some of the years can be leap years.

Information That You Will Need

How can you calculate the number of days between two days? Instead of using the date format dd-mm-yyyy, you translate the date into the Day-of-Year. Day-of-Year is a number for a date that uses the month and the day. You start by giving January 1 the value 1 and label all other days by adding 1 for each day in order. In other words, January 1 = 1, January 2 = 2, , August 1 = 213, , December 31 = 365. This is true if the year in question is not a leap year. If the year was a leap year than in the previous list, August 1 would be 214 and December 31 would be 366.

The following table contains the Day-of-Year value for the first day of each month in a non-leap year:

Jan: 1 May: 121 Sep: 244
Feb: 32 Jun: 152 Oct: 274
Mar: 60 Jul: 182 Nov: 305
Apr: 91 Aug: 213 Dec: 335

The following table contains the Day-of-Year value for the first day of each month in a leap year:

Jan: 1 May: 122 Sep: 245
Feb: 32 Jun: 153 Oct: 275
Mar: 61 Jul: 183 Nov: 306
Apr: 92 Aug: 214 Dec: 336

On https://nsidc.org/data/tools/doy_calendar.html you will find a nice graphic showing all of the Day-of-Year for each day of the year for non-leap years and leap years.

Checking Your Work

To check your work you can use the following Days Calculator: Days Calculator: Days Between Two Dates https://www.timeanddate.com/date/durationresult.html

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CIS1300 Assignment 1: A Temporal Challenge
$25