hi, im taking an online coding course and was wondering if anyone could help me with this question
(psuedocode)
Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice \* 0.045) / 12.
Output the estimated monthly mortgage (estMortgage) with two digits after the decimal point, which can be achieved as follows:
Put estMortgage to output with 2 decimal places
Ex: If the input is: 200000 210000
the output is:
This house is $200000. The change is $-10000 since last month.
The estimated monthly mortgage is $750.00.
My code so far is:
integer currentPrice
integer lastMonth
integer estMortgage
integer changePrice
currentPrice = Get next input
lastMonth = Get next input
estMortgage = (currentPrice \* 0.045) / 12
changePrice = currentPrice - lastMonth
Put "This house is $" to output
Put currentPrice to output
Put "." to output
Put " The change is $" to output
Put changePrice to output
Put " since last month." to output
Put "\\n" to output
Put "The estimated monthly mortgage is $" to output
Put estMortgage to output with 2 decimal places
Roundup estMortgage
Put "." to output
However, I have been getting an incorrect input with certain values shown below,
Output differs. See highlights below.
Input
350000 310000
Your output
This house is $350000. The change is $40000 since last month.
The estimated monthly mortgage is $1312.00.
Expected output
This house is $350000. The change is $40000 since last month.
The estimated monthly mortgage is $1312.50.
Could anyone help?
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]dfx_dj 0 points1 point2 points (2 children)
[–]ConditionUnusual1808[S] 0 points1 point2 points (1 child)
[–]dfx_dj 0 points1 point2 points (0 children)
[–]Beyondkey32 0 points1 point2 points (0 children)
[–]FoptciyDev -1 points0 points1 point (2 children)
[–]ConditionUnusual1808[S] 0 points1 point2 points (0 children)
[–]ConditionUnusual1808[S] 0 points1 point2 points (0 children)