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 CarsProject
- {
- public class Car
- {
- private string brand;
- private string model;
- private string year;
- private string color;
- private double price;
- public Car(string carBrand,
- string carModel,
- string carYear,
- string carColor,
- double carPrice)
- {
- this.brand = carBrand;
- this.model = carModel;
- this.year = carYear;
- this.color = carColor;
- this.price = carPrice;
- }
- public void printInfo(Car car)
- {
- Console.WriteLine("Brand: {0}\nModel: {1}\nPrice: {2}", car.brand, car.model, car.price);
- }
- }
- }
- //Главна програма:
- namespace CarsProject
- {
- public class Program
- {
- static void Main(string[] args)
- {
- Car pesho = new Car(
- "Merc", "G65", "2001", "Yellow", 1000
- );
- Car gosho = new Car(
- "VW", "Golf 4", "2004", "Red", 2000
- );
- pesho.printInfo(pesho);
- Console.WriteLine();
- gosho.printInfo(gosho);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement