Page 287 - IT-802_class_12
P. 287
modlfy_category (int categ_id, String actr, String new)
/ ‘Add functionality to change value of attribute attr
//of category with id categ_id to new
//SQL command to be used: update
public void display_category (int categ_id)
{
//Add functionality to display all products in category
//with id categ_id
//SQL command to be used : select
}
QUESTION
Suppose that numbers of commodities belonging to a category are quite large.Buyer may
not be interested in some commodities at all. What do you think, should be the order of
display of commodities? Should it be based on popularity, price or any other criteria? For
each criterion, figure out what else is required to be stored in database.
4. Next, the list of commodities along with associated details are to be decided for each category and inserted in
COMMODITIES table using insert_commodity function of class Product. Similarly, company at later point in time
may add more commodities by calling the same function. Functions delete_product and modify_product may
respectively be used to delete or modify any product, as and when required. If the buyer selects any commodity on
the website, then function display_product may be used to display the details of commodity.
package shopping_application;
public class Commodity
{ public void insert_commodity (String comod_tuple[])
//Add functionally to insert a row of commodity named / /comod_tuple.
//SQL command to be used: insert
public void delete_commodity (int commodity_id)
//Add functionally to delete a product with id prod_id
//SQL command to be used: delete
public void modify_commodity (int commodity_id, string actr, String new)
//Add functionally to change value of attribute attr //of product with id
commodity_id to new
//SQL command to be used: update
public void display_commodity (int commodity_id)
//Add functionally to display details of the commodities
Work-Integrated Learning IT-DMA 285

