Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.48 KB | None | 0 0
  1. COMSC-110
  2. Teacher
  3.  
  4. 1. Objective: calculate how many days old you will be on the due date for this lab.
  5.  
  6. 2. Requirements:
  7. --INPUT:
  8. DOB = "July 20, 1994"
  9. dueDate = "September 7, 2014"
  10. yearsOld = 21 (including the current year)
  11.  
  12. --PROCESSING:
  13. days = 0
  14. leapYears = yearsOld / 4
  15. julianBirthdate = sum of all the days in each month up to month and date of birth
  16. julianDuedate = sum of all days in each month up to month and date of due date
  17. daysToEndOfYear = 365 - julianDuedate
  18. days = days * (365 * yearsOld)
  19. days = days + leapYears
  20. days = days - julianBirthdate
  21. days = days - daysToEndOfYear
  22.  
  23.  
  24. --OUTPUT:
  25. objective
  26. author
  27. user instructions (if any)
  28. label1 "Date of birth: "
  29. label2 "Due date: "
  30. label3 "Age in days: "
  31.  
  32. --DATA:
  33. days-->>total number of days old you are on the date this lab is due (integer)
  34. yearsOld-->>number of years old you are (integer)
  35. leapYears-->>number of leap years from your birth year to this year (integer)
  36. julianBirthdate-->>number of days up to and including your birthday in your birthyear (integer)
  37. daysToEndOfYear-->>number of days from lab due date until the end of the year (integer)
  38. julianDuedate-->>number of days up to due date (integer)
  39. DOB-->>date of birth (text)
  40. dueDate-->>date lab is due (text)
  41.  
  42.  
  43. 3. Algorithm Instructions
  44. 10 output objective
  45. 20 output author
  46. 30 days = 0
  47. 40 yearsOld = 21
  48. 50 leapYears = yearsOld / 4
  49. 60 julianBirthdate = sum of all the days in each month up to month and date of birth
  50. 70 DOB = "July 20, 1994"
  51. 80 dueDate = "September 7, 2014"
  52. 90 julianDuedate = sum of all the days in each month up to month and date of due date
  53. 100 daysToEndOfYear = 365 - julianBirthdate
  54. 110 days = days + (365 * yearsOld)
  55. 120 days = days + leapYears
  56. 130 days = days - julianBirthdate
  57. 140 days = days - daysToEndOfYear
  58. 150 output label1
  59. 160 output DOB
  60. 170 output label2
  61. 180 output dueDate
  62. 190 output label3
  63. 200 output days
  64. 210 END
  65.  
  66. 4. Test cases
  67. Test Case #1: DOB = 7/20/1994, dueDate = 9/7/2014
  68. 10 calculate how many days old you will be on the due date for this lab.
  69. 20 author: Teacher
  70. 30 days = 0
  71. 40 yearsOld = 21
  72. 50 leapYears = 20 / 4 = 5
  73. 60 julianBirthdate = 201
  74. 70 DOB = "July 20, 1994"
  75. 80 dueDate = "September 7, 2014"
  76. 90 julianDuedate = 250
  77. 100 daysToEndOfYear = 365 - 250 = 115
  78. 110 days = 0 + 7665 = 7665
  79. 120 days = 7665 + 5 = 7670
  80. 130 days = 7670 - 201 = 7469
  81. 140 days = 7469 - 115 = 7354
  82. 150 Date of birth:
  83. 160 July 20, 1994
  84. 170 Due date:
  85. 180 September 7, 2014
  86. 190 Age in days:
  87. 200 7354
  88. 210 DONE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement