Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 have tried:

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) 
Posted
Updated 3-Jul-20 9:57am

1 solution

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900