Dog Day Care Center Monthly Fee Calculator
Name: Paul Picazo
Course: SE 320 (Chadwick)
Table of Contents
Requirements
- Input
- dog weight (pounds)
- days per month to stay at center
- Output
- the daily rate, and the total monthly fee
- Constraints
- program format per CS225 style requirements
- User interface
- Extra credit
Design
- Input:
- prompt user to input int for dog weight in pounds
- prompt user to input int for days per month to stay
- Output:
- print daily rate to console
- print monthly total to console
- Components:
- User interface function
- DailyRate function
- Departures from requirements:
Test scenarios
- one or both inputs empty;
should reprompt user for inputs (doesn't yet)
- inputs are of non integer type;
error should be displayed (doesn't yet)
- weight is zero;
should display an error message
- days are zero;
should display an error message
- test boundary conditions;
- weight: 9 days: 10;
should display: rate: 12 total: 120
- weight: 10 days: 10;
should display: rate: 16 total: 160
- weight: 35 days: 10;
should display: rate: 19 total: 190
- weight: 9 days: 11;
should display: rate: 10 total: 110
- weight: 10 days: 11;
should display: rate: 13 total: 143
- weight: 35 days: 11;
should display: rate: 17 total: 187
Implementation
- Implementation Design
- main()
- call DogUI()
- get status from DogUI()
- return status
- DogUI()
- get user input for weight
- get user input for days per month
- send user input to DailyRate()
- if result is negative
- else
- print the daily rate
- print the total monthly fee (daily rate * days)
- return status
- DailyRate()
- nested ifs to get proper rate
- Implementation test scenarios
- main()
- ensure that proper status is received from DogUI()
- DogUI()
- ensure that user input is stored correctly
- ensure that DailyRate() is called
- ensure that result from DailyRate() and monthly fee are displayed
- ensure error codes are set appropriately
- ensure returns status
- DailyRate()
- ensure parameters from calling function are correct
- ensure return value matches expected value
- Code:
Successes and failures
- Everything worked, but more error handling for inputs should be done