Assume you are looking to buy a house in a new development.After looking at various models they are majestic,split-entry,and single-story.The builder gave them the base price and the finished area in square meters of the three models.They want to know the models with the least price per square feet.Write a program that accepts as input the base price and the finished area in square meters of the three models.The program outputs the models with the least price per square meter.

How to find outputs the models with the least price per square meter.

I stuck in this outputs

Anyone HELP ME!!!!!!!!!!!

Recommended Answers

All 3 Replies

Before we will help you, you have to make an effort on your own to solve the problem. Try writing pseudo code first - how would you solve the problem in words. Then try to express that in code and class structures. Describe the classes you will need - what elements of the problem they reflect, and what data and methods they may contain to help in solving the problem. As for me, until you go this far, I'm not interested in giving you the answers to your homework problems... :-(

Indeed, what rubberman said.
Post your very own attempt of doing this homework, and then, if you are stuck, we will try to help you.

How to find outputs the models with the least price per square meter.

You need to do this:

Write a program that accepts as input the base price and the finished area in square meters of the three models.The program outputs the models with the least price per square meter.

So, you will need an input, 3 times, for the three models. After that, you will need a mathematical function that will compute the price per square metter:
that's it like: price/square_meter.
In pseudo-code, I see like this your program:

price/square_meters=conainter/vector/dequeue.
price = float/int.
square_meters = float/int.
for (i=0;i<3) do
    ask_for_input;
    price <- price_input;
    square_meters <- square_meters_input;
    price/square_meters.push_back() <- price/square_meters;
end_for
min=float/int;
min <- price/square_meters[0];
for (i=1;i<3) do
    if (min<price/square_meters[i]) then
        min=price/square_meters[i];
    end_if
end_for
print min;
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.