Professional Documents
Culture Documents
*******************************************************************************/
// Problem Statement:
// From the Given stocks and their daily volume, do the following:
// Level 1: Add the given stocks to the given Data Structure "stockVolume"
// Level 2: Solve the bug to get the percentage daily volume difference for each
given stock
// Level 3: Write the code to get the most traded stock among the given stocks
import java.util.*;
// Level 1
static void addStock(String stock, int dailyVol[])
{
// Write the logic here...
// Level 2
static List<Double> dailyVolumeDifference(String code)
{
// Fix the bug here..
List<Integer> l = ((List<Integer>)stockVolume.get(code));
double prev = 0;
double curr = 0;
perDifference.add(difference);
}
return perDifference;
}
// Level 3
static String mostTradedStock()
{
String code="";
return code;
}
for(double d : volDifference)
{
Formatter f = new Formatter();
f.format("%5.2f",d);
System.out.print(f + "% ");
}
System.out.println("\n");
}
addStock("ONGC",new int[]{125504,227808,418706,518706,618706});
addStock("ICICI",new int[]
{642675,505563,655457,555457,645457});
addStock("TCS",new int[]{314534,416543,213766,313766,237667});
addStock("HDFC",new int[]{161907,262122,359839,459839,379839});