## TimberCo
Obuds2020 is a wood based business which specializes in sourcing and selling different kinds of wood.
Currently their focus is on softwood and hardwood.
The woods are categorized according to the dimensions as :
A-1X1",<br>
B-1X2",<br>
C-2X2",<br>
D-2X3",<br>
E-3X3",<br>
F-3X4",<br>
G-4X4",<br>
H-1X6",<br>
I-2X6",<br>
J-3X6"<br>
## The selling price per foot of the
dimension categories, A,B,C,D,E,F,G,H is based on the cost of A according to the rules:
Cost of B=A +30%A,<br>
Cost of C=B +30%B,<br>
Cost of D=C +30%C,<br>
Cost of E=D +30%D,<br>
Cost of F=E+30%E,<br>
Cost of G=F +20%F, <br>
Cost of H=G +20%G. <br>
The cost of A may be reset from time to time if it becomes necessary.
The selling price per foot for J and that of I are related by Cost of J=I +50%I. The cost for I may be
reset from time to time if it becomes necessary.
At all times the selling price per foot is 100% of the purchase price per foot from the supplier.
Hardwood is always 200% more costly that softwood at the supplier point and 220% more costly at the
selling point.
# Requirements
## You are required to well commented abstract a class with with relevant data and methods to make it
possible to:
1. Generate a report on sales for each category of wood.
2. Generate a report on stock at any one period of time.
3. Generate a report on profit earned by a sale for each category of wood.
4. Generate a report on total profit made.
5. Draw a UML diagram of the abstract class
## Write well commented program ( main calss) that make use of the above class and also use the
following programming construct:
• Paramerised constructor
• A method that receives an object and then process the profit made
• Use of Math.random() method to generate lengths of feet sold
• A method that receives an array of objects and then process the sales made
• A method that creates an array of objects sold and return the array
## Deliverable
1. A pdf document that contains the entire program and the UML diagram and the output results
What I have tried:
public static void main(String[] args){
int[] my_array1 = {
1789, 2035, 1899, 1456, 2013,
1458, 2458, 1254, 1472, 2365,
1456, 2165, 1457, 2456
};
String[] WoodType = {
"A-1X1",
"B-1X2",
"C-2X2",
"D-2X3",
"E-3X3",
"F-3X4",
"G-4X4",
"H-1X6",
"I-2X6",
"J-3X6"
};
System.out.println("Original numeric array : "+Arrays.toString(my_array1));
System.out.println("Original string array : "+Arrays.toString(WoodType));
double costA = 300.0;
if (WoodType[1] == "A") {
costA = 300;
}
else if(WoodType[1] == "B") {
int costB = costA + 0.3(costA);
}
else if(WoodType[1] == "C") {
int costC = costB + 0.3(costB);
}
else if(WoodType[1] == "D") {
int costC = costC + 0.3(costC);
}
else if(WoodType[1] == "E") {
int costE = costD + 0.3(costD);
}
else if(WoodType[1] == "F") {
int costF = costE + 0.3(costE);
}
else if(WoodType[1] == "G") {
int costG = costF + 0.3(costF);
}
else if(WoodType[1] == "H") {
int costH = costG + 0.3(costG);
}
else if(WoodType[1] == "I") {
int costI = costH + 0.3(costH);
}
else if(WoodType[1] == "J") {
int costJ = costI + 0.3(costI);
}
else {
System.out.println("The number is 0.");
}
final int NUM_DAYS = 30;
String filename;
double totalSales;
double averageSales;
filename = getFileName();
totalSales = getTotalSales(filename);
averageSales = totalSales / NUM_DAYS;
displayResults(totalSales, averageSales);
public static double getTotalSales(String filename)
throws IOException
{
double total = 0.0;
double sales;
File file = new File(filename);
Scanner inputFile = new Scanner(file);
while (inputFile.hasNext())
{
sales = inputFile.nextDouble();
total += sales;
}
inputFile.close();
return total;
}