Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2018
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 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 Fishing
  8. {
  9. class Fishing
  10. {
  11. static void Main(string[] args)
  12. {
  13. int fish = int.Parse(Console.ReadLine());
  14. string command = string.Empty;
  15.  
  16. double weight = 0;
  17. int fishCounter = 0;
  18. int payCounter = 0;
  19. double spendMoney = 0;
  20. double lostMoney = 0;
  21. double result = spendMoney - lostMoney;
  22.  
  23.  
  24. for (int i = 0; i < fish; i++)
  25. {
  26.  
  27. double current = 0;
  28. command = Console.ReadLine();
  29. if (command == "Stop")
  30. {
  31. break;
  32. }
  33.  
  34. weight = double.Parse(Console.ReadLine());
  35. for (int s = 0; s < command.Length; s++)
  36. {
  37. double name = command[s];
  38. current += name / weight;
  39. }
  40.  
  41. fishCounter++;
  42. payCounter++;
  43. if (payCounter == 3)
  44. {
  45. spendMoney += current;
  46. }
  47. else
  48. {
  49. lostMoney += current;
  50. }
  51. }
  52. if (fishCounter==fish)
  53. {
  54. Console.WriteLine("Lyubo fulfilled the quota!");
  55. }
  56.  
  57. if (spendMoney >= lostMoney)
  58. {
  59. Console.WriteLine($"Lyubo's profit from {fishCounter} fishes is {(spendMoney - lostMoney):f2} leva.");
  60. }
  61. else
  62. {
  63. Console.WriteLine($"Lyubo lost {(lostMoney - spendMoney):f2} leva today.");
  64. }
  65. }
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement