[ dekibre @ 15.05.2008. 08:30 ] @
Aplicirao sam za posao u jednoj firmi i dobio sam sledeci programming task da ga uradim u C#. Pa evo da ga podelim sa vama i da cujem misljenje iskusnijih kako bi ovo uradili. Programming task Create a simple application which can be used for calculation of the cost from a housing loan. The application should have a simple user interface where the user can specify the desired amount and the payback time in years. For simplicity we assume a fixed interest of 3.5% per year during the complete payback time. The interest should be connected to the loan type in such a manner that different loan types can have different interests. When selecting amount and payback time, the application should generate a monthly payback plan based on the series loan principle, i.e. you pay back an equal amount each month and add the generated interest. The interest is calculated every month. The application should be made in such a manner that it can easily be extended to calculate a payment plan for other types of loans, for instance car loan, spending loan etc. with different interests. Also bear in mind that it should be easy to extend the application to cover other payback schemes as well. We do not expect this to be implemented. Feel free to choose this being a desktop application or a web application, but we expect that you demonstrate reasonable use of the available language functionality for abstraction, interfaces, inheritance, a good class structure and show a good programming practice. We are focused on code quality and good design, so it is nice if you add a design sketch. You will not be judged for correctness in the interest calculation or a fancy GUI: Ja nisam nesto posebno vican .NET programiranju jer sam radio u VB 6.0 kao programer a davno sam ucio C# i retko ga koristim ali sam uradio ovaj programing task onako kako sam znao i umeo. Interesuje me kako bi developeri sa iskustvom ovo uradili jer je za njih ovo verovatno macji kasalj. Moja ideja je bila a opet rukovodeci se onim sto je zahtevano da napisem kod za jednu osnovnu klasu koja ce imati metode za preracunavanje Monthly payments i OtherPaybackSchema a da onda za odredjene loan types pravim klase koje nasledjuju osnovnu klasu i overriduju po potrebi metode iz osnovne klase. Evo koda kako sam ga ja uradio: BaseLoan.cs Code: namespace LoanPaybackPlan { class BaseLoan { public virtual double CalculateMonthlyPayment ( double Amount, double AnnualInterestRate, double PaybackTimeInYears ) { double MonthlyPayment; MonthlyPayment = Financial.Pmt ( AnnualInterestRate/ 100 / 12, PaybackTimeInYears * 12, -Amount, 0, DueDate.EndOfPeriod ); return MonthlyPayment; } public virtual double OtherPaybackSchema() { return 100; } } } Izvedena klasa za CarLoan loan type CarLoan.cs Code: namespace LoanPaybackPlan { class CarLoan : BaseLoan { public override double CalculateMonthlyPayment(double Amount, double AnnualInterestRate, double PaybackTimeInYears) { double MonthlyPayment; MonthlyPayment = Financial.PPmt ( AnnualInterestRate / 100 / 12, PaybackTimeInYears * 12, PaybackTimeInYears * 12, -Amount, 0, DueDate.EndOfPeriod ); return MonthlyPayment; } } } Hvala unapred na vasem misljenju i savetima. |