Programming Basics Online Exam - 14 and 15 April 2018 3. Aluminium Joinery - имам нужда от помощ немога да разбера къде греша
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aluminia
{
class Program
{
static void Main(string[] args)
{
int Countdograma = int.Parse(Console.ReadLine());
string Typedograma = Console.ReadLine();
string typepolu4avane = Console.ReadLine();
double prise = 0.0;
switch (Typedograma)
{
case "90X130":
prise = 110;
if (Countdograma>=10)
{
if (Countdograma >= 30 && Countdograma < 60)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.05;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.05;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 60 && Countdograma < 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.08;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.08;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.08;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.08;
prise += 60;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
}
}
else
{
Console.WriteLine("Invalid order");
}
break;
case "100X150":
prise = 140;
if (Countdograma>=10)
{
if (Countdograma >= 40 && Countdograma < 80)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.06;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.06;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 80 && Countdograma < 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.1;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.1;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.1;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.1;
prise += 60;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
}
}
else
{
Console.WriteLine("Invalid order");
}
break;
case "130X180":
prise = 190;
if (Countdograma>=10)
{
if (Countdograma >= 20 && Countdograma < 50)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.07;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.07;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 50 && Countdograma < 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.12;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.12;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.12;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.12;
prise += 60;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
}
}
else
{
Console.WriteLine("Invalid order");
}
break;
case "200X300":
prise = 250;
if (Countdograma>=10)
{
if (Countdograma >= 25 && Countdograma < 50)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.09;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.09;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 50 && Countdograma < 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.14;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.14;
prise += 60;
Console.WriteLine($"{prise:f2} BGN");
}
}
else if (Countdograma >= 99)
{
if (typepolu4avane == "Without delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.14;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
else if (typepolu4avane == "With delivery")
{
prise = prise * Countdograma;
prise -= prise * 0.14;
prise += 60;
prise -= prise * 0.04;
Console.WriteLine($"{prise:f2} BGN");
}
}
}
else
{
Console.WriteLine("Invalid order");
}
break;
}
}
}
}
Здравей, etkristaVladimirova,
Виж този вариант на твоето решение с известни промени - с такава структура на кода аз бях решил задачата: https://pastebin.com/dtQmdKMa. Минава със 100/100, надявам се да ти е полезен.
Благодаря за помощта, много полезно е да видя и други варианти!
Вчера, след като забих, оставих задачата за час-два и се сетих какво пропускам - поръчки за количества от 10 до 30. :D
Благодаря отново!
Моля, радвам се да помогна.
Относно поръчките: според мен освен за тези в случая, в който са от 10 до 30 (а именно при първия вариант с размери "90X130"), също и за другите три, съответно за поръчки от 10 до 40 ("100X150"), от 10 до 20 ("130X180") и от 10 до 25 ("200X300").