Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
4.4 kB
6
Indexable
Never
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YINON
{
    class Car
    {
        private string company;
        private string modle;
        private int year;
        public Car(string company, string modle, int year)
        {
            this.company = company;
            this.modle = modle;
            this.year = year;
        }
        public Car copy()
        {
            Car new1 = new Car(this.company, this.modle, this.year);
            return new1;
        }
        public bool checkequal(Car other)
        {
            if (this.company == other.company && this.modle == other.modle && this.year == other.year)
            {
                return true;
            }
            return false;
        }

        public bool cheakyear()
        {
            if (this.year > 2018)
            {
                return true;
            }
            return false;
        }
        public string tostr()
        {
            return "company name: " + this.company + "   " +
                "model :" + this.modle + "   " +
                "year: " + this.year;
        }
    }
    class Movie
    {

        private string title;
        private string directure;
        private int releseyear;
        private double rating;
        public Movie(string title, string directure, int releseyear, double rating)
        {
            this.title = title;
            this.directure = directure;
            this.releseyear = releseyear;
            this.rating = rating;
        }
        public Movie copyer()
        {
            Movie new1 = new Movie(this.title,this.directure,this.releseyear,this.rating);
            return new1;

        }
        public bool equal(Movie other)
        {
            if(this.title == other.title&& this.directure == other.directure&& this.rating == other.rating&& this.releseyear == other.releseyear)
            {
                return true;
            }
            return false;
        }
        public bool checkrating()
        {
            if (this.rating > 3.5) { return true; }
            return false;
        }
        public string toString()
        {
            return "title: " + this.title + "   " +
            "directure: " + this.directure + "   " +
            "relese year:  "+this.releseyear +"   "+
            "rating: " + this.rating + "   ";

        }
    }
    class emploay
    {
        private string name;
        private string job;
        private int salery;
        public emploay(string name, string job, int salery)
        {
            this.name = name;
            this.job = job;
            this.salery = salery;
        }
        public emploay copyerr()
        {
            emploay new2 = new emploay(name, job, salery);
            return new2;
        }
        public bool equal(emploay other)
        {
            if (this.name != other.name || this.job != other.job || this.salery != other.salery)
            {
                return false;
            }
            return true;
        }
        public bool check()
        {
            if(this.salery > 2000)
            {
                return true;
            }
            return false;
        }
        public string tostr()
        {
            return "name:" + this.name + "  " +
            "job: " + this.job + "  " +
            "salary " + this.salery + "  ";
        }
    }
    internal class Program
    {
        static void ex1()
        {
            Car c1 = new Car("yinonim", "salem model ", 2020);
            Car c2 = c1.copy();
            Console.WriteLine(c1.checkequal(c2));
            Console.WriteLine(c1.cheakyear());


        }
        static void ex2()
        {
            Movie v1 = new Movie("YINON", "yinon69", 202020, 5.5);
            Movie v2 = v1.copyer();
            Console.WriteLine(v1.equal(v2));
            Console.WriteLine(v2.checkrating());

        }
        static void ex3()
        {
            emploay e1 = new emploay("yinon", "salsal", 100000);
            emploay e2 = e1.copyerr();
            Console.WriteLine(e1.check());
        }
        static void Main(string[] args)
        {

            ex3();
        }
    }
}
Leave a Comment