Question

In: Computer Science

Samantha and Vikas are looking to buy a house in a new development. After looking at...

Samantha and Vikas are looking to buy a house in a new development. After looking at various models, the three models they like are colonial, split-entry, and single-story.

The builder gave them the base price and the finished area in square feet of the three models. They want to know the model(s) with the least price per square foot.

Instructions

Write a program that accepts as input the base price and the finished area in square feet of the three models.

The program outputs the model(s) with the least price per square foot in the following format:

If the colonial model is the least price, output:

  • The price per square foot of the colonial model is the least.

If the split-entry model is the least price, output:

  • The price per square foot of the split-entry model is the least.

If the single-story model is the least price, output:

  • The price per square foot of the single-story model is the least.

If the colonial and split-entry models tie for the least price, output:

  • The price per square foot of the colonial and split-entry models tie for the least.

If the colonial and single-story models tie for the least price, output:

  • The price per square foot of the colonial and single-story models tie for the least.

If the single-story and split-entry models tie for the least price, output:

  • The price per square foot of the single-story and split-entry models tie for the least.

Finally, if all three tie for the least price, output:

  • The price per square foot all three models are the same.

Solutions

Expert Solution

#include<bits/stdc++.h>

using namespace std;

int main()
{
   float BasePrice;
   float area;
   vector<pair<float,float> >v;
   int i;
   string str;
   for(i=0;i<3;i++)
   {
       cout<<"\nEnter base price of "<<i+1<<" model = ";
       cin>>BasePrice;
       cout<<"Enter area square feet of "<<i+1<<" model = ";
       cin>>area;
       v.push_back(make_pair(BasePrice,area));
   }
   for(i=0;i<3;i++)
   {
       cout<<v[i].first<<"\t"<<v[i].second<<endl;
   }
   cout<<endl;
   if(v[0].first<v[1].first && v[0].first<v[2].first)
   cout<<"The price per square foot of the colonial model is the least.";
   else if(v[1].first<v[0].first && v[1].first<v[2].first)
   cout<<"The price per square foot of the split-entry model is the least.";
   else if(v[2].first<v[0].first && v[2].first<v[1].first)
   cout<<"The price per square foot of the single-story model is the least.";
   else if(v[0].first==v[1].first && v[0].first==v[2].first)
   cout<<"The price per square foot all three models are the same.";
   else if((v[0].first<=v[1].first && v[0].first<=v[2].first) || (v[1].first<=v[0].first && v[1].first<=v[2].first) || (v[2].first<=v[1].first && v[2].first<=v[0].first))
   {
       if(v[0].first==v[1].first && v[0].first<v[2].first)
       cout<<"The price per square foot of the colonial and split-entry models tie for the least.";
       else if(v[0].first<v[1].first && v[0].first==v[2].first)
       cout<<"The price per square foot of the colonial and single-story models tie for the least.";
       else if(v[1].first<v[0].first && v[1].first==v[2].first)
       cout<<"The price per square foot of the single-story and split-entry models tie for the least.";
   }
  
   return 0;
}


Related Solutions

Freddy and Frieda Finance are looking to buy a house. They find a house that they...
Freddy and Frieda Finance are looking to buy a house. They find a house that they like costing $400,000 and have a $100,000 as a down payment meaning they will need a mortgage loan of $300,000 if they pay their closing costs in cash. Help them evaluate some mortgage options. 1. Nautical Bank offers a 30-year fixed rate mortgage with a nominal annual rate of 3.125%. What would be the Finances’ monthly payment under this loan? 2. Construct an amortization...
Freddy and Frieda Finance are looking to buy a house. They find a house that they...
Freddy and Frieda Finance are looking to buy a house. They find a house that they like costing $400,000 and have a $100,000 as a down payment meaning they will need a mortgage loan of $300,000 if they pay their closing costs in cash. Help them evaluate some mortgage options. 1. Nautical Bank offers a 30-year fixed rate mortgage with a nominal annual rate of 3.125%. What would be the Finances’ monthly payment under this loan? 2. Construct an amortization...
You are looking to buy your first house. The cost of the house is $325,000. The...
You are looking to buy your first house. The cost of the house is $325,000. The bank has agreed to make a loan to you for 30 years at 3.15% if you can make a down payment of 7.00%, and the loan payments do not exceed 36% of your gross monthly income. Based upon this information: What is the amount of the mortgage loan that the bank will lend to you? What will be the amount of your monthly payments?...
You looking to buy your first house. The cost of the house is $350,000. The bank...
You looking to buy your first house. The cost of the house is $350,000. The bank has agreed to make a loan to you for 30 years at 3.25% if you can make a down payment of 10%, and the loan payments equal 40% of your gross monthly income. Based upon this information: A. What will be the amount of your monthly payments? B. How much is your gross monthly income? C. What must your annual salary be in order...
Suppose that you decided to buy a new house. The house you want to buy costs...
Suppose that you decided to buy a new house. The house you want to buy costs $520,000 and the interest rate is 7%. You currently have $130,000 and are required to put a 20% down payment plus an additional 3% of the loan amount as closing costs. 1) When will you have enough money for the down payment and closing costs, assuming that the $80,000 is the only investment that you make? 2) Suppose that you plan to buy the...
Toby, is looking to buy a house in Long Island. He has been following house prices...
Toby, is looking to buy a house in Long Island. He has been following house prices now for a while. In March 2017, Toby noticed the average house price in his chosen district was $327,800, while in March 2001, the average price was $210,300.    How much did sales price increase over the time period that Toby was considering? (Do not round intermediate calculations. Enter your answer as a percent rounded to 2 decimal places, e.g., 32.16.)   
You are looking for a $312,598 mortgage to buy a house. The mortgage has a 7...
You are looking for a $312,598 mortgage to buy a house. The mortgage has a 7 year term with a 22 year amortization. The rate on the mortgage is 2.75% APR with monthly compounding and monthly payments. What is the balloon payment on the mortgage? Round your answer to 2 decimal places. (For example 2.437 = 2.44)
Katekani is looking to buy a house and can afford a payment of R14 000.00 a month.
Katekani is looking to buy a house and can afford a payment of R14 000.00 a month. If the house costs R1 500 000 and Jane can get a 20 year loan at 10.25% p.a. compounded monthly, how much must Jane give as a deposit to lower her payment to R14 000.00 a month?
6. Jim has an annual income of $240,000. Jim is looking to buy a house with...
6. Jim has an annual income of $240,000. Jim is looking to buy a house with monthly property taxes of $140 and monthly homeowner’s insurance of $70. Jim has $178 in monthly student loan payments. Apple bank has a maximum front end DTI limit of 28% and a maximum back end DTI limit of 36%. Both limits must be satisfied. Apple bank is offering a fully amortizing 30 year FRM at an annual rate of 4.5%, with monthly payments, compounded...
Assume you are looking to buy a house $200,000 with a 20 year mortgage at 12%,...
Assume you are looking to buy a house $200,000 with a 20 year mortgage at 12%, estimate the monthly mortgage payment, first months interest, total amount to be repaid and the total interest. Explain why some financial institutions prefer to sell the mortgages they originate. Research and provide an example either current or historical. Why do you think it is difficult for investors to assess the financial condition of a financial institution that has purchased a large amount of mortgage-backed...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT