switch-case计算销售提成
慕姜
100w<=利润<110w部分提:1%
60w<=利润<100w部分提:1.5%
40w<=利润<60w部分提:3%
20w<=利润<40w部分提:5%
10w<=利润<20w部分提:7.5%
利润<10w部分提:10%
假定利润额不会超过110w(110w以上部分不考虑)
以下是我这个小白白写的,错的,只能输出第一个switch,其他数值可以运行但什么都不输出,求大神详解( ▼-▼ )
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ticheng
{
class Program
{
static void Main(string[] args)
{
double bonus = 1000000;
double one=0.01;
double two=0.015;
double three=0.03;
double four=0.05;
double five=0.075;
double six=0.1;
char times = '*';
if (bonus >= 1000000 && bonus <= 1100000)
{
switch (times)
{
case '*': Console.Write(bonus * one); break;
}
if(bonus>=600000&&bonus<1000000)
{
switch(times)
{
case '*': Console.Write(bonus * two); break;
}
if (bonus >= 400000 && bonus < 600000)
{
switch (times)
{
case '*': Console.Write(bonus * three); break;
}
if (bonus >= 200000 && bonus < 400000)
{
switch (times)
{
case '*': Console.Write(bonus * four); break;
}
if (bonus >= 100000 && bonus < 200000)
{
switch (times)
{
case '*': Console.Write(bonus * five); break;
}
if (bonus < 100000)
{
switch (times)
{
case '*': Console.Write(bonus * six); break;
}
if (bonus > 1100000)
Console.WriteLine("老板让给你!");
}
}
}
}
}
}
}
}
}
望远