Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Unesite broj soba: ");
- int sobe = Convert.ToInt16(Console.ReadLine());
- Console.Write("Unesite broj brSpratova: ");
- int spratovi = Convert.ToInt16(Console.ReadLine());
- Console.Write("Unesite cenu: ");
- int Cena = Convert.ToInt16(Console.ReadLine());
- Kuca x = new Kuca(sobe, spratovi, Cena);
- Kuca.Dobrodoslica();
- x.Luksuz('d');
- x.ispis();
- Console.ReadLine();
- }
- }
- class Kuca
- {
- private int brSoba;
- private int brSpratova;
- private int cena;
- public Kuca(int brSoba, int brSpratova, int cena)
- {
- this.brSoba = brSoba;
- /* Ja bih to ovako uradio:
- if(brSpratova <= 0)
- this.brSpratova = 1;
- else
- this.brSpratova = brSpratova;
- */
- this.brSpratova = brSpratova;
- this.cena = cena;
- }
- public static void Dobrodoslica()
- {
- Console.WriteLine("\nDobrodosli u agenciju za nekretnine");
- }
- public void ispis()
- {
- Console.WriteLine("Broj soba: " + brSoba);
- Console.WriteLine("Broj brSpratova: " + brSpratova);
- Console.WriteLine("Cena: " + cena);
- }
- public void Luksuz(char x)
- {
- if (x == 'd')
- cena = cena + 1000;
- }
- public int BrSpratova // ne razumem koji ce joj ovo ***** kada nista ne radi.
- {
- get { return this.brSpratova; }
- set
- {
- if(value == 0)
- this.brSpratova = 1;
- else
- this.brSpratova = value;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment