joro_thexfiles

Магазин за плодове

Mar 13th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _1.Обръщение_според_възраст_и_пол
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string fruit = Console.ReadLine().ToLower();
  14.             string dayOfWeek = Console.ReadLine().ToLower();
  15.             double quantity = double.Parse(Console.ReadLine());
  16.             double value = 0.0;
  17.  
  18.             if (dayOfWeek == "monday" || dayOfWeek == "tuesday" || dayOfWeek == "wednesday" || dayOfWeek == "thursday" || dayOfWeek == "friday")
  19.             {
  20.                 if (fruit == "banana")
  21.                 {
  22.                     value = quantity * 2.50;
  23.                 }
  24.                 else if (fruit == "apple")
  25.                 {
  26.                     value = quantity * 1.20;
  27.                 }
  28.                 else if (fruit == "orange")
  29.                 {
  30.                     value = quantity * 0.85;
  31.                 }
  32.                 else if (fruit == "grapefruit")
  33.                 {
  34.                     value = quantity * 1.45;
  35.                 }
  36.                 else if (fruit == "kiwi")
  37.                 {
  38.                     value = quantity * 2.70;
  39.                 }
  40.                 else if (fruit == "pineapple")
  41.                 {
  42.                     value = quantity * 5.50;
  43.                 }
  44.                 else if (fruit == "grapes")
  45.                 {
  46.                     value = quantity * 3.85;
  47.                 }
  48.                 //else
  49.                 //{
  50.                 //    Console.WriteLine("error");
  51.                 //}
  52.                
  53.  
  54.  
  55.             }
  56.  
  57.             else if (dayOfWeek == "saturday" || dayOfWeek == "sunday")
  58.             {
  59.                 if (fruit == "banana")
  60.                 {
  61.                     value = quantity * 2.70;
  62.                 }
  63.                 else if (fruit == "apple")
  64.                 {
  65.                     value = quantity * 1.25;
  66.                 }
  67.                 else if (fruit == "orange")
  68.                 {
  69.                     value = quantity * 0.90;
  70.                 }
  71.                 else if (fruit == "grapefruit")
  72.                 {
  73.                     value = quantity * 1.60;
  74.                 }
  75.                 else if (fruit == "kiwi")
  76.                 {
  77.                     value = quantity * 3.0;
  78.                 }
  79.                 else if (fruit == "pineapple")
  80.                 {
  81.                     value = quantity * 5.60;
  82.                 }
  83.                 else if (fruit == "grapes")
  84.                 {
  85.                     value = quantity * 4.20;
  86.                 }
  87.                 //else
  88.                 //{
  89.                 //    Console.WriteLine("error");
  90.                 //}
  91.                
  92.  
  93.             }
  94.  
  95.             if (value >0)
  96.             {
  97.                 Console.WriteLine($"{value:F2}");
  98.             }
  99.             else
  100.             {
  101.                 Console.WriteLine("error");
  102.             }
  103.  
  104.             //Console.WriteLine($"{value:F2}");
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.             //double age = double.Parse(Console.ReadLine());
  112.             //string gender = Console.ReadLine();
  113.             //
  114.             //if ( gender == "m")
  115.             //{
  116.             //    if (age >= 16)
  117.             //    {
  118.             //        Console.WriteLine("Mr.");
  119.             //    }
  120.             //    else
  121.             //    {
  122.             //        Console.WriteLine("Master");
  123.             //    }
  124.             //
  125.             //}
  126.             //else if (gender == "f")
  127.             //{
  128.             //    if ( age >= 16)
  129.             //    {
  130.             //        Console.WriteLine("Ms.");
  131.             //    }
  132.             //    else
  133.             //    {
  134.             //        Console.WriteLine("Miss");
  135.             //    }
  136.             //
  137.             //}
  138.             //else
  139.             //{
  140.             //    Console.WriteLine("Няма такъв пол или е новия пол Джендър");
  141.             //}
  142.             //
  143.             //
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.         }
  152.     }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment