Sie sind auf Seite 1von 4

Date: 16.10.

2012

Name: Candale Andrei

Problem Statement:
A math teacher needs a program in order to help students to test different properties of numbers. The program manages a list of numbers and also allows students to repeatedly execute various functionalities.

Numerical Lists Feature List


F1. Add a number to the list. F2. Insert a number at a given position. F3. Remove a number from a given position. F4. Remove all numbers between two given positions. F5. Replace all occurences of a sublist with another sublist. F6. Write all prime numbers between two given positions. F7. Write all odd numbers between two given position. F8. Compute the sum of all numbers between two given positions. F9. Compute the greatest common divisior of all numbers between two given positions. F10. Compute the maximum of all numbers between two given positions. F11. Filter only the prime numbers. F12. Filter only the negative numbers. F13. Undo last performed operation.

Iteration Plan:
Iteration Planned Features F1. Add a number to the list. F2. Insert a number at a given position. F3. Remove a number from a given position. F4. Remove all numbers between two given positions. F5. Replace all occurences of a sublist with another sublist. F6. Write all prime numbers between two given positions. F7. Write all odd numbers between two given position. F8. Compute the sum of all numbers between two given positions. F9. Compute the greatest common divisior of all numbers between two given positions. F10. Compute the maximum of all numbers between two given positions. F11. Filter only the prime numbers. F12. Filter only the negative numbers. F13. Undo last performed operation. <New features and properties>

I1.

I2.

I3.

Iteration 1 Work items:


T1. T2. T3. T4. Implement a procedure to decode the users input for each feature from F1 to F13 Implement a procedure to execute the users command for each feature from F1 to F13. Implement auxiliary functions: - prime number check (for F6) - gratest common divizior (for F9) Implement user interface.

Running Scenario Add feature (F1) User Add feature (F1) Program
Please type your command or 'help' to see a full list of commands.

Description Menu Ask for all the available commands Returns all the available commands Add number to the end of the list Returns the list Add a character The program alerts the user that the values are not correct. The user executes an incorrect command The program alerts theuser that the command was incorrect

help add value - adds a value to the end of the list ... add 1 [1] add a The second parameter must be a number ad 2
The command you entered is not valid Please type your command or 'help' to see a full list of commands.

insert -1 at 0 insert -2 at -10 insert 2 at 100

Insert a number at a given position (F2) Insert -1 at position 0 [-1,1] Returns the list Tries to insert -2 atthe position -10 [-2,-1,1] The program inserts the number at the first position Insert 2 at position 100 [-2,-1,1,2] The program inserts the number at

remove 1 remove -1

the last position Remove a number from a given position(F3) Remove the value from position 1 [-1,1,2] Returns the list Return the value at position -1 The position must be a natural The program alerts the user that number between 0 and the length such an operation is not posible
of the list.

Remove all numbers between two given positions (F4) Remove all the values in between the positions 0 and 2 [2] Returns the list Replace all occurences of a sublist with another sublist (F5) replace 2 with 1 2 Replace all the occurrences of 2 34 with the list 1 2 3 4 [1,2,3,4] replace 1 2 with Replace all the occurrences of the -1 -2 -3 sublist 1 2 with the sublist -1 -2 -3 [-1, -2, -3, 3, 4] Returns the list Write all prime numbers between two given positions. (F6) prime from 0 to 2 Returns the prime numbers in between position 0 and 2 [-2,-3] Returns the list prime from 3 to 0 Return prime numbers in between position 3 and 0 The first position cannot be The program alerts the user greater than the last one thatsuch an operation cannont be done Write all odd numbers between two given position (F7) odd from 0 to 4 Return the odd number in between the position 0 and 5 [-1, -3, 3] Returns the list Compute the sum of all numbers between two given positions. (F8) sum from 0 to 3 Returns the sum of the elements in between the positions 0 and 3 -3 Returns the sum Compute the greatest common divisior of all numbers between two given positions (F9) gcd from 0 to 4 Returns the greatest common divizor in between positions 0 and 4 1 Returns result . Compute the maximum of all numbers between two given positions (F10) max from 0 to 3 Returns the maximum value in between position 0 and 3 3 Returns the result Filter only the prime numbers (F11) filter prime Returns the prime numbers from the list [-2, -3, 3] Returns the sublist with prime remove from 0 to 2

filter negative

undo

numbers Filter only the negative numbers (F12) Returns the negative numbers from the list [-1, -2, -3] Returns thesublist with negative numbers Undo last performed operation (F13) Reverses the last operation [1,2,3,4]

Das könnte Ihnen auch gefallen