9. C-sharp 3 03-09-2013

Created Saturday 23 November 2013

** Classes and methods
*** 2124 Module 5: Methods and Parameters
*** Method, procedure, function } subroutine
*** Think methods
*** Before method name has to be 'void' or type name
*** After method name have to be '()' with or without parameters:
void Main(string[] args){}
*** Console app always begins and ends executing from and within Main()
*** Except for Main() all other methods are passive and should be called within Main() to be executed
*** F11 - 'Step into' - step into method
*** 'void' - for pure subroutine that doesn't return results of its calculations
*** Methods that return results instead of 'void' have to be prepended by their result's type
*** For simplicity there should be always 1 return in the end
*** No returns for exiting programs
*** Should be able to analyze tasks to methods on the fly
*** TDD - test driven development (development through debugging unworking app):
1) Write logical blocks: method and variables names to receive
logic structure and complaining debugger
2) Make minimum changes to shut up the debugger
3) When the basic skeleton is ready - continue to change the code through this cycle
*** Method always should do one task, as simple as possible (cohesive method)
*** Loosely coupling - different app's components should be independent as possible
*** Shared variables - 'global' class's variables
*** Naming rule: procedure named by verb, function by noun
** Home work
1) Module 5 2124
2) Input from keyboard letter naming a bank (A - Apualim, M - Mizrahi, D - Discont, L - Leumi).
Check input for these letters.
Then input 1, 7 or 30 (one day, week, month). Then input number between 0 and 500000 (including).
The program should calculate the income for the given period of time and the given number.
Taken from:
http://www.bankrate.co.il/site/banking_pikdonot_shikliim.asp
| Days | Investment | hApoalim | Mizrahi | Discount | Leumi |
|------+---------------+----------+---------+----------+-------|
| 1 | 0-10000 | 0% | 0.01% | 0.05% | 0.1% |
| | 10000-100000 | 0% | 0.01% | 0.05% | 0.13% |
| | 100000-500000 | 0% | 0.1% | 0.05% | 0.14% |
| 7 | 0-10000 | 0.01% | 0.02% | 0.05% | 0.11% |
| | 10000-100000 | 0.03% | 0.03% | 0.05% | 0.14% |
| | 100000-500000 | 0.03% | 0.12% | 0.05% | 0.15% |
| 30 | 0-10000 | 0.01% | 0.02% | 0.05% | 0.12% |
| | 10000-100000 | 0.03% | 0.03% | 0.05% | 0.15% |
| | 100000-500000 | 0.03% | 0.12% | 0.05% | 0.16% |



Backlinks: