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 OBJECTORIENTATEDCODE
- {
- class Program
- {
- static void Main(string[] args)
- {
- Vehicle mini = new Vehicle()
- {
- type = "car",
- numwheels = 4,
- topspeed = 90.00,
- cost = 11000.00
- };
- Vehicle eddiestobart = new Vehicle()
- {
- type = "lorry",
- numwheels = 16,
- topspeed = 60.00,
- cost = 111000.00
- };
- mini.licencetype();
- eddiestobart.licencetype();
- }
- }
- class Vehicle
- {
- public string type;
- public int numwheels;
- public double cost;
- public double topspeed;
- public void licencetype()
- {
- // Console.WriteLine("Number of sides " + this.numberofsides);
- // Console.WriteLine("Side length " + this.sidelength);
- // Console.WriteLine("Regular? " + this.regular);
- if (this.type == "car")
- {
- Console.WriteLine(this.type + " B");
- }
- if (this.type == "lorry")
- {
- Console.WriteLine(this.type + " CE");
- }
- if (this.type == "motorcycle")
- {
- Console.WriteLine(this.type + " A");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement