question archive Sites like Zillow get input about house prices from a database and provide nice summaries for readers

Sites like Zillow get input about house prices from a database and provide nice summaries for readers

Subject:Computer SciencePrice:2.84 Bought6

Sites like Zillow get input about house prices from a database and provide nice summaries for readers. create 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 (current_price * 0.051) / 12.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

print('{:.2f}'.format(your_value))

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 $850.00.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

The following is the program asked 

Step-by-step explanation

//Declaring variables
integer currentPrice
integer lastMonthPrice
integer changeLastMonth
float mortagage

//Reading input
currentPrice = Get next input
lastMonthPrice = Get next input

//Calculating price change
changeLastMonth = currentPrice - lastMonthPrice

//Calculating mortagage
mortagage = (currentPrice * 0.051) / 12

//Printing output
Put "This house is $" to output
Put currentPrice to output

Put "\nThe change is $" to output
Put changeLastMonth to output
Put " since last month." to output

Put "\nThe estimated monthly mortgage is $" to output
Put mortagage to output

Related Questions