Loading...
boyanm avatar boyanm 0 Точки

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;
            }
        }
    }
}

 

Тагове:
0
Programming Basics 23/04/2018 10:15:19
etkristaVladimirova avatar etkristaVladimirova 4 Точки

Здравейте, решавам тази задача: https://judge.softuni.bg/Contests/Practice/Index/2507#2 и получавам 81/100. Някъде имам грешка, но не я виждам (сигурно ще ми извади очите, ама ей на!!). Може ли някой да погледне моето решение?

https://pastebin.com/bZFt0wh4

0
svephoto avatar svephoto 1191 Точки

Здравей, etkristaVladimirova,

 

Виж този вариант на твоето решение с известни промени - с такава структура на кода аз бях решил задачата: https://pastebin.com/dtQmdKMa. Минава със 100/100, надявам се да ти е полезен.

1
etkristaVladimirova avatar etkristaVladimirova 4 Точки

Благодаря за помощта, много полезно е да видя и други варианти!
Вчера, след като забих, оставих задачата за час-два и се сетих какво пропускам - поръчки за количества от 10 до 30. :D
Благодаря отново!

2
svephoto avatar svephoto 1191 Точки

Моля, радвам се да помогна. yes

Относно поръчките: според мен освен за тези в случая, в който са от 10 до 30 (а именно при първия вариант с размери "90X130"), също и за другите три, съответно за поръчки от 10 до 40 ("100X150"), от 10 до 20 ("130X180") и от 10 до 25 ("200X300"). laugh

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.