Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
01. Square root of number
02. Read Ten numbers in given range
03. Read file content
04. Download from I-net
06. Exception Handling.sln
06. Exception Handling.zip
Exception-Handling.pptx
Readme.md

Readme.md

Exception Handling

  1. Write a program that reads an integer number and calculates and prints its square root. If the number is invalid or negative, print "Invalid number". In all cases finally print "Good bye". Use try-catch-finally.
  • Write a method ReadNumber(int start, int end) that enters an integer number in given range [start...end]. If an invalid number or non-number text is entered, the method should throw an exception. Using this method write a program that enters 10 numbers: a1, a2, ... a10, such that 1 < a1 < ... < a10 < 100
  • Write a program that enters file name along with its full file path (e.g. C:\WINDOWS\win.ini), reads its contents and prints it on the console. Find in MSDN how to use System.IO.File.ReadAllText(). Be sure to catch all possible exceptions and print user-friendly error messages.
  • Write a program that downloads a file from Internet (e.g. http://www.devbg.org/img/Logo-BASD.jpg) and stores it the current directory. Be sure to catch all exceptions and to free any used resources in the finally block.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.