C Programming Assignment 3

Problem Description

Your job for this project is to write an application that manages shopping.

Application Features:

• Customers are able to view an inventory of items.

• Customers are able to buy items.

• Customers are able to quickly search and get item details.

• Your application interacts with the customer.

• Your application adds/removes items to a shopping cart.

• Your application calculates the total cost.

Design Requirements

[url removed, login to view] must use const or #define directives to declare constants. Here is a sample list of constants: MAX_INVENTORY_SIZE 4

TAX .13 2.

2. You are allowed to code additional functions.

3. You must document (i.e. comments and indentation) your code properly.

4. You must use blank lines to separate logical units in the source code.

[url removed, login to view] are not allowed to declare global variables.

Milestone #3

In this milestone, you are going to use a C structure, write four functions and extend the main program from Milestone #2. In Milestone #2, the main program uses two parallel arrays to represent inventory data (i.e. sku and price) of a grocery store.

In this milestone, the main program uses a C structure to represent a shopping cart. Whenever a customer wants to buy an item, one adds it to the shopping cart. One may also remove the shopping cart. The C structure contains information about the items that have been added to the shopping cart. Here is the C struct type that should be used in this milestone:

struct Cart{

int sku[MAX_ITEMS];

float price[MAX_ITEMS];

int quantity[MAX_ITEMS];

float totalCost;

int size;


sku[MAX_ITEMS]: An array of the SKU numbers of the items that are added to the cart. price[MAX_ITEMS]: An array of the prices of the items that are added to the cart.

Quantity[MAX_ITEMS]: An array of the quantities of the items that are added to the cart. MAX_ITEMS: the maximum number of shopping items that may be put into a shopping cart.

Assume MAX_ITEMS is 10.

totalCost: Total cost of the items in the shopping cart.

size: Size of the shopping cart.

a) Replace void displayCart() from MS2 with the following function:

void displayCart(const struct Cart* pShoppingCart);

• This function receives an address to an object of Cart.

• This function displays the shopping cart in an informative format. See sample output.

• This function must not display items that have quantity zero.

b) Replace void addCart() from MS2 with the following function:

void addCart(struct Cart* pShoppingCart,const int sku[],const float price[]);

• This function receives an address to an object of Cart, and two parallel arrays sku and price representing the inventory.

• This function prompts the user to input the SKU number of an item that one wants to add to the shopping cart.

• This function searches through the inventory (the sku array) to find if the item exists in the array (use searchInventory function from MS2).

more in attached file.

Ferdigheter: C-programmering

Se mer: variables in programming, uses of data structure, use of data structure in programming, type of data structure in c, to get tax file number, the design a grocery cart, the c programming, the assignment problem, struct c programming, programming variables, programming structure, programming object, programming job description, programming job address, programming in data structure, programming define, programming data structure, programming comments, programming array, programming and data structure

Om arbeidsgiveren:
( 27 omtaler ) Hamilton, Canada

Prosjekt-ID: #10024551

Tildelt til:

$20 CAD på 2 dager
(13 omtaler)