Programming in C#

Internal Resources

 

Login is required to view all content and to download files in this section.
Do not enter your LDAP credentials. A common user name and password were set for all students at the beginning of semester.

Public Resources

 

No login is required.
If provided, read carefully additional texts that can contain some helpful information on the origins of the files, licence agreements, etc.

Lesson 1

This is an introductory lesson before the lectures. The main goal of the lesson is to find out the knowledge of students in the area of programming, regardless the programming language. Moreover, paradigm of the object-oriented programming will be discussed as this was the topic of the last course the students must pass.

 

Prerequisites

  • knowledge from the previous courses

 

Topics and Tasks

  • Visual Studio 2019, VSCode IDE

Lesson 2

Prerequisites

  • dotnet core 3.1 console application
  • console input/output
  • basic statements

 

Topics and Tasks

  • Crete a new console application from the command line (CLI)
  • Try to compile and execute the application using CLI
  • Disassembly the application to create IL code in the readable form (standard text format)
  • Open the application in selected IDE (Visual Studio 2019 is recommended)

 

Now, create a program that:

  • Ask user to enter a year in four digits format (e.g. 2020)
  • Convert the input into a numeric format. If everything is OK continue, otherwise write custom Error message and close the app.
  • Test whether the year is a leap-year or not. The year is called leap-year if the the remainder after dividing by four is 0 AND  the remainder after dividing by one hundred is not zero; but also if  the remainder after dividing by four hundred is equal to zero.
  • If the year is a leap-year, write the year in the standard output, otherwise write the number of years until the next leap-year.
  • Update your code such that you will ask the user again in case of invalid input, until you have a valid input.