Advertisement
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;
- using System.Threading.Tasks;
- namespace ConsoleApp15
- {
- class Program
- {
- static void Main(string[] args)
- {
- Person person = new Person();
- Person person1 = new Person("Pesho", "Ivanov", 30, 1000);
- person1.Percent();
- person.Percent();
- }
- }
- class Person
- {
- private string firstname;
- private string lastname;
- private int age;
- private double zaplata;
- public Person(string firstname, string lastname, int age, double zaplata)
- {
- this.firstname = firstname;
- this.lastname = lastname;
- this.age = age;
- this.zaplata = zaplata;
- }
- public Person()
- {
- this.firstname = "Kaloyan";
- this.lastname = "Stoilov";
- this.age = 16;
- this.zaplata = 900;
- }
- public string Getfirstname()
- {
- return this.firstname;
- }
- public void Setfisrtname(string firstname)
- {
- this.firstname = firstname;
- }
- public string Getlastname()
- {
- return this.lastname;
- }
- public void Setlastname(string lastname)
- {
- this.lastname = lastname;
- }
- public int Getage()
- {
- return this.age;
- }
- public void Setage(int age)
- {
- this.age = age;
- }
- public void Percent()
- {
- Console.WriteLine("{0}", zaplata);
- int percent = int.Parse(Console.ReadLine());
- if (percent > 0 && percent <= 100)
- {
- if (age < 30)
- {
- Console.WriteLine("{0}", (zaplata * percent) / 100 / 2 + zaplata);
- }
- else
- {
- Console.WriteLine("{0}", (zaplata * percent) / 100 + zaplata);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement