Test plan 3

docx

School

University of Maryland, University College *

*We aren’t endorsed by this school

Course

115

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

4

Uploaded by DirtyMoe

Report
Test plan 3 Kaleb Miranda CMSC 115 Chapter 4 Programming project 1 Pseudocode: 1. Start 2. Display “This program calculates the area of a regular polygon.” 3. Prompt the user to enter the number of sides (n). 4. Read n from the user. 5. Prompt the user to enter the length of a side (s). 6. Read s from the user. 7. Calculate pi as 3.141592265359 8. Calculate angle = 360 degrees / n 9. Calculate area = (n * s^2) / (4 * tan(pi / n)) 10. Display “The area of the polygon is “ + area “ 11. End Flowchart: Start: Display program purpose Prompt user to enter number of sides Read n from user Prompt user to enter the legth of a side (s) Read s from user Calculate pi as 3.14159265359 Calculate angle = 360 degrees / n Calculate area = (n * s^2) / (4 * tan(pi / n)) Display "the area of the polygon is" + area. END
Test Plan: Test Case 1: Input: n = 5, s = 6.5 Expected Output: The area of the polygon is 72.69017017488385 Test Case 2: Input: n = 6, s = 8.0 Expected Output: The area of the polygon is 138.21243150588603 Test Case 3: Input: n = 8, s = 10.0 Expected Output: The area of the polygon is 309.0169943749474 Test Case 4: Input: n = 12, s = 15.0 Expected Output: The area of the polygon is 907.2290640106801 Test Case 5: Input: n = 3, s = 7.0 Expected Output: The area of the polygon is 31.745959053647685 Chapter 4 Programming project 5 Pseudocode: 1. Start 2. Display "Enter a SSN (in the format DDD-DD-DDDD): " 3. Read SSN from the user and store it in a string variable ssn 4. Set isValid to true 5. If the length of ssn is not equal to 11, then 6. Set isValid to false 7. For i from 0 to length of ssn - 1, do the following: 8. Get the character at position i and store it in a variable c 9. If i is equal to 3 or i is equal to 6, then 10. If c is not equal to '-', then
11. Set isValid to false 12. Otherwise, if i is not equal to 3 and i is not equal to 6, then 13. If c is not a digit, then 14. Set isValid to false 15. If isValid is true, then 16. Display ssn + " is a valid social security number." 17. Otherwise, if isValid is false, then 18. Display ssn + " is an invalid social security number." 19. End Flowchart: Start: Display "enter a ssn" Read ssn Set isValid = true If legth of ssn != 11 then set isValid = false For i from 0 to legth of ssn - 1 do Get character c at position i If (i == 3 or i == 6) and c ! = Set isValid = false If isVlid is true then Display ssn + " is a valid ssn " Otherwise, if isValid is false then Display ssn + "is an invalid ssn " END.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Test Plan: Valid SSN Test Case: Input: "232-23-5435" Expected Output: "232-23-5435 is a valid social security number." Invalid SSN Test Case (Length): Input: "23-23-5435" Expected Output: "23-23-5435 is an invalid social security number." Invalid SSN Test Case (Non-Digit Characters): Input: "123-AB-5678" Expected Output: "123-AB-5678 is an invalid social security number." Invalid SSN Test Case (Incorrect Format): Input: "12345678901" Expected Output: "12345678901 is an invalid social security number." Valid SSN Test Case (Edge Case - Minimum Length): Input: "000-00-0000" Expected Output: "000-00-0000 is a valid social security number." Valid SSN Test Case (Edge Case - Maximum Length): Input: "999-99-9999" Expected Output: "999-99-9999 is a valid social security number."