問題出現在第34行: 不能隱式地將類型'double'轉換爲'int'。存在明確的轉換(您是否缺少演員?)不知道如何轉換這個..或者什麼是雙...新程序員
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string FirstName;
string LastName;
int Hours = 0;
int OvertimeHours = 0;
int HourlyPay;
int GrossPay;
//float AveragePay;
Console.WriteLine("Please enter your first name!");
FirstName = Console.ReadLine();
Console.WriteLine("Please enter your last name!");
LastName = Console.ReadLine();
Console.WriteLine("How many hours have you worked this week?");
Hours = Int32.Parse(Console.ReadLine());
Console.WriteLine("How many overtime hours did you work this week?");
OvertimeHours = Int32.Parse(Console.ReadLine());
Console.WriteLine("What is your hourly pay ?");
HourlyPay = Int32.Parse(Console.ReadLine());
if (Hours > 40)
GrossPay = (OvertimeHours * HourlyPay *1.5) + (Hours * HourlyPay);
else
GrossPay = (Hours * HourlyPay);
Console.ReadLine();
}
}
}
我不知道現在該做什麼,以及什麼是雙。我仍然是一個非常新的程序員,只有幾個星期的經驗,任何和所有的幫助將不勝感激,謝謝。
歡迎來到堆棧溢出。恐怕這不是教程網站。您可以使用Google找到許多教程,並且有許多書籍可以在[Amazon](http://www.amazon.com)上找到。或者你可以問老師給你分配的幫助;他們正在獲得報酬,爲您提供完成所需的內容。 –
本例中的'double'來自'1.5'。當你乘以小數時,它假定你使用的是雙精度。嘗試將「GrossPay」加倍。 –
您通過Google找到了我認爲,爲什麼不以同樣的方式搜索'double'? – MickyD