[SOLVED] CO222 -Programming Methodology - Project 1- Digital Clock - Specification

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

Objectives

Making you familiar with,

  • Arrays
  • Loops
  • Functions
  • Command-line argument handling
  • Debugging
  • Good coding practices
  • Linux environment

Introduction

You have to develop a digital clock that prints the current time, and date on the linux terminal. If a color is given as an argument to the program, the program should be able to print a colored output. You will be given a sample program (prog) that would do the same task. Your task is to replicate the functionality of the given program. Below figures show the expected output from your program.

The output should print exactly at the same place and scale as the given program

(prog)

Inputs:

Command-line arguments:

  • If a colour is given as an argument to the program with the ‘-c’ flag, the program should be able to print the clock using the given colour. If no argument is given, use black and white as default.

Eg: ./prog -c red

  • These colors should be supported by the program – black, red, green, yellow, blue, magenta, cyan
  • If -h flag is given or the given arguments are invalid, you should print the usages of your program (how the arguments should be given). See the sample binary given for the expected behaviour.

Problem breakdown

Instead of directly going to code the solution, you must break down the problem into smaller subproblems, such as

  1. How to get user inputs as arguments
  2. How to get the current system time
  3. How to get the current system time as a string
  4. How to print a number
  5. How to print multiple numbers at different positions
  6. How to print the date
  7. How to assign a color to printed characters
  8. Error handling for the program

Instead of thinking about the problem as a whole, try and find the solutions for each one of the above questions. That will help you to reach the final goal smoothly and accumulatively.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.