اذهب إلى المحتوى
  • 0

مساعدة في لغة #c

نديم يافاوي

السؤال

السلام عليكم
كيف يمكن كتابة وبرمجة هذا المشروع 
عفوا اخواني على هذا الكود بسبب دمج اللغتين السويدية والانكليزية لهذا يمكن ان يكون متعب للبعض 
جزيل الشكر

 

 

In this task, you will create a class named Bil

For a Bil object you should be able to specify a årsmodell with a set method and obtain the årsmodell with a get method

()The Bil must have its two states " Bilen kör " and " Bilen står stilla ", which one can read with the method status  

()Initially, the Bil condition " står stilla " but it changes if you call the method start

"One can stop the Bil with the stop () method and then of course the status changes to " står stilla

 

Below I test the class Bil and wrote the following in main

public static void Main(string[] args)
{
  Bil fiat = new Bil();
  fiat.setYear(2017);
  Console.WriteLine("Har nu skaffat mig en bil av " + fiat.getYear() + " års modell");
  Console.WriteLine(fiat.status());
  Console.WriteLine("Försöker starta bilen");
  fiat.start();
  Console.WriteLine("Måste kolla om du kom igång... " + fiat.status());
  Console.WriteLine("Försöker få stopp på bilen");
  fiat.stop();
  Console.WriteLine("Ska se om jag lyckades stanna den också... " + fiat.status());
  Console.ReadKey();
}

 

The following will appear on the screen:

 

Har nu skaffat mig en bil av 2017 års modell
Bilen står stilla
Försöker starta bilen
Måste kolla om du kom igång... Bilen kör
Försöker få stopp på bilen
Ska se om jag lyckades stanna den också... Bilen står stilla

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

لا توجد أي إجابات على هذا السؤال بعد

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...