Разрабатывайте таким образом, чтобы легче было адаптироваться к этим изменениям, не редактируя весь код, если вам нужно что-то изменить
the problem: Each trade has a value that indicates the transaction amount in dollars and a text indicating if the client´s sector is "Public" or "Private". They implement the following interface: interface ITrade { double Value { get; } string ClientSector { get; } } Currently, there are three categories: LOWRISK: Trades with value less than 1,000,000 and client from Public Sector MEDIUMRISK: Trades with value greater than 1,000,000 and client from Public Sector HIGHRISK: Trades with value greater than 1,000,000 and client from Private Sector Imagine you receive a list of trades and you need to return a list of categories as below: input: List<ITrade> portfolio output: List<string> tradeCategories Example: Input: Trade1 {Value = 2000000; ClientSector = "Private"} Trade2 {Value = 400000; ClientSector = "Public"} Trade3 {Value = 500000; ClientSector = "Public"} Trade4 {Value = 3000000; ClientSector = "Public"} portfolio = {Trade1, Trade2, Trade3, Trade4} Output: tradeCategories = {"HIGHRISK", "LOWRISK", "LOWRISK", "MEDIUMRISK"} Keep in mind that category rules may be added/removed/modified in the future and be highly complex. Please write your answer in pseudo-code showing clearly what classes, interfaces, methods and design patterns you would create/use to solve this problem. Also, object oriented programming is appreciated.
Что я уже пробовал:
what I tried: I read this whole tutorial that explains what pseudo code is and uses java as an example: https://www.geeksforgeeks.org/how-to-write-a-pseudo-code/, but I don't know how to do it.
some code: if (Trade.index(I).tradeValue < 1000000 and Trade.index(I).client ==< publicSector) Print (low risk)