Question

In: Computer Science

TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Summary Samantha and Vikas are looking...

TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING)

C++ CODE

Summary

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

Thanks for the question.


Here is the completed code for this problem. Comments are included so that you understand whats going on. Let me know if you have any doubts or if you need anything to change.


Thank You !!


========================================================================================

#include<iostream>
#include<string>

using namespace std;

void printLeastPrice(double,double,double);

void printLeastPrice(double col,double split,double single){
  
   if(col<split && col<single){
       cout<<"The price per square foot of the colonial model is the least.\n";
   }else if(split<col && split<single){
       cout<<"The price per square foot of the split-entry model is the least.\n";
   }else if(single<col && single<split){
       cout<<"The price per square foot of the single-story model is the least.\n";
   }else if(col==split && col<single){
       cout<<"The price per square foot of the colonial and split-entry models tie for the least.\n";
   }else if(col==single && col<split){
       cout<<"The price per square foot of the colonial and single-story models tie for the least.\n";
   }else if(single==split && single<col){
       cout<<"The price per square foot of the single-story and split-entry models tie for the least.\n";
   }else if(col==split && split==single){
       cout<<"The price per square foot all three models are the same.\n";
   }
   cout<<endl;
}

int main(){
  
  
   double colonialBasePrice, splitBasePrice, singleBasePrice;
   double colonialArea, splitArea, singleArea;
   double colonialPriceSqFt, splitPriceSqFt, singlePriceSqFt;
  
   // get user input for all the 3 models
   cout<<"Colonial Model:"<<endl;
   cout<<"Enter Base Price: "; cin>>colonialBasePrice;
   cout<<"Enter finished area: "; cin>>colonialArea;
   colonialPriceSqFt = colonialBasePrice/colonialArea;
  
   cout<<"Split-Entry Model:"<<endl;
   cout<<"Enter Base Price: "; cin>>splitBasePrice;
   cout<<"Enter finished area: "; cin>>splitArea;
   splitPriceSqFt = splitBasePrice/splitArea;
  
   cout<<"Single-story Model:"<<endl;
   cout<<"Enter Base Price: "; cin>>singleBasePrice;
   cout<<"Enter finished area: "; cin>>singleArea;
   singlePriceSqFt = singleBasePrice/singleArea;
  
   // uncomment to print the prices per sq ft for all the 3 models.
   //cout<<"Colonial Price/Sqft: "<<colonialPriceSqFt<<endl;
   //cout<<"Split-Entry Price/Sqft: "<<splitPriceSqFt<<endl;
   //cout<<"Single=story Price/Sqft: "<<singlePriceSqFt<<endl;
  
   printLeastPrice(colonialPriceSqFt,splitPriceSqFt,singlePriceSqFt);
  
  
}

=====================================================================================

thanks a lot !!


Related Solutions

TEXT ONLY PLEASE ( PLEASE NO PDF OR WRITING) C++ CODE Instructions In a right triangle,...
TEXT ONLY PLEASE ( PLEASE NO PDF OR WRITING) C++ CODE Instructions In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle. If the triangle is a right triangle, output It is...
TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Instructions Write a program that implements...
TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Instructions Write a program that implements the algorithm given in Example 1 - 3 (Chapter 1), which determines the monthly wages of a salesperson. The instructions for Example 1 - 3have been posted below for your convenience. Example 1 - 3 Every salesperson has a base salary. The salesperson also receives a bonus at the end of each month, based on the following criteria: If the salesperson has been with...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ PLEASE Summary For each used...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ PLEASE Summary For each used car a salesperson sells, the commission is paid as follows: $20 plus 30% of the selling price in excess of the cost of the car. Typically, the minimum selling price of the car is the cost of the car plus $200 and the maximum selling price is the cost of the car and $2,000. Instructions Write a program that prompts the user to enter:...
provide a C code (only C please) that gives the output below: ************************************ *         Menu HW...
provide a C code (only C please) that gives the output below: ************************************ *         Menu HW #4 * * POLYNOMIAL OPERATIONS * * 1. Creating polynomials * * 2. Adding polynomials * * 3. Multiplying polynomials. * * 4. Displaying polynomials * * 5. Clearing polynomials. * * 6. Quit. * *********************************** Select the option (1 through 6): 7 You should not be in this class! ************************************* *         Menu HW #4 * * POLYNOMIAL OPERATIONS * * 1. Creating polynomials...
Please do this in C++ only. Please Show your code and your output too. Would you...
Please do this in C++ only. Please Show your code and your output too. Would you focus on number 2 in the Required functions:? Please use all the variables in the program. The assignment problem: You are asked to develop an application that prints a bank’s customers' names, IDs, and accounts balances in different ways. In this program, you need to read a file of customer’s data into different arrays, pass these arrays to functions as (array parameter), calculate the...
Using C++, write a code that this program always stores text file output into a text...
Using C++, write a code that this program always stores text file output into a text file named "clean.txt". -The program should read one character at a time from "someNumbers.txt", and do the following. -If it is a letter, print that letter to the screen, AND also store it in the text file. All letters should be converted to lowercase beforehand. -If it is a number, print that number to screen, but do NOT store it in the text file....
The code should be written in c++. It should be in only OpenGL // ***** ONLY...
The code should be written in c++. It should be in only OpenGL // ***** ONLY OpenGL PLEASE ******// write a program snippet that accepts the coordinates of the vertices of a rectangle centered around the origin, with edges that are parallel to the X and Y axes, and with aspect ratio W and converts it into a rectangle centered around the origin with aspect ratio of 1/W. The program has to figure W from the given points. You MUST...
PROVIDE CODE ONLY IN C++ / NO OTHER LANGUAGES PLEASE ADD SELECTION SORT/ INSERTION SORT/ AND...
PROVIDE CODE ONLY IN C++ / NO OTHER LANGUAGES PLEASE ADD SELECTION SORT/ INSERTION SORT/ AND BUBBLE SORT FUNCTION TO THIS PROGRAM #include <iostream> #include<vector> #include <algorithm >   #include <chrono>    #include <ctime> using namespace std; void bubblesSort() { // Please create Bubble Sort function// Make another for Selection Sort and  Insertion Sort } int main() { // empty vector vector<int> data; // data [0], data [1]... data[N-1] <-- end(data) // set of values to test N for (auto N :...
Please take this c++ code and make it into java code. /* RecursionPuzzleSolver * ------------ *...
Please take this c++ code and make it into java code. /* RecursionPuzzleSolver * ------------ * This program takes a puzzle board and returns true if the * board is solvable and false otherwise * * Example: board 3 6 4 1 3 4 2 5 3 0 * The goal is to reach the 0. You can move the number of spaces of your * current position in either the positive / negative direction * Solution for this game...
please submit the C code( no third party library). the C code will create output to...
please submit the C code( no third party library). the C code will create output to a file, and iterate in a loop 60 times and each iteration is 1 second, and if any key from your keyboard is pressed will write a 1 in the file, for every second no key is pressed, will write a 0 into the output file.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT