using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment13 {
class Car
{
int Speed = 0;
double Temp = 0.0;
public void setSpeed(int speed)
{
this.Speed = 50;
}
public void getSpeed()
{
return;
}
public void setTemp(double Temp)
{
this.Temp = 70.5;
}
public void getTemp()
{
return;
}
}
class program
{
static void Main (string[]args)
{
Car ford = new Car();
ford.setSpeed(50);
ford.setTemp(70.5);
Console.WriteLine("Speed = " + ford.setSpeed);
Console.WriteLine("Temp = " + ford.setTemp);
Console.Write("Hit any key to close"); Console.ReadKey(true);
}
}
}
我無法打印出速度和溫度//如何添加參數 list要符合方法簽名?溫度和價格?
Console.WriteLine( 「速度=」 + ford.get); Console.WriteLine(「Temp =」+ ford.get); –