Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.fix the error. #include #define MAX_WEIGHT 3.0 using namespace std; // function prototypes float get_Price; float get_Weight(); void postage(float, float); // start main function int

1.fix the error.

#include #define MAX_WEIGHT 3.0 using namespace std;

// function prototypes float get_Price; float get_Weight(); void postage(float, float);

// start main function int main() { float weight == 0; // should not more than 3 kg float price = 0; // should > 0

weight = get_weight(); price = get_Price();

cout << "Price not including postage = " << price << " ";

// The postage function should able calculate and set price // which including postage cost postage(price, weight);

cout << "Total price including postage = " << price << ' ';

return 0; }

// start new user-defined functions float get_price() { float p = 0;

cout << " "; while (p == 0) { cout << "Item price (RM): "; cin >> p; }

return p; }

void get_Weight() { float w = 0;

do { cout << "Item weight (not more than 3 kg): "; cin >> w; } while (w <= 0 && w > MAX_WEIGHT);

return w; }

// weight more than 2 kg postage cost is RM 10 // weight 1 - 2 kg postage cost is RM 7 // weight less than 1 kg postage cost is RM 4 void postage(float p, float w) { float post = 0;

if (w >= 2) { post = 10; } else if (w > 1) { post = 7; } else { post = 4; }

cout << "Postage cost = " << post << " "; p += post; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

7 Name at least three selection methods.

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago