Let us have fun on our Learn Programming through Logical Thinking Series – 5 here.

Question for Logical Thinking:

A, B and C jointly thought of engaging themselves in a business venture. It was agreed that A would invest Rs.6500 for 6 months, B Rs.8400 for 5 months and c, Rs.10000 for 3 months. A wants to be the working member for which he was to receive 5% of the profits, The profit earned was Rs.7400. Calculate the share of B in the profit.

Answer:

A’s investment amount for months =Rs.6500 for 6 months = Rs.39000

B’s investment amount for months =Rs.8400 for 5 months = Rs.42000

C’s investment amount for months =Rs.10000 for 3 months = Rs.30000

Total profit is Rs.7400.

A also get 5% of his profit.  So, We can subtract that amount from total profit

A’s getting profit =  ×5 =370.  Remaining profit = 7400-370=7030

Now, we can find the ratio of  A B and C

39000  :  42000  :  30000, Common  by 3, so divided by 3000

We get 13  :  14  :  10

After we find total Ratio value = 13+14+10 = 37

Now we can find the B’s share = ×Remaining profit =  ×7030

Now, we get the value of B’s Share = Rs.2660

Shall we write the same as Java Program

Program :

public class BShareProfit{

public static void main(String[] args) {

int invest1=6500,invest2=8400,invest3=10000,m1=6,m2=5,m3=3;

double totInvest1,totInvest2,totInvest3;

double totProfit=7400,percent=5,value,getProfit,remProfit;

double b_ratio1,b_ratio2,ratio,ratio1,ratio2,ratio3,b_share;

totInvest1 = invest1*m1;

totInvest2 = invest2*m2;

totInvest3 = invest3*m3;

//find ratio

ratio1=totInvest1/3000;

ratio2=totInvest2/3000;

ratio3=totInvest3/3000;

ratio=ratio1+ratio2+ratio3;

value=totProfit/100;

getProfit=value*5;

remProfit=totProfit-getProfit;

//find B’s share

b_ratio1=remProfit/ratio;

b_share=b_ratio1*ratio2;

System.out.println(“B’s Share is ” +b_share);

}

}