C# Console App University Workloads Basic

C# Console App University Workloads Basic

27/04/2020 0 By Admin

This C# console app asks the user to input a range of data related to their university hours-based workload:

  • First name,
  • Last name,
  • Current date,
  • Quantity of students taught,
  • Number of research papers published,
  • Number of research grants obtained,
  • Number of short meetings attended,
  • Number of standard meetings attended,
  • Number of students in the course for which user ins the acting coordinator, [pro rata calculation coded here]
  • Number of weeks as acting course coordinator [ditto]

The app will evaluate this data and print to the screen something like this:

As of 23/03/2018 12:00:00 AM Your total workload hours combining teaching and research and meetings and acting course course coordinator is : 643.26

Explanation

Basic functionality: – The program:

  • Requires the user to input data related to their workload.
  • This is calculated in hours, as in this university (example) an academic’s workload is calculated in terms of hours and not eftsl.
  • The values are are assigned to variables and these can be changed according the values that the organisational unit allocates a particular workload activity.

Explanation

Lines 15-22 declare variables.

Line 18 declares and initialises a variable. [variables must be declared before they can be used]

Lines 24-32 variously request and read user input.

Lines 33 – 42 requests the user to input the date.  There is a simple if / else condition that evaluates the correct input format, and alerts the user if the correct format is not used.

Line 69 is an example of how to convert the user’s string input from line 68  into a numeric value, in this instance a double (allowing for much larger numbers. See: data types)

Line 73 is an example of the calculation of hours using variables and operators (quantity * standardMeetings) which have already been initialised as doubles.

Needing Attention

This app will:

  1. throw errors in some instances, as it has not yet  been coded to prevent the user from entering incorrect input.
  2. accept user input that is not valid.

Follow-up

We will now turn this console app into an executable windows app.