Я не могу понять, как передать общее количество, продажу и comm в Main().C# консольное приложение - калькулятор комиссии - как передать переменные в Main()
Кто-нибудь понял, как получить эти переменные в Main и отобразить (выводить) их там с именами?
Прямо сейчас я могу только выходные переменные в calcComm ...
Заранее спасибо
Филипп
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication38
{
class Program
{
public static void getsales()
{
string inputsales;
double total = 0;
double sale = 0;
for (int salecount = 1; salecount <= 3; ++salecount)
{
Console.WriteLine("Enter sale: ");
inputsales = Console.ReadLine();
sale = Convert.ToDouble(inputsales);
total = total + sale;
}
calcComm(total);
}
public static void calcComm(double total)
{
double comm = 0;
comm = total * 0.2;
Console.WriteLine(comm);
}
public static void Main()
{
Console.WriteLine(" Sunshine Hot Tubs \n Sales Commissions Report\n");
char Letter;
const string name1 = "Andreas";
const string name2 = "Brittany";
const string name3 = "Eric";
string inputLetter;
string name;
Console.WriteLine("Please enter intial or type 'z' to quit");
inputLetter = Console.ReadLine();
Letter = Convert.ToChar(inputLetter);
while (Letter != 'z')
{
if (Letter == 'a')
{
name = name1;
getsales();
}
else if (Letter == 'b')
{
name = name2;
getsales();
}
else if (Letter == 'e')
{
name = name3;
getsales();
}
else
{
Console.WriteLine("Invalid entry try again");
}
Console.WriteLine("Please enter intial or type z to quit");
inputLetter = Console.ReadLine();
Letter = Convert.ToChar(inputLetter);
}
}
}
}
Не могли бы вы в конечном итоге показать мне свою программу, как это сделать, потому что я пробовал это раньше, но тип возврата «void» испортил его. После этого я сдался. : D Я очень новичок в C#, извините, если я говорю глупо. Было бы здорово, если бы вы могли показать мне! Заранее спасибо. –