gram acts as an auction house. We’ll let the users bet on x number of products. Assume the minimum bid is $100 (their bid must be at least the minimum). */ #include

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please fill in the blanks in C.

/* This program acts as an auction house. We’ll let the users bet on x number of products. Assume the minimum bid is $100 (their bid must be at least the minimum). */

#include<stdio.h>

#include<stdbool.h>

#define minBid 100.00

 

//Putting all function headers to top

__1__ __2__ scanProdInfo();

__3__ printProdInfo(__4__ __5__ p);

__6__ checkValid(__7__ amt);

 

//Define struct product

__8__ __9__

{

            __10__ ID;

            __11__ bid_amt;

};

 

int main()

{

            __12__ num_prod; //to save the number of products

            __13__ total = __14__; //variable for the total

 

            printf("Welcome to the Auction House.\n");

            printf("Enter number of products you want to bid on: ");

            scanf("__15__", __16__);

            //create an array of struct to save all the products

            __17__ __18__ bidProds[__19__];

 

            /*call the function to get 1 product info

              and save it to the array struct of products

            1 line loop body doesnt require {}*/

            for(int prod_idx = 0; prod_idx <__20__; prod_idx++)

                        __21__[__22__] = scanProdInfo();

           

            printf("\nThank you for your bids. Printing back: \n");

            for(int i = 0; i < __23__; i++)

            {

                        //call the function to print one product

                        printProdInfo(__24__[__25__]);

                        //add the product's amount to the total

                        total += __26__[__27__].__28__;

            }         

            //Print the total outside of loop

            printf("Your total bid amount is $%.2f.\n", __29__);

            return 0;

}

 

//get the information fo one product

__30__ __31__ scanProdInfo()

{

            struct prod p;

            printf("Enter 2 values for the product you're looking for (ID, then amt): ");

            scanf("%d __32__", __33__, __34__);

            bool isValid = checkValid(__35__); //check if the inputed amount is valid

 

            //ask user to re-enter if the input is valid (bid too low)

            while(__36__)

            {

                        printf("Your bid is too low for product #%d.", p.ID);

                        printf(" Re-enter the amount: ");

                        scanf("__37__", __38__);

                        __39__ = checkValid(__40__);

            }

            return __41__; //return the product

}

 

//print one product's info

__42__ printProdInfo(__43__ __44__ pr)

{

            printf("Product ID #%d: $%.2f.\n", __45__, __46__);

}

 

/*Check if the amount entered is not less than the mininum bid

and return true or false accordingly*/

__47__ checkValid(__48__ amt)

{

            return(amt __49__ __50__) ? true : false;

}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education