Victor and Francis are looking to buy a house in a new development.After looking at the several of 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.

Write:
a.Problem Analysis
b.Algorithm
c.Flowchart
d.Pseudocode
e.Complete C++ program
f.Output

How to write problem analysis, algorithm, flowchart, pseudocode and output?
I have done the C++ program as below:

``````#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int basedColonial, basedSplitEntry, basedSingleStorey,
finishedColo, finishedSplit, finishedSingle,
priceColo, priceSplit, priceSingle;

cout <<"Please enter the base price of Colonial house: ";
cin >>basedColonial;

cout <<"Please enter the finished area in square foot of the Colonial house: ";
cin >>finishedColo;

cout <<"\n \n";

cout <<"Please enter the base price of Split-Entry house: ";
cin >>basedSplitEntry;

cout <<"Please enter the finished area in square foot of the Split Entry House: ";
cin >>finishedSplit;

cout <<"\n \n";

cout <<"Please enther the base price of the Single-Storey House: ";
cin >>basedSingleStorey;

cout <<"Please enter the finished area in square foot of the Single-Storey House: ";
cin >>finishedSingle;

cout <<"\n \n";
cout <<"The price of Colonial House is " <<" RM" <<basedColonial
<<" per " <<finishedColo <<" square foot \n" <<endl;

cout <<"The price of Split-Entry House is " <<" RM" <<basedSplitEntry
<<" per " <<finishedSplit <<" square foot \n" <<endl;

cout <<"The price of Single-Storey House is " <<" RM" <<basedSingleStorey
<<" per " <<finishedSingle <<" square foot \n\n" <<endl;

priceColo = basedColonial / finishedColo;
priceSplit = basedSplitEntry / finishedSplit;
priceSingle = basedSingleStorey / finishedSingle;

if ((priceColo <= priceSplit) && (priceColo <= priceSingle))
cout <<"Colonial house is the cheapest one. \n" <<endl;
else if ((priceSplit <= priceColo) && (priceColo >= priceSingle))
cout <<"Split-Entry house is the cheapest one. \n" <<endl;
else if ((priceSingle <= priceSplit) && (priceSplit >= priceColo))
cout <<"Single-Storey house if the cheapest one. \n" <<endl;

getchar();
getchar();
return EXIT_SUCCESS;
}``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.