User:Safeelyazar/sandbox

Course: Core Skills Module: Problem Solving Topic: Basic Iterations

Associate Supporting Materials

Practice Set 1. Find the number of occurrences of a given digit in a number. 2. Find the nth term in Tribonacci series (0, 1, 1, 2, 4, 7, 13…). 3. Find the number of occurrences of given word in a sentence. 4. Find whether the alphabets in a word (string) are in the ascending order. 5. Find the number of prime numbers below a given number. 6. Ezee Shop has an online portal where customers can check about different products. Customers can search for products by giving a key word. Write a program that accepts a product name and a key word, and checks if the key word is present in the given product name. Note: Avoid using inbuilt problems for finding sub string.

7. Tech First has 72 offices spread across 30 countries. Each associate is assigned a seat at their base location. Every seat is coded as. The codes are decided by the admin department of Tech First. For example, cubicle number 365 of 3rd floor, Edge Techno Park located at Mumbai, India will be coded as INDMUMEDG003365.

Tech First Solutions has an employee details search application. This will help in fetching various details of an employee, including location of that employee. Write a program that will accept a seat code and return the location code alone from the given seat code. Note: Avoid using inbuilt functions to fetch the substring.

8. Tech First solutions has a savings scheme for its employees. An employee can contribute a certain amount every month. Every year the employee continues with the company and chooses to opt for the savings scheme, he/she needs to contribute 10% more than the previous year’s investment amount. The investment amount can be withdrawn only when the employee retires or resigns from the organization. The starting contribution that is the amount employee has to contribute when he/she joins company, has a maximum limit which is based on the designation of the employee at the time of joining. The company provides an interest of 9% on the investment amount. Interest is calculated on an annual basis and the same is added to the investment. At the end of a year interest is calculated as per the formulae invested amount * interest rate. Invested amount at any point of time will include the entire contribution employee has made and interest credited in the previous years. Write a program that accepts starting contribution of an employee and number of years of investment and returns the amount currently available at an employees savings scheme account. Assume that calculation is done at year end. An example is given below: Starting Contribution: Rs. 1000/- Number of years: 3 Year Employee Month Contribution (EC) Yearly Contribution (YC=ECX12) Amount eligible for interest(EI = CA of previous year+YA) Interest at 9%(I) Closing Amount at End of Year (CA = EI+I) Comments 1 1000 12000 12000 1080 13080 Interest is 12000 X 0.09, amount at the end of year is amount invested + interested 2 1100 13200 26280 2365.2 28645.2 Interest is (13080+13200)X0.09 and amount at the end of year is 13080+13200+2365.2 3 1210 14520 43165.2 3884.868 47050.068 Interest is (28645.2+14520)X0.09 and amount at the end of year is 14520+3884.868+28645.2 9.

References: Books: 1. Beginning Programming for Dummies, 4th Edition, by Wallace Wang (available at Books 24x7) 2. Java All-In-One Desk Reference For Dummies, 2nd Edition, by Doug Lowe and Barry Burd (available at Books 24x7) Links 1. http://download.oracle.com/javase/tutorial/java/nutsandbolts/while.html 2. http://download.oracle.com/javase/tutorial/java/nutsandbolts/for.html 3. http://download.oracle.com/javase/tutorial/java/nutsandbolts/branch.html