Homework Help for Information Technology

1,532 results

IT encompasses the study, use, and service of coputers and communication systems for storing, sending, receiving and manipulation data and information

For unlimited access to Homework Help, a Homework+ subscription is required.

Lv1
in Information Technology·
31 Mar 2023

Hello. I had requested help to complete this entire code last week. But the code was only completed 15%? I have placed below the entire assignment needed with 100% completion.   Below the assignment question I have placed the code I have which is only 15% completed. If you can please complete 100% as this is whats needed.   Thank you.    

1 Assignment question:

  The project submitted is missing a long list of the requirements of the assigned project. What is submitted at this point is about 15% of what you have been asked. Please, read the project precisely and in detail.

in this activity, you are designing an application for grocery stores and their inventories.

The items depending on their type are divided into the following categories:

Group A: Meat

Group B: Deli

Group C: Pharmacy

Group D: Seafood

Group E: Beverage

Group F: Canned

Group G: Jarred

Group H: Dry Food

Group I: Dairy

Group J: Bakery

Group K: Personal Care

Group L: Paper Goods

Your store must have at least 3 items in each category.

Your application as the first step needs to collect the following information before importing the items to the store:

1. The name of the product

2. The Category

3. The Company/Manufacturer name

4. The purchased price (What company has paid to buy this product)

5. The sale price (What customers will pay to buy this product)

6. The quantity of the purchased items

7. The date of the purchased items

8. The date of the production

9. The expiry date of the product

10. Store Code (a 4-digit number)

11. The currency of the country


12. Items will go on sale on different dates depending on their categories.

Your application is responsible to use encryption method 1 for #1, and #3. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 2 for #2. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 3 for #4, and #5. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 4 for #6. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 5 for #7, #8, and #9. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 6 for #10. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 7 for #11. (You have to define the suitable encryption method.)


The output of the encryptions will generate a number that will be known as the barcode of that specific item in this store.

Before selecting and implementing your encryption methods, you have to answer the following questions:

- Will all the generated barcodes have the same number of digits?

- How should we deal with barcodes that have different numbers of digits?

- Do you need to define decryption?

- Is there any other questions, aspects, complications, simplifications, etc. that I need to think about in advance?

Items will go on sale on different dates depending on their categories.

Group A, B, C, and D follow the following rules:

- Items will go on a 10% promotion when the date passes 50% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 65% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 75% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group E, F, G, and H follow the following rules:

- Items will go on a 10% promotion when the date passes 60% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 70% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 80% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory


Groups I, J, and K follow the following rules:

- Items will go on a 10% promotion when the date passes 40% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 50% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 60% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group L follows the following rules:

- Items will go on a 10% promotion when the date passes 70% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 80% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 90% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

The output of your program will be a printed receipt that shows a list of 12 items (one item from each category), 8 items with the regular price, and 4 items on sale that a customer bought also the customer has 3 items to return from three different categories.

A receipt needs to include the following information on it:

- The price of each item that has a regular price

- If the price is reduced the reduction amount and sales percentage will be printed on the lines below the regular price; therefore the customer will see the regular price, the sales price, the reduced amount, and the sales percentage

- Each item has a unique barcode
- The date and the time of the purchase
- The store number along with the address of the store
- The final Balance
- The payment method

As per our discussion in class, your code needs to ask the following question from the user at the very beginning:
"Would you like to import any item to your store?"
The answer to this question is YES/NO.
If YES, there will be 12 steps to collect the information related to that specific item being imported to the store to fill in and then, the program will proceed with the following steps.
If No, 30 items (3*10, 3 items in each category) have already existed in our store and the program will proceed with the following steps.

Memory management, allocating, and deallocating memory are one of the most important aspects to be considered in this project.

Regarding the promotions tags available in different colors, your application must be able to generate a list of items with the proper color of the tag that depends on the percentage of the promotion.

In order to submit your final version, you need to record a video, a maximum of 4 minutes. In this video, you need to explain the different parts of the code you have written, the functions, the pointers, memory allocation, memory management, and encryption methods, and if available the decryption methods must be explained verbally. The steps you are taking in explaining your written code must follow the steps, line by line, of your main function. This video should clarify the approaches you have taken along with the fulfillment of the requirements of this project.

2. Incomplete code:

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days 

int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category 

int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category 

float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer 

int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer 

int returned_items[] = {3, 7, 11};

int main() 
{
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

   // Print the total price of the items bought
printf("Total price: $%.2f\n", total_price);

// Get user input for product information
char name[50];
char category;
char manufacturer[50];
float purchased_price;
 sale_price;
int quantity;
char purchase_date[11];
char production_date[11];
char expiry_date[11];
int store_code;
char currency[4];

printf("\nEnter the name of the product: ");
scanf("%s", name); 
printf("Enter the category: ");
scanf(" %c", &category);
printf("Enter the company/manufacturer name: ");
scanf("%s", manufacturer); 
printf("Enter the purchased price: ");
scanf("%f", &purchased_price);
printf("Enter the sale price: ");
scanf("%f", &sale_price);
printf("Enter the quantity of purchased items: ");
scanf("%d", &quantity);
printf("Enter the date of purchase (yyyy-mm-dd): ");
scanf("%s", purchase_date);
printf("Enter the date of production (yyyy-mm-dd): ");
scanf("%s", production_date);
printf("Enter the expiry date (yyyy-mm-dd): ");
scanf("%s", expiry_date);
printf("Enter the store code: ");
scanf("%d", &store_code);
printf("Enter the currency of the country: ");
scanf("%s", currency);

// Encrypt the necessary fields to generate the barcode

// Print the barcode
printf("Barcode: %s\n", barcode);

// Determine the discount and print the tag color
float discount_percentage = (1.0 - (sale_price/purchased_price)) * 100.0;

if (discount_percentage > 20) {
    printf("Tag color: Red\n");
} else if (discount_percentage > 10) {
    printf("Tag color: Yellow\n");
} else {
    printf("Tag color: Green\n");
}

return 0;
}

Avatar image
vietchanghg answered this question
Lv1
in Information Technology·
31 Mar 2023

Incomplete code:

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days 

int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category 

int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category 

float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer 

int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer 

int returned_items[] = {3, 7, 11};

int main() 
{
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

   // Print the total price of the items bought
printf("Total price: $%.2f\n", total_price);

// Get user input for product information
char name[50];
char category;
char manufacturer[50];
float purchased_price;
 sale_price;
int quantity;
char purchase_date[11];
char production_date[11];
char expiry_date[11];
int store_code;
char currency[4];

printf("\nEnter the name of the product: ");
scanf("%s", name); 
printf("Enter the category: ");
scanf(" %c", &category);
printf("Enter the company/manufacturer name: ");
scanf("%s", manufacturer); 
printf("Enter the purchased price: ");
scanf("%f", &purchased_price);
printf("Enter the sale price: ");
scanf("%f", &sale_price);
printf("Enter the quantity of purchased items: ");
scanf("%d", &quantity);
printf("Enter the date of purchase (yyyy-mm-dd): ");
scanf("%s", purchase_date);
printf("Enter the date of production (yyyy-mm-dd): ");
scanf("%s", production_date);
printf("Enter the expiry date (yyyy-mm-dd): ");
scanf("%s", expiry_date);
printf("Enter the store code: ");
scanf("%d", &store_code);
printf("Enter the currency of the country: ");
scanf("%s", currency);

// Encrypt the necessary fields to generate the barcode

// Print the barcode
printf("Barcode: %s\n", barcode);

// Determine the discount and print the tag color
float discount_percentage = (1.0 - (sale_price/purchased_price)) * 100.0;

if (discount_percentage > 20) {
    printf("Tag color: Red\n");
} else if (discount_percentage > 10) {
    printf("Tag color: Yellow\n");
} else {
    printf("Tag color: Green\n");
}

return 0;
}

Avatar image
vietchanghg answered this question
Lv1
in Information Technology·
30 Mar 2023

Hello. I had requested help to complete this entire code last week. But the code was only completed 15%? I have placed below the entire assignment needed with 100% completion.   Below the assignment question I have placed the code I have which is only 15% completed. If you can please complete 100% as this is whats needed.   Thank you.    

1 Assignment question:

  The project submitted is missing a long list of the requirements of the assigned project. What is submitted at this point is about 15% of what you have been asked. Please, read the project precisely and in detail.

in this activity, you are designing an application for grocery stores and their inventories.

The items depending on their type are divided into the following categories:

Group A: Meat

Group B: Deli

Group C: Pharmacy

Group D: Seafood

Group E: Beverage

Group F: Canned

Group G: Jarred

Group H: Dry Food

Group I: Dairy

Group J: Bakery

Group K: Personal Care

Group L: Paper Goods

Your store must have at least 3 items in each category.

Your application as the first step needs to collect the following information before importing the items to the store:

1. The name of the product

2. The Category

3. The Company/Manufacturer name

4. The purchased price (What company has paid to buy this product)

5. The sale price (What customers will pay to buy this product)

6. The quantity of the purchased items

7. The date of the purchased items

8. The date of the production

9. The expiry date of the product

10. Store Code (a 4-digit number)

11. The currency of the country


12. Items will go on sale on different dates depending on their categories.

Your application is responsible to use encryption method 1 for #1, and #3. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 2 for #2. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 3 for #4, and #5. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 4 for #6. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 5 for #7, #8, and #9. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 6 for #10. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 7 for #11. (You have to define the suitable encryption method.)


The output of the encryptions will generate a number that will be known as the barcode of that specific item in this store.

Before selecting and implementing your encryption methods, you have to answer the following questions:

- Will all the generated barcodes have the same number of digits?

- How should we deal with barcodes that have different numbers of digits?

- Do you need to define decryption?

- Is there any other questions, aspects, complications, simplifications, etc. that I need to think about in advance?

Items will go on sale on different dates depending on their categories.

Group A, B, C, and D follow the following rules:

- Items will go on a 10% promotion when the date passes 50% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 65% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 75% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group E, F, G, and H follow the following rules:

- Items will go on a 10% promotion when the date passes 60% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 70% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 80% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory


Groups I, J, and K follow the following rules:

- Items will go on a 10% promotion when the date passes 40% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 50% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 60% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group L follows the following rules:

- Items will go on a 10% promotion when the date passes 70% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 80% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 90% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

The output of your program will be a printed receipt that shows a list of 12 items (one item from each category), 8 items with the regular price, and 4 items on sale that a customer bought also the customer has 3 items to return from three different categories.

A receipt needs to include the following information on it:

- The price of each item that has a regular price

- If the price is reduced the reduction amount and sales percentage will be printed on the lines below the regular price; therefore the customer will see the regular price, the sales price, the reduced amount, and the sales percentage

- Each item has a unique barcode
- The date and the time of the purchase
- The store number along with the address of the store
- The final Balance
- The payment method

As per our discussion in class, your code needs to ask the following question from the user at the very beginning:
"Would you like to import any item to your store?"
The answer to this question is YES/NO.
If YES, there will be 12 steps to collect the information related to that specific item being imported to the store to fill in and then, the program will proceed with the following steps.
If No, 30 items (3*10, 3 items in each category) have already existed in our store and the program will proceed with the following steps.

Memory management, allocating, and deallocating memory are one of the most important aspects to be considered in this project.

Regarding the promotions tags available in different colors, your application must be able to generate a list of items with the proper color of the tag that depends on the percentage of the promotion.

In order to submit your final version, you need to record a video, a maximum of 4 minutes. In this video, you need to explain the different parts of the code you have written, the functions, the pointers, memory allocation, memory management, and encryption methods, and if available the decryption methods must be explained verbally. The steps you are taking in explaining your written code must follow the steps, line by line, of your main function. This video should clarify the approaches you have taken along with the fulfillment of the requirements of this project.

2. Incomplete code:

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days 

int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category 

int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category 

float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer 

int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer 

int returned_items[] = {3, 7, 11};

int main() 
{
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

   // Print the total price of the items bought
printf("Total price: $%.2f\n", total_price);

// Get user input for product information
char name[50];
char category;
char manufacturer[50];
float purchased_price;
 sale_price;
int quantity;
char purchase_date[11];
char production_date[11];
char expiry_date[11];
int store_code;
char currency[4];

printf("\nEnter the name of the product: ");
scanf("%s", name); 
printf("Enter the category: ");
scanf(" %c", &category);
printf("Enter the company/manufacturer name: ");
scanf("%s", manufacturer); 
printf("Enter the purchased price: ");
scanf("%f", &purchased_price);
printf("Enter the sale price: ");
scanf("%f", &sale_price);
printf("Enter the quantity of purchased items: ");
scanf("%d", &quantity);
printf("Enter the date of purchase (yyyy-mm-dd): ");
scanf("%s", purchase_date);
printf("Enter the date of production (yyyy-mm-dd): ");
scanf("%s", production_date);
printf("Enter the expiry date (yyyy-mm-dd): ");
scanf("%s", expiry_date);
printf("Enter the store code: ");
scanf("%d", &store_code);
printf("Enter the currency of the country: ");
scanf("%s", currency);

// Encrypt the necessary fields to generate the barcode

// Print the barcode
printf("Barcode: %s\n", barcode);

// Determine the discount and print the tag color
float discount_percentage = (1.0 - (sale_price/purchased_price)) * 100.0;

if (discount_percentage > 20) {
    printf("Tag color: Red\n");
} else if (discount_percentage > 10) {
    printf("Tag color: Yellow\n");
} else {
    printf("Tag color: Green\n");
}

return 0;
}

Avatar image
vietchanghg answered this question
Lv1
in Information Technology·
30 Mar 2023
Hello. I had requested help to complete this entire code last week. But the code was only completed 15%? I have placed below the entire assignment needed with 100% completion.   Below the assignment question I have placed the code I have which is only 15% completed. If you can please complete 100% as this is whats needed.   Thank you.    
  1. Assignment question:
  The project submitted is missing a long list of the requirements of the assigned project. What is submitted at this point is about 15% of what you have been asked. Please, read the project precisely and in detail.

 

in this activity, you are designing an application for grocery stores and their inventories.

The items depending on their type are divided into the following categories:

Group A: Meat

Group B: Deli

Group C: Pharmacy

Group D: Seafood

Group E: Beverage

Group F: Canned

Group G: Jarred

Group H: Dry Food

Group I: Dairy

Group J: Bakery

Group K: Personal Care

Group L: Paper Goods

Your store must have at least 3 items in each category.

Your application as the first step needs to collect the following information before importing the items to the store:

1. The name of the product

2. The Category

3. The Company/Manufacturer name

4. The purchased price (What company has paid to buy this product)

5. The sale price (What customers will pay to buy this product)

6. The quantity of the purchased items

7. The date of the purchased items

8. The date of the production

9. The expiry date of the product

10. Store Code (a 4-digit number)

11. The currency of the country


12. Items will go on sale on different dates depending on their categories.

Your application is responsible to use encryption method 1 for #1, and #3. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 2 for #2. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 3 for #4, and #5. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 4 for #6. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 5 for #7, #8, and #9. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 6 for #10. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 7 for #11. (You have to define the suitable encryption method.)


The output of the encryptions will generate a number that will be known as the barcode of that specific item in this store.

Before selecting and implementing your encryption methods, you have to answer the following questions:

- Will all the generated barcodes have the same number of digits?

- How should we deal with barcodes that have different numbers of digits?

- Do you need to define decryption?

- Is there any other questions, aspects, complications, simplifications, etc. that I need to think about in advance?

Items will go on sale on different dates depending on their categories.

Group A, B, C, and D follow the following rules:

- Items will go on a 10% promotion when the date passes 50% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 65% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 75% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group E, F, G, and H follow the following rules:

- Items will go on a 10% promotion when the date passes 60% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 70% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 80% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory


Groups I, J, and K follow the following rules:

- Items will go on a 10% promotion when the date passes 40% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 50% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 60% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group L follows the following rules:

- Items will go on a 10% promotion when the date passes 70% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 80% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 90% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

The output of your program will be a printed receipt that shows a list of 12 items (one item from each category), 8 items with the regular price, and 4 items on sale that a customer bought also the customer has 3 items to return from three different categories.

A receipt needs to include the following information on it:

- The price of each item that has a regular price

- If the price is reduced the reduction amount and sales percentage will be printed on the lines below the regular price; therefore the customer will see the regular price, the sales price, the reduced amount, and the sales percentage

- Each item has a unique barcode
- The date and the time of the purchase
- The store number along with the address of the store
- The final Balance
- The payment method

As per our discussion in class, your code needs to ask the following question from the user at the very beginning:
"Would you like to import any item to your store?"
The answer to this question is YES/NO.
If YES, there will be 12 steps to collect the information related to that specific item being imported to the store to fill in and then, the program will proceed with the following steps.
If No, 30 items (3*10, 3 items in each category) have already existed in our store and the program will proceed with the following steps.

Memory management, allocating, and deallocating memory are one of the most important aspects to be considered in this project.

Regarding the promotions tags available in different colors, your application must be able to generate a list of items with the proper color of the tag that depends on the percentage of the promotion.

In order to submit your final version, you need to record a video, a maximum of 4 minutes. In this video, you need to explain the different parts of the code you have written, the functions, the pointers, memory allocation, memory management, and encryption methods, and if available the decryption methods must be explained verbally. The steps you are taking in explaining your written code must follow the steps, line by line, of your main function. This video should clarify the approaches you have taken along with the fulfillment of the requirements of this project.

 

2. Incomplete code:

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days 

int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category 

int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category 

float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer 

int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer 

int returned_items[] = {3, 7, 11};

int main() 
{
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

   // Print the total price of the items bought
printf("Total price: $%.2f\n", total_price);

// Get user input for product information
char name[50];
char category;
char manufacturer[50];
float purchased_price;
 sale_price;
int quantity;
char purchase_date[11];
char production_date[11];
char expiry_date[11];
int store_code;
char currency[4];

printf("\nEnter the name of the product: ");
scanf("%s", name); 
printf("Enter the category: ");
scanf(" %c", &category);
printf("Enter the company/manufacturer name: ");
scanf("%s", manufacturer); 
printf("Enter the purchased price: ");
scanf("%f", &purchased_price);
printf("Enter the sale price: ");
scanf("%f", &sale_price);
printf("Enter the quantity of purchased items: ");
scanf("%d", &quantity);
printf("Enter the date of purchase (yyyy-mm-dd): ");
scanf("%s", purchase_date);
printf("Enter the date of production (yyyy-mm-dd): ");
scanf("%s", production_date);
printf("Enter the expiry date (yyyy-mm-dd): ");
scanf("%s", expiry_date);
printf("Enter the store code: ");
scanf("%d", &store_code);
printf("Enter the currency of the country: ");
scanf("%s", currency);

// Encrypt the necessary fields to generate the barcode

// Print the barcode
printf("Barcode: %s\n", barcode);

// Determine the discount and print the tag color
float discount_percentage = (1.0 - (sale_price/purchased_price)) * 100.0;

if (discount_percentage > 20) {
    printf("Tag color: Red\n");
} else if (discount_percentage > 10) {
    printf("Tag color: Yellow\n");
} else {
    printf("Tag color: Green\n");
}

return 0;
}

 

Lv1
in Information Technology·
29 Mar 2023

Hello. 

If someone can provide step by step for me to transfer to a video.

I need to record a video, a maximum of 4 minutes. In this video, Ineed to explain the different parts of the code you have written, the functions, the pointers, memory allocation, memory management, and encryption methods, and if available the decryption methods must be explained verbally. The steps I'm taking in explaining your written code must follow the steps, line by line, of your main function. This video should clarify the approaches you have taken along with the fulfillment of the requirements of this project.

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = { 1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4 };

// Define the durable life period for each item category in days 

int life_period[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130 };

// Define the sale promotion percentage for each item category 

int promotion[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define the regular price for each item category 

float regular_price[] = { 12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99 };

// Define the items bought by the customer 

int bought_items[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

// Define the items returned by the customer 

int returned_items[] = { 3, 7, 11 };

int main()
{
    char barcode[20];
    int i, j;
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

    // Print the total price of the items bought
    printf("Total price: $%.2f\n", total_price);

    // Get user input for product information
    char name[50];
    char category;
    char manufacturer[50];
    float purchased_price;
    sale_price;
    int quantity;
    char purchase_date[11];
    char production_date[11];
    char expiry_date[11];
    int store_code;
    char currency[4];

    printf("\nEnter the name of the product: ");
    scanf("%s", name);
    printf("Enter the category: ");
    scanf(" %c", &category);
    printf("Enter the company/manufacturer name: ");
    scanf("%s", manufacturer);
    printf("Enter the purchased price: ");
    scanf("%f", &purchased_price);
    printf("Enter the sale price: ");
    scanf("%f", &sale_price);
    printf("Enter the quantity of purchased items: ");
    scanf("%d", &quantity);
    printf("Enter the date of purchase (yyyy-mm-dd): ");
    scanf("%s", purchase_date);
    printf("Enter the date of production (yyyy-mm-dd): ");
    scanf("%s", production_date);
    printf("Enter the expiry date (yyyy-mm-dd): ");
    scanf("%s", expiry_date);
    printf("Enter the store code: ");
    scanf("%d", &store_code);
    printf("Enter the currency of the country: ");
    scanf("%s", currency);

    // Encrypt the necessary fields to generate the barcode

    // Print the barcode
    printf("Barcode: %s\n", barcode);

    // Determine the discount and print the tag color
    float discount_percentage = (1.0 - (sale_price / purchased_price)) * 100.0;

    if (discount_percentage > 20) {
        printf("Tag color: Red\n");
    }
    else if (discount_percentage > 10) {
        printf("Tag color: Yellow\n");
    }
    else {
        printf("Tag color: Green\n");
    }

    return 0;
}

Lv1
in Information Technology·
29 Mar 2023

Hello. 

I need to record a video, a maximum of 4 minutes. In this video, you need to explain the different parts of the code you have written, the functions, the pointers, memory allocation, memory management, and encryption methods, and if available the decryption methods must be explained verbally. The steps you are taking in explaining your written code must follow the steps, line by line, of your main function. This video should clarify the approaches you have taken along with the fulfillment of the requirements of this project.

 

 

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = { 1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4 };

// Define the durable life period for each item category in days 

int life_period[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130 };

// Define the sale promotion percentage for each item category 

int promotion[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define the regular price for each item category 

float regular_price[] = { 12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99 };

// Define the items bought by the customer 

int bought_items[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

// Define the items returned by the customer 

int returned_items[] = { 3, 7, 11 };

int main()
{
    char barcode[20];
    int i, j;
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

    // Print the total price of the items bought
    printf("Total price: $%.2f\n", total_price);

    // Get user input for product information
    char name[50];
    char category;
    char manufacturer[50];
    float purchased_price;
    sale_price;
    int quantity;
    char purchase_date[11];
    char production_date[11];
    char expiry_date[11];
    int store_code;
    char currency[4];

    printf("\nEnter the name of the product: ");
    scanf("%s", name);
    printf("Enter the category: ");
    scanf(" %c", &category);
    printf("Enter the company/manufacturer name: ");
    scanf("%s", manufacturer);
    printf("Enter the purchased price: ");
    scanf("%f", &purchased_price);
    printf("Enter the sale price: ");
    scanf("%f", &sale_price);
    printf("Enter the quantity of purchased items: ");
    scanf("%d", &quantity);
    printf("Enter the date of purchase (yyyy-mm-dd): ");
    scanf("%s", purchase_date);
    printf("Enter the date of production (yyyy-mm-dd): ");
    scanf("%s", production_date);
    printf("Enter the expiry date (yyyy-mm-dd): ");
    scanf("%s", expiry_date);
    printf("Enter the store code: ");
    scanf("%d", &store_code);
    printf("Enter the currency of the country: ");
    scanf("%s", currency);

    // Encrypt the necessary fields to generate the barcode

    // Print the barcode
    printf("Barcode: %s\n", barcode);

    // Determine the discount and print the tag color
    float discount_percentage = (1.0 - (sale_price / purchased_price)) * 100.0;

    if (discount_percentage > 20) {
        printf("Tag color: Red\n");
    }
    else if (discount_percentage > 10) {
        printf("Tag color: Yellow\n");
    }
    else {
        printf("Tag color: Green\n");
    }

    return 0;
}

Avatar image
yournotesbuddy answered this question
Lv1
in Information Technology·
23 Mar 2023

Sorry but I just dont unstand what your meaning as Iv change everything scanf to scanf_s. I use Microsoft laptop and so my compiler shows errors if I dont use scanf_s.  Now I am confused  but I just need this code to run effectivly. Thx.

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = { 1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4 };

// Define the durable life period for each item category in days 

int life_period[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130 };

// Define the sale promotion percentage for each item category 

int promotion[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define the regular price for each item category 

float regular_price[] = { 12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99 };

// Define the items bought by the customer 

int bought_items[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

// Define the items returned by the customer 

int returned_items[] = { 3, 7, 11 };

int main()
{
    char barcode[20];
    int i, j;
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf_s(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf_s(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf_s(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf_s(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf_s(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf_s(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf_s(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf_s(barcode, "UNK%d", bought_items[i]);
            break;
        }

        // Calculate the sale price of the item based on the promotion percentage
        sale_price = regular_price[i] * (1 - promotion[i] / 100.0);

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                total_price -= sale_price;
                break;
            }
        }

        // Add the sale price of the item to the total price
        total_price += sale_price;

        // Print the barcode and sale price of the item
        printf("%s %.2f\n", barcode, sale_price);
    }

    // Print the total price of the items purchased
    printf("Total: %.2f\n", total_price);

    // Print the total price of the items bought
    printf("Total price: $%.2f\n", total_price);

    // Get user input for product information
    char name[50];
    char category;
    char manufacturer[50];
    float purchased_price;
    sale_price;
    int quantity;
    char purchase_date[11];
    char production_date[11];
    char expiry_date[11];
    int store_code;
    char currency[4];

    printf("\nEnter the name of the product: ");
    scanf_s("%s", name);
    printf("Enter the category: ");
    scanf_s(" %c", &category);
    printf("Enter the company/manufacturer name: ");
    scanf_s("%s", manufacturer);
    printf("Enter the purchased price: ");
    scanf_s("%f", &purchased_price);
    printf("Enter the sale price: ");
    scanf_s("%f", &sale_price);
    printf("Enter the quantity of purchased items: ");
    scanf_s("%d", &quantity);
    printf("Enter the date of purchase (yyyy-mm-dd): ");
    scanf_s("%s", purchase_date);
    printf("Enter the date of production (yyyy-mm-dd): ");
    scanf_s("%s", production_date);
    printf("Enter the expiry date (yyyy-mm-dd): ");
    scanf_s("%s", expiry_date);
    printf("Enter the store code: ");
    scanf_s("%d", &store_code);
    printf("Enter the currency of the country: ");
    scanf_s("%s", currency);

    // Encrypt the necessary fields to generate the barcode

    // Print the barcode
    printf("Barcode: %s\n", barcode);

    // Determine the discount and print the tag color
    float discount_percentage = (1.0 - (sale_price / purchased_price)) * 100.0;

    if (discount_percentage > 20) {
        printf("Tag color: Red\n");
    }
    else if (discount_percentage > 10) {
        printf("Tag color: Yellow\n");
    }
    else {
        printf("Tag color: Green\n");
    }

    return 0;
}

 

Avatar image
yournotesbuddy answered this question
Avatar image
freekjr1490 answered this question
Avatar image
freekjr1490 answered this question
Avatar image
freekjr1490 answered this question
Lv1
in Information Technology·
23 Mar 2023

Hello. Please can anyone fix this C code to print correct output? Also, Iv added the assignment below code for instructions to compare.

#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>


// Define the encryption methods for each item category 

int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days 

int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category 

int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category 

float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer 

int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer 

int returned_items[] = {3, 7, 11};

int main(); 
{
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "VWX%d", bought_items[i]);
            break;
        }

        // Calculate the price of the item, including any promotions
        price = regular_price[i];
        if (promotion[i] > 0) {
            sale_price = price * (1.0 - (float)promotion[i] / 100.0);
            price = sale_price;
        }

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                price = 0.0;
            }
        }

        // Print the item details and update the total price
        printf("%s - $%.2f\n", barcode, price);
        total_price += price;
    }

    // Print the total price of the items bought
    printf("Total price: $%.2f\n", total_price);

    return

        int main() {
        // define variables for input
        char name[50];
        char category;
        char manufacturer[50];
        float purchased_price;
        float sale_price;
        int quantity;
        char purchase_date[11]; // assuming format yyyy-mm-dd
        char production_date[11]; // assuming format yyyy-mm-dd
        char expiry_date[11]; // assuming format yyyy-mm-dd
        int store_code;
        char currency[4];

        // collect input from user

        printf("Enter the name of the product: ");
        scanf_s("%s", name);
        printf("Enter the category: ");
        scanf_s(" %c", &category);
        printf("Enter the company/manufacturer name: ");
        scanf_s("%s", manufacturer);
        printf("Enter the purchased price: ");
        scanf_s("%f", &purchased_price);
        printf("Enter the sale price: ");
        scanf_s("%f", &sale_price);
        printf("Enter the quantity of purchased items: ");
        scanf_s("%d", &quantity);
        printf("Enter the date of purchase (yyyy-mm-dd): ");
        scanf_s("%s", purchase_date);
        printf("Enter the date of production (yyyy-mm-dd): ");
        scanf_s("%s", production_date);
        printf("Enter the expiry date (yyyy-mm-dd): ");
        scanf_s("%s", expiry_date);
        printf("Enter the store code: ");
        scanf_s("%d", &store_code);
        printf("Enter the currency of the country: ");
        scanf_s("%s", currency);

        // encrypt the necessary fields to generate the barcode

        // print the barcode
        printf("Barcode: %s\n", barcode);
        // determine the discount and print the tag color
    }

 

Instructions:

In this activity, you are designing an application for grocery stores and their inventories.

The items depending on their type are divided into the following categories:

Group A: Meat

Group B: Deli

Group C: Pharmacy

Group D: Seafood

Group E: Beverage

Group F: Canned

Group G: Jarred

Group H: Dry Food

Group I: Dairy

Group J: Bakery

Group K: Personal Care

Group L: Paper Goods

Your store must have at least 3 items in each category.

Your application as the first step needs to collect the following information before importing the items to the store:

1. The name of the product

2. The Category

3. The Company/Manufacturer name

4. The purchased price (What company has paid to buy this product)

5. The sale price (What customers will pay to buy this product)

6. The quantity of the purchased items

7. The date of the purchased items

8. The date of the production

9. The expiry date of the product

10. Store Code (a 4-digit number)

11. The currency of the country


12. Items will go on sale on different dates depending on their categories.

Your application is responsible to use encryption method 1 for #1, and #3. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 2 for #2. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 3 for #4, and #5. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 4 for #6. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 5 for #7, #8, and #9. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 6 for #10. (You have to define the suitable encryption method.)

Your application is responsible to use encryption method 7 for #11. (You have to define the suitable encryption method.)


The output of the encryptions will generate a number that will be known as the barcode of that specific item in this store.

Before selecting and implementing your encryption methods, you have to answer the following questions:

- Will all the generated barcodes have the same number of digits?

- How should we deal with barcodes that have different numbers of digits?

- Do you need to define decryption?

- Is there any other questions, aspects, complications, simplifications, etc. that I need to think about in advance?

Items will go on sale on different dates depending on their categories.

Group A, B, C, and D follow the following rules:

- Items will go on a 10% promotion when the date passes 50% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 65% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 75% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group E, F, G, and H follow the following rules:

- Items will go on a 10% promotion when the date passes 60% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 70% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 80% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory


Groups I, J, and K follow the following rules:

- Items will go on a 10% promotion when the date passes 40% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 50% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 60% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

Group L follows the following rules:

- Items will go on a 10% promotion when the date passes 70% of the durable life period - Yellow Tag

- Items will go on a 25% promotion when the date passes 80% of the durable life period - Green Tag

- Items will go on a 50% promotion when the date passes 90% of the durable life period - Red Tag

- Items will go on a 95% promotion when the date passes 95% of the durable life period - Star Tag and Final Sale (Bring Me Home Today!)

- Items with less than one day of their durable life period must be removed from the shelves and storage to be removed from the inventory

The output of your program will be a printed receipt that shows a list of 12 items (one item from each category), 8 items with the regular price, and 4 items on sale that a customer bought also the customer has 3 items to return from three different categories.

A receipt needs to include the following information on it:

- The price of each item that has a regular price

- If the price is reduced the reduction amount and sales percentage will be printed on the lines below the regular price; therefore the customer will see the regular price, the sales price, the reduced amount, and the sales percentage

- Each item has a unique barcode
- The date and the time of the purchase
- The store number along with the address of the store
- The final Balance
- The payment method

As per our discussion in class, your code needs to ask the following question from the user at the very beginning:
"Would you like to import any item to your store?"
The answer to this question is YES/NO.
If YES, there will be 12 steps to collect the information related to that specific item being imported to the store to fill in and then, the program will proceed with the following steps.
If No, 30 items (3*10, 3 items in each category) have already existed in our store and the program will proceed with the following steps.

Memory management, allocating, and deallocating memory are one of the most important aspects to be considered in this project.

Regarding the promotions tags available in different colors, your application must be able to generate a list of items with the proper color of the tag that depends on the percentage of the promotion.

 

Avatar image
aakashkushwaha8767 answered this question
Lv1
in Information Technology·
23 Mar 2023

Hi. Was I supose to add the last code to the first? The output also show only this:

 

#include <stdio.h>

// Define the encryption methods for each item category int encrypt_method[] = {1, 2, 1, 3, 3, 5, 5, 5, 6, 7, 7, 4};

// Define the durable life period for each item category in days int life_period[] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130};

// Define the sale promotion percentage for each item category int promotion[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

// Define the regular price for each item category float regular_price[] = {12.50, 10.20, 8.75, 6.99, 18.99, 15.55, 11.79, 9.99, 7.25, 5.49, 13.99, 23.99};

// Define the items bought by the customer int bought_items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

// Define the items returned by the customer int returned_items[] = {3, 7, 11};

int main() {
    char barcode[20]; 
    int i, j; 
    float price, sale_price, total_price = 0.0;

    // Generate barcodes for each item and print the receipt
    printf("Receipt:\n");

    for (i = 0; i < 12; i++) {
        // Encrypt the barcode using the appropriate encryption method
        switch (encrypt_method[i]) {
        case 1:
            sprintf(barcode, "ABC%d", bought_items[i]);
            break;
        case 2:
            sprintf(barcode, "DEF%d", bought_items[i]);
            break;
        case 3:
            sprintf(barcode, "GHI%d", bought_items[i]);
            break;
        case 4:
            sprintf(barcode, "JKL%d", bought_items[i]);
            break;
        case 5:
            sprintf(barcode, "MNO%d", bought_items[i]);
            break;
        case 6:
            sprintf(barcode, "PQR%d", bought_items[i]);
            break;
        case 7:
            sprintf(barcode, "STU%d", bought_items[i]);
            break;
        default:
            sprintf(barcode, "VWX%d", bought_items[i]);
            break;
        }

        // Calculate the price of the item, including any promotions
        price = regular_price[i];
        if (promotion[i] > 0) {
            sale_price = price * (1.0 - (float)promotion[i] / 100.0);
            price = sale_price;
        }

        // Check if the item was returned and adjust the total price accordingly
        for (j = 0; j < 3; j++) {
            if (returned_items[j] == bought_items[i]) {
                price = 0.0;
            }
        }

        // Print the item details and update the total price
        printf("%s - $%.2f\n", barcode, price);
        total_price += price;
    }

    // Print the total price of the items bought
    printf("Total price: $%.2f\n", total_price);

    return


Start filling in the gaps now
Log in