CSCI 370 Spring 2024 - Assignment 8
Due: 23:59, 22 March 2023, Friday

Note that your solution program will be marked based on whether it

If your program has compile-time errors (on otter), you get zero for this assignment.

Assignment Information

For this assignment, you are required to develop a database application program for the Forum Management using the following relational schema (primary keys are underlined) described in Assignment 1.

Users(username, nickname, contactInfo, signupDate, status)
Hosts(username)
Channels(channelName, description, creator, createTime)
ActiveSubscriptions(username, channel, subscribeTime)
Messages(messageID, messageBody, poster, channel, postTime, replyToMessage)
SubscribeHistory(username, channel, subscribeTime, unsubscribeTime)

Many more details, including constraints, data types, etc., are captured in the SQL definitions of these tables.

Your database application program must be developed using C++ plus the Oracle CLI occi.

Problem Description:

Develop a database application used by the Forum Management to generate a summary and monthly activity report for a given year about the Forum.

Your program should accept a year number as its command line argument, and then retrieve the relevant data from the database to print the monthly activity report to a text file named Report.txt. You can view a sample report file (for year 2023) here.

Your program should first verify that the year number provided as command line argument is an integer number between 2015 (the year the hypothetical Forum started) and 2023 (last full year of the Forum) (inclusive). If the year number is invalid, show an appropriate message and terminate the program.

The report includes three parts of information.

The first part of the report is a monthly activity report. For each month of the given year, print the month's shortened name, the number of new users signed up to the forum in the given year/month, and the number of messages posted to all the channels in the given year/month. This part of the report should be ordered by the natural month order.

Note that "to_char(signupDate, 'yyyy')" can be used to find new users signed up in the given year, and then among these qualified new users, "to_char(signupDate, 'mm')" can be used to classify these new users to the appropriate month.

The second part of the report finds the top 3 most active users as the 3 users who posted the most messages in the given year, and prints their username, nickname and the actual number of messages posted in the given year.

The third part of the report finds the top 3 most active channels as the 3 channels have the most posted messages in the given year, and prints their channel name, creator's username and the actual number of messages in these channels in the given year.

Since this program will run to generate just one report at a time, it is not necessary to use prepared SQL statements. However, user input (including the command line argument) must be sanitized if unprepared SQL statements are used.

One of the important principles of developing a database application program is to trust the database management system and minimize the use of customized code as much as possible. One of such trust is to use the database sorting algorithm instead of use your own sorting functions.

To get full marks for this assignment, use at most two SQL statements to retrieve the part one data, and one SQL statement each for part two and part three data respectively.

Note that in rare cases, there can be ties to make it difficult to decide who should be included in the top three most active users/channels. You can make up your own rules to break the ties, or you can simply make an assumption that ties don't exist entirely.

How to Submit

Note that your source code file should have the proper header and inline comments to help me understand your program logic.

This is a relatively simple program, business logic wise, so I don't think that multiple modules/files are necessary. However, I do expect and demand that functions are used to achieve a proper level of abstraction in your program.

If your program (the one I'm supposed to mark) can't compile on our csci server (otter), you get 0 for this assignment. So at least compile and test run your program once on otter before you upload it to VIU Learn.

Submit ONLY your source code file (*.cpp) to A8 under CSCI 370's assessment and assignments tab on VIU Learn.

You can submit multiple times, please make sure that I understand which file is the one you would like me to mark.


Last updated: March 5, 2024