Write a method smallest Index, that takes an integer array as its parameters and returns the index of the (last occurrence of the) smallest element in the array. Also, call the method smallest Index to test the method.
Write programs to solve following two tasks:
Task#1
Write a method smallest Index, that takes an integer array as its parameters and returns the index of the (last occurrence of the) smallest element in the array. Also, call the method smallest Index to test the method.
Task#2
Three employees in a company are up for a special pay increase. You are given a file, say InputData.txt, with the following data:
Miller Andrew
65789.87
5
Green Sheila
75892.56
6
Sethi Amit
74900.50
6.1
First line contains an employee’s name, next line his current salary, and the next line is percent pay increase. For example, in the first input line, the name of the employee is Miller Andrew, the next line contains his current salary is 65789.87, and the line after contains his pay increase is 5%. The same pattern repeats 3 times.
Write a method ReadingWriting which accepts a file of the following format as input. The method ReadingWriting does the following:
reads data from the InputData.txt file
Write output in the output file out.txt.
For each employee, the data must be outputted in the following way:
name, updatedSalary.
Calculate updatedSalary using the formula:
updatedSalary = current salary + (current salary * pay increase)
Format the updatedSalary of decimal numbers to two decimal places.
Note: Use loop to read and write from the file