CILP Programming Concepts – Assignment 1 and 2 Include contract, purpose, example, algorithm and test cases for all programs 1. Write a program to find nth term of an arithmetic progression. 2. Write a program to find nth term of Fibonacci series. 3. Write a program to find average of n numbers. 4. Write a program to remove nth element of an array. 5. Write a program to insert an element at nth position. 6. Write a program that accepts a total number of hours worked by an employee and calculates the net pay of the employee: Net Pay = Gross Pay - Tax Gross Pay = 15 * no of hours worked Tax is calculated as per the following rule Gross Pay < 100, tax - 2% 100 <= Gross Pay < 200, tax - 5% 200 <= Gross Pay < 500, tax - 8% Gross Pay >= 500, tax 10% Write a function that calculates gross pay; write another function that calculates tax. Use these modules to calculate net pay 7. Write a program to sort a list of numbers in ascending order. 8. Define a structure Student having attributes – name, ID and score. Write a program that accepts a list of instances of type Student and returns the ID of the student who has scored the highest. 9. Define a structure Product having attributes – name, ID, price. Write a program that accepts a list of instances of type product and a Product ID, and returns the name of product with given ID. 10. Define a structure Car having attributes – model name, mileage. Write a program that accepts a list of instances of Car and a mileage, and returns the list of model names having mileage greater than given mileage.
CILP Programming Concepts – Assignment 1 and 2
最新推荐文章于 2024-06-15 20:43:16 发布