1.A trader buys and sells stocks on the same day. Each transaction consists of two values: The price at which the trader buys the stock. The price at which the trader sells the stock. The transactions are stored in an integer array such that: The even index (0, 2, 4, …) represents the buy price. The odd index (1, 3, 5, …) represents the sell price. Write a Java program that: 1. Calculates the total number of transactions the trader made. 2. Calculates the total profit, where profit = (sell price – buy price) for each transaction.
Finally, print: Number of Transactions: followed by the count. Total Profit: followed by the profit.
2.Puzzle Statement
Your friend comes to your home and asks about the ages of your 3 children.Your replied:
i)The product of their ages is 72.
ii)The sum of their ages is equal to your house number.Your friend still can’t figure out their ages.
iii)You then say: “The oldest child likes strawberry ice cream.”