answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kompoz [17]
1 year ago
9

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 (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.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.
main.py
current_price = int(input())
last_months_price = int(input())
''' Type your code here. '''
Computers and Technology
1 answer:
Papessa [141]1 year ago
7 0

Answer:

current_price = int(input())

last_months_price = int(input())

change = current_price - last_months_price

mortgage = (current_price * 0.051) / 12

print('This house is $' + str(current_price) + '. The change is $' + str(change) + ' since last month.')

print('The estimated monthly mortgage is ${:.2f}.'.format(mortgage))

Explanation:

Ask the user to enter the current price and last month's price

Calculate the change, subtract last month's price from the current price

Calculate the mortgage using the given formula

Print the results in required format

You might be interested in
g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
Blababa [14]

Answer:

I am writing C++ program. Let me know if you want the program in some other programming language.  

#include <iostream> //to use input output functions

using namespace std; //to identify objects like cin cout

void reverse(int array[], int size){ //method to reverse an array  

int i, j, temp; //declare variables  

for (i = 0; i < size / 2; i++) { /* the loop swaps the first and last elements, then swap the second and second-to-last elements and so on until the middle of the array is reached */  

temp = array[i];  

array[i] = array[size - i - 1];  

array[size - i - 1] = temp; }  

cout<<"Reversed array: "; //prints the resultant reversed array after swapping process  

for (j = 0; j < size; j++) { //loop to print the reversed array elements  

cout<<array[j]<<" "; } }    

int main() { //start of main() function body  

cout<<"Enter the length of array: "; //prompts user to enter the length of the array

       int n; //stores the value of size of array

       cin>>n; //reads the input size of array

       int A[n]; //declare array A of size n

       cout<<"Enter the elements: "; //prompts user to enter array elements

       for(int i=0;i<n;i++){ //loop for reading the elements of array

           cin >> A[i];        }

         reverse(A,n); } //calls reverse function to reverse the elements of the input array A by passing array A and its length n to function reverse

Explanation:  

The reverse function takes an array and its length as parameter. In the body of reverse function three integer type variables i,j and temp are declared.

for (i = 0; i < size / 2; i++) The for loop has a variable to iterate through the array. The for loop checks if the value of i is less than the array length. Lets say we have an array of elements 1, 2, 3, 4. As i=0 and size/2 = 4/2= 2. So the condition checked in for loop is true as 0<2 which means the body of for loop will be executed.

In the body of the loop there are three swap statements.

temp = array[i] This statement stores the element of array at i-th index to temp variable.

array[i] = array[size - i - 1] statement stores the element of array at size-i-1 to array index i.  

array[size - i - 1] = temp statement stores the the value in temp variable to the array index size-i-1

In simple words first, the first and last elements of array are swapped, then the second and second last elements are swapped. This process keeps repeating and for loop keeps executing these swap statements until the middle of the array is reached. In this program no extra array is used for reversing procedure but just a variable temp is used to hold the array elements temporarily.

array[4] = { 1 , 2 , 3 , 4}  

At first iteration  

i < size/2 is true as 0<2  

So the program control moves in the body of the loop where three swap statement works as following:  

temp = array[i]  

temp = array[0]  

As element at 0-th index which is the first element of array is 1 so

temp= 1  

array[i] = array[size - i - 1];  

array[0] = array[4-0-1]  

           = array[3]  

As the element at 3rd index of array is 4 which is the last element of the array so

array[0] = 4

This means that 4 becomes the first element of array now.

array[size - i - 1] = temp  

As the value in temp was set to 1 so  

array[4-0-1] = 1  

array[3] = 1  

This means 1 is assigned to the 3rd index of array. Which means 1 becomes the last element of the array now.

This is how the first and last elements of array are swapped.  

2nd iteration: value of i is incremented to 1 and now i = 1  

Again for loop condition is checked which evaluates to true as 1<2

temp = array[i]  

temp = array[1]  

As element at 1st index which is the second element of array is 2 so

temp= 2  

array[i] = array[size - i - 1];  

array[1] = array[4-1-1]  

           = array[2]  

As the element at second index of array is 3 which is the last element of the array so

array[1] = 3  

This means that 3 becomes the second element of array now.

array[size - i - 1] = temp  

As the value in temp was set to 2 so  

array[4-1-1] = 2  

This means 2 is assigned to the 2nd index of array. Which means 2 becomes the second last element of the array now.

This is how the second and second to last elements of array are swapped.  

3rd iteration: value of i=2 The for loop body will not execute now as the for loop condition i<size-2 evaluates to false because 2=2. So the loop stops and next for (j = 0; j < size; j++) loop iterates through array[] which has now been reversed and print the elements of this reversed array.

Next the main() method passes length of the array and the array elements to the   reverse function and prints these elements in reverse.  

The output is:

4  3 2  1  

The program and output according to the example 2,5,9,7 given in the question is attached as a screenshot.

3 0
1 year ago
12) Suppose you wanted a subroutine to return to an address that was 3 bytes higher in memory than the return address currently
Snezhnost [94]

Answer:

.code

main proc

mov ecx,ebp

mov ecx, 787878

push ecx

call MySe7en

invoke ExitProcess,0

main endp

MySe7en PROC

pop ecx

sub ecx, 3

mov

push ecx

ret

end main

8 0
1 year ago
You would use the _______ conditional formatting options when analyzing a worksheet in which you want to highlight the highest o
nirvana33 [79]

Answer:

Top/bottom conditional formatting

Explanation:

The top/bottom conditional formatting automatically carries out the task of finding the highest, lowest and even average values.

Conditional formatting formatting gives one the opportunity to enhance reports and dashboards as they work on excel.

You use the too/bottom formatting to highlight cells whose values of highest in a dataset and lowest in a dataset

4 0
1 year ago
Your company wants to conduct an exploratory study to gain new insights into some product changes you are considering. Which typ
Lina20 [59]

Answer: Primary Research (Focus Group).

Explanation:

Exploratory Research is an inquiry that seeks to understand the basic causal factors of a problem. This effort can serve as the basis of more intensive research later on.

There are basically two methodologies used, which are the; Primary and Secondary methods. While the Primary method's source of information is the concerned group, the Secondary Methods obtain their information from already existing information (Primary sources), such as Interviews, Journals, etc.

In the case of the company in the question, seeking to gain insight into the changes in a product, it would be best for them to consider what some selected costumers (focus group), think about the existing products and their views on subsequent changes. This method of getting information directly from the focus group employs the primary method.

3 0
1 year ago
Ming is building an inexpensive computer to use for her online classes, and needs to purchase Windows. What is the most cost-eff
kodGreya [7K]

The correct answer is; She can purchase OEM codes from e-commerce sites such as Amazon or eBay.

Further Explanation:

There are some sites where OEM codes cost around 110$ or higher. it will depend on which edition of Windows she plans on purchasing. The official Microsoft website sells the codes for much higher than other e-commerce sites.

There is some ways to get the older Windows for free online using a software key from a previous purchase from a friend or one you have purchased in the past. There is also a free trial that can be used for 7 days and possibly 30 days.

Learn more about Windows at brainly.com/question/1705478

#LearnwithBrainly

5 0
1 year ago
Other questions:
  • Gaven's instructor told him to include a personal statement in his work portfolio. Why did his instructor recommend including a
    6·1 answer
  • Which perspective is usually used in process simulations?
    6·1 answer
  • Which of the following is true of information systems?
    15·1 answer
  • Which of the following is an Internet supervisory protocol? O DNS IP O both A and B O neither A nor B
    12·1 answer
  • Database management systems are expected to handle binary relationships but not unary and ternary relationships.'
    7·1 answer
  • Choose the attribute used to provide accessibility by configuring a text alternative that is available to browsers and other use
    14·1 answer
  • You'd like to change the minimum password length policy in the Default Domain Policy group policy preference (GPO). What's the b
    10·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    8·1 answer
  • If byte stuffing is used to transmit Data, what is the byte sequence of the frame (including framing characters)? Format answer
    6·1 answer
  • A line graph titled Unemployment Percentages and Levels of Education where the x-axis shows dates from November 2007 to November
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!