Last updated: 2017-08-23 6:45pm

Frequently asked questions about the assignment will be answered here.

If you have questions that aren't answered here, please ask them on the main assignment 0 page , not here. Those questions and their answers may be added to this FAQ.


Are we allowed to create our own functions?

Yes, you are allowed to create your own functions, which you will call from the getLocalTime function. It would be a very good idea to make use of your own functions, as it would be very hard to design a nice solution without making use of your own functions.


Can we assume that the dates will be in 2017?

Yes. You're given the day and the month, and you can assume the year will always be 2017.


What timezone are the day and month that we're given in? UTC or local time?

The day and month that you're given will be in UTC time.


How do I represent 8am as a time?

8am would be "0800" in 24 hour time; however, we can't add zeroes to the start of a number in C, so "0800" would be represented as the number "800".


Will our function be given invalid input?

(e.g. a city of -1, a month greater than 12, etc)

No, you can assume that your function will only be given valid input. You don't need to check for cases where the input is invalid.


Can we use arrays in this assignment?

Nope, you can only use syntax that was covered at the point the assignment was released. This means you can use if statements and functions, but not loops or arrays etc.


Does the program need to take an input from the user in the main function?

Nope, the only thing you need to do is write the getLocalTime function. You don't need to worry about scanning or printing anything.

You can use the main function for unit tests (like the stub code has already), where you type out by hand (rather than scanning in) what the inputs should be, and what the expected output is.


Do we have to use all of the #defines in our program?

No. However, you shouldn't be using any of those values directly -- e.g. you shouldn't be checking "if (city == 0)" instead of "if (city == CITY_ADELAIDE)" -- I would consider that incorrect.

Similarly, you shouldn't be using the timezone offsets directly -- e.g. rather than saying something like "localTime += 1100" for something that's in AEDT, you should say "localTime += TIMEZONE_AEDT".


What does the #define TRUE 1 and #define FALSE !TRUE in our program mean?

They're a way of specifying "true" and "false" in your program, so if you had a function that did something like "determine if a number is even", it would return TRUE; or return FALSE;

You don't have to use them in your solution, but if you have functions at any point that return a yes/no or true/false value, it would be best to use the #defined values.


Do we have to use the exact dates and times for daylight savings in each city?

Yes, otherwise your program won't correctly calculate the local time.


I think the unit test for ______ is wrong.

It's entirely possible -- everybody makes mistakes.

First, check the assignment stub code to see whether it has been fixed there. If it's not fixed there, check out the comments at the bottom of the assignment page -- has somebody else asked the same question? If not, try using an online timezone converter to check the test manually.

If you still think the unit test might be wrong, then comment on the assignment page and we'll have a look.


Resource created Monday 14 August 2017, 09:18:46 PM, last modified Monday 12 February 2018, 05:00:50 PM.


Back to top

COMP1511 17s2 (Introduction to Programming) is powered by WebCMS3
CRICOS Provider No. 00098G