# Problem Set

```Problem #1 PseudoCode
Start
Set “volume” to zero
Input the side length of the square base of the carton in inches (sideLength)
Input the height of the carton in inches and set it to (height)
Calculate the “volume” by doing volume = sideLength^2 * height
Convert the “volume” from cubic inches to ounces by doing volume = volume * 0.55
Print “The carton has a volume of”, volume, “ounces.”
Stop
Problem #2 PseudoCode
Start
Initialize dayCounter to zero
Initialize breckenridge to 28
Initialize vail to 33
Initialize copperMountain to 55
Input the number of days in the future for the prediction (X)
While dayCounter is less than or equal to X
Print “Breckenridge will have”, breckenridge, “inches, Vail will have”, vail, “inches, and Copper Mountain
will have”, copperMountain, “inches.”
Stop
Problem #3 PseudoCode
Start
Input the minimum square footage (squareFootage)
If squareFootage is a number greater or equal than 0
Continue
Else
Input the number of pets (petAmount)
If petAmount is a number greater or equal than 0
Continue
Else
Input the maximum monthly rent (maxRent)
If maxRent is a number greater or equal than 0
Continue
Else
If squareFootage is higher than 1000 or if maxRent lower than 1000
Then print “No option is available”
Stop
If squareFootage is equal or lower than 600 and maxRent is equal or higher than 1000
Then print “You would love option A!”
If petAmout is lower or equal than 0 and squareFootage is equal or lower than 800 and maxRent is equal
or higher than 1400
Then print “You would love option B!” if
If squareFootage is equal or lower than 1000 and maxRent is equal or higher than 1800
Then print “You would love option C!”
Stop
Problem #4;
4.A.
Start
Initialize totalMoney to 10000
Initialize months to 0
Initialize the days to 0
Initialize moneyTaken to 100
Initialize dayCounter to 0
Set the dailyRate equal to the annualRate (0.76) divided by 365 (0.76/365 = 0.00208219)
While totalMoney is equal or higher than 5000:
If dayCounter minus 1 is divisible by 30: (If ((dayCounter – 1) % 30) == 0)
Subtract 100 from totalMoney and set that to totalMoney
Multiply totalMoney by the dailyRate and subtract that from the totalMoney
Divide the dayCounter by 30 an truncate the decimals and set that result to months
Use the mod function to check the remaining days and set that to days
Print “The months are”, months, “and the days are”, days
4.B.
Input the initial money as totalMoney
Initialize months to 0
Initialize the days to 0
Initialize moneyTaken to 100
Initialize dayCounter to 0
Set the dailyRate equal to the annualRate (0.76) divided by 365 (0.76/365 = 0.00208219)
While totalMoney is equal or higher than 5000:
If dayCounter minus 1 is divisible by 30: (If ((dayCounter – 1) % 30) == 0)
Subtract 100 from totalMoney and set that to totalMoney
Multiply totalMoney by the dailyRate and subtract that from the totalMoney
Divide the dayCounter by 30 an truncate the decimals and set that result to months
Use the mod function to check the remaining days and set that to days
Print “The months are”, months, “and the days are”, days
Problem #5:
Punith made 3 mistakes, 2 compile errors and 1 runtime error:
1: Compile Error: Punith wrote “enl” instead of “endl” making it an unrecognizable command
2: Compile Error: Punith forgot to put the semicolon (;) after that same line of code
3: Runtime Error: The program printed “hello 1300” when the program had to print “Hello 1300!” with
an uppercase “H” and a “!” symbol at the end
```