CILP Programming Concepts – Assignment 1 and 2
2010-05-20 17:57
281 查看
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.
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.
相关文章推荐
- Machine Learning week 6 quiz: programming assignment-Regularized Linear Regression and Bias/Variance
- Machine Learning week 4 quiz: programming assignment-Multi-class Classification and Neural Networks
- Coursera Algorithms Programming Assignment 2: Deque and Randomized Queue
- 机器学习中的神经网络Neural Networks for Machine Learning:Programming assignment 3: Optimization and generaliza
- Memory as a Programming Concept in C and C++
- Machine Learning week 9 quiz: programming assignment-Anomaly Detection and Recommender Systems
- Machine Learning week 8 quiz: programming assignment-K-Means Clustering and PCA
- Introduction to Multi-Threaded, Multi-Core and Parallel Programming concepts
- MapKit and Text Input(Chapter 5 of iOS Programming: The Big Nerd Ranch Guide)
- Today I finish the multiple threads and socket programming
- Chp9: Recursion and Dynamic Programming
- Kingofark's50 Points of View About Learning C++ And Programming
- 《麻省理工开放课程:计算机科学及编程导论》(MIT ocw 6.00 Introduction to Computer Science and Programming)[中英字幕][oCourse]更新至第15讲[PSP适用][MP4]
- 【ZOJ3929 The 16th Zhejiang University Programming ContestC】【DP】Deque and Balls n个数放入双端队列2^n种方案有多少个位置
- Lockless Programming Considerations for Xbox 360 and Microsoft Windows
- Data Mining: Concepts and Techniques Review Chapter 4
- Copy constructors, assignment operators, and exception safe assignment
- Natural language style method declaration and usages in programming languages
- 《Concurrent Programming in Java: Design Principles and Patterns》Second Edition
- Statistical Concepts - Mean, Median, Mode, Trend and Standare Deviation