Homework Help for Information Technology

1,530 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.

Avatar image
sadiqnav answered this question
Lv1
in Information Technology·
3 Apr 2023

Here's the full code that has errors. Thx


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

typedef struct {
    char name[50];
    char category;
    char company[50];
    float purchased_price;
    float sale_price;
    int quantity;
    time_t purchased_date;
    time_t production_date;
    time_t expiry_date;
    int store_code;
    char currency[4];
    long barcode;
} Item;

typedef struct {
    time_t purchase_time;
    Item *items;
    int item_count;
} Receipt;

// Caesar cipher encryption
void encrypt_caesar_cipher(char *input, int key, char *output) {
    int i = 0;
    while (input[i] != '\0') {
        char c = input[i];
        if (isalpha(c)) {
            char base = isupper(c) ? 'A' : 'a';
            output[i] = (c - base + key) % 26 + base;
        } else {
            output[i] = c;
        }
        i++;
    }
    output[i] = '\0';
}

// Caesar cipher decryption
void decrypt_caesar_cipher(char *input, int key, char *output) {
    encrypt_caesar_cipher(input, 26 - key, output);
}
// Function to generate a random item
Item create_random_item() {
    Item item;
    int category_random = rand() % 12;

    // Assign random category
    if (category_random <= 3) {
        item.category = 'A';
    } else if (category_random <= 7) {
        item.category = 'B';
    } else if (category_random <= 10) {
        item.category = 'C';
    } else {
        item.category = 'D';
    }

    // Generate random values for item fields
    char *names[4] = {"apple", "banana", "chocolate", "water bottle"};
    strcpy(item.name, names[rand() % 4]);
    strcpy(item.company, "ABC Company");
    item.purchased_price = ((rand() % 100) + 1) / 10.0;
    item.sale_price = item.purchased_price;
    item.quantity = rand() % 10 + 1;
    item.purchased_date = time(NULL);
    item.production_date = item.purchased_date - (rand() % 60) * 24 * 60 * 60;  // 0-60 days before purchase
    item.expiry_date = item.production_date + (rand() % 180) * 24 * 60 * 60;  // 0-180 days after production
    item.store_code = rand() % 10000 + 1;
    strcpy(item.currency, "USD");
    item.barcode = generate_barcode(&item);

    return item;
}
// Define function to create a random item
Item create_random_item() {
    Item item;

    // Set a random item name
    char *names[] = {"Apple", "Banana", "Orange", "Pear", "Grapes", "Pineapple", "Watermelon", "Strawberry", "Mango", "Kiwi"};
    int name_index = rand() % 10;
    strcpy(item.name, names[name_index]);

    // Set a random item category
    char categories[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'};
    int category_index = rand() % 12;
    item.category = categories[category_index];

    // Set a random item manufacturer
    char *manufacturers[] = {"Apple Inc.", "Samsung", "Microsoft", "Google", "Amazon", "Sony", "Nike", "Adidas", "Puma", "Reebok"};
    int manufacturer_index = rand() % 10;
    strcpy(item.manufacturer, manufacturers[manufacturer_index]);

    // Set a random purchased price
    item.purchased_price = (float) (rand() % 100 + 1);

    // Set a random sale price
    item.sale_price = item.purchased_price * (1.0 + ((float) (rand() % 20 + 1) / 100.0));

    // Set a random quantity
    item.quantity = rand() % 10 + 1;

    // Set a random purchased date
    item.purchased_date = time(NULL) - (rand() % (30 * 24 * 60 * 60)); // up to 30 days ago

    // Set a random production date
    item.production_date = time(NULL) - (rand() % (365 * 24 * 60 * 60)); // up to 1 year ago

    // Set a random expiry date (between 1 and 3 years from the production date)
    item.expiry_date = item.production_date + ((rand() % 730) + 365) * 24 * 60 * 60;

    // Set a random store code
    item.store_code = rand() % 10000;

    // Set a random currency
    char *currencies[] = {"USD", "EUR", "GBP", "JPY", "CAD", "AUD", "CHF", "CNY"};
    int currency_index = rand() % 8;
    strcpy(item.currency, currencies[currency_index]);

    // Set a random barcode
    item.barcode = generate_barcode(&item);

    return item;
}
void encrypt_caesar_cipher(char *input, int key, char *output) {
    int i = 0;
    while (input[i] != '\0') {
        char c = input[i];
        if (isalpha(c)) {
            char base = isupper(c) ? 'A' : 'a';
            output[i] = (c - base + key) % 26 + base;
        } else {
            output[i] = c;
        }
        i++;
    }
    output[i] = '\0';
}

unsigned long generate_barcode(Item *item) {
    // Encrypt the required fields
    char encrypted_name[100], encrypted_company[100];
    encrypt_caesar_cipher(item->name, 3, encrypted_name);
    encrypt_caesar_cipher(item->company, 3, encrypted_company);

    // Combine the encrypted information to generate a barcode (just as an example, not an actual barcode)
    unsigned long barcode = 0;
    for (int i = 0; encrypted_name[i] != '\0'; i++) {
        barcode += encrypted_name[i];
    }
    for (int i = 0; encrypted_company[i] != '\0'; i++) {
        barcode += encrypted_company[i];
    }

    return barcode;
}
void generate_receipt(Item* items, int num_items) {
    Receipt receipt;
    receipt.purchase_time = time(NULL);
    receipt.items = items;
    receipt.item_count = num_items;
    print_receipt(&receipt);
}
int main() {
    srand(time(NULL));
    int num_items = 5;
    Item items[num_items];
    for (int i = 0; i < num_items; i++) {
        items[i] = create_random_item();
        apply_discounts(&items[i], time(NULL));
    }
    generate_receipt(items, num_items);
    return 0;
}

Lv1
in Information Technology·
3 Apr 2023

Hi. Thank you for responding and provinding your code. I am using a free online compiler and this was the result. If you could rectify these errors that would help lots. Thx.

main.c: In function ‘encrypt_caesar_cipher’: main.c:32:13: warning: implicit declaration of function ‘isalpha’ [-Wimplicit-function-declaration] 32 | if (isalpha(c)) { | ^~~~~~~ main.c:5:1: note: include ‘’ or provide a declaration of ‘isalpha’ 4 | #include <time.h> +++ |+#include <ctype.h> 5 | main.c:33:25: warning: implicit declaration of function ‘isupper’ [-Wimplicit-function-declaration] 33 | char base = isupper(c) ? 'A' : 'a'; | ^~~~~~~ main.c:33:25: note: include ‘’ or provide a declaration of ‘isupper’ main.c: In function ‘create_random_item’: main.c:75:20: warning: implicit declaration of function ‘generate_barcode’ [-Wimplicit-function-declaration] 75 | item.barcode = generate_barcode(&item); | ^~~~~~~~~~~~~~~~ main.c: At top level: main.c:80:6: error: redefinition of ‘create_random_item’ 80 | Item create_random_item() { | ^~~~~~~~~~~~~~~~~~ main.c:48:6: note: previous definition of ‘create_random_item’ with type ‘Item()’ 48 | Item create_random_item() { | ^~~~~~~~~~~~~~~~~~ main.c: In function ‘create_random_item’: main.c:96:16: error: ‘Item’ has no member named ‘manufacturer’ 96 | strcpy(item.manufacturer, manufacturers[manufacturer_index]); | ^ main.c: At top level: main.c:129:6: error: redefinition of ‘encrypt_caesar_cipher’ 129 | void encrypt_caesar_cipher(char *input, int key, char *output) { | ^~~~~~~~~~~~~~~~~~~~~ main.c:28:6: note: previous definition of ‘encrypt_caesar_cipher’ with type ‘void(char *, int, char *)’ 28 | void encrypt_caesar_cipher(char *input, int key, char *output) { | ^~~~~~~~~~~~~~~~~~~~~ main.c:144:15: error: conflicting types for ‘generate_barcode’; have ‘long unsigned int(Item *)’ 144 | unsigned long generate_barcode(Item *item) { | ^~~~~~~~~~~~~~~~ main.c:75:20: note: previous implicit declaration of ‘generate_barcode’ with type ‘int()’ 75 | item.barcode = generate_barcode(&item); | ^~~~~~~~~~~~~~~~ main.c: In function ‘generate_receipt’: main.c:166:5: warning: implicit declaration of function ‘print_receipt’ [-Wimplicit-function-declaration] 166 | print_receipt(&receipt); | ^~~~~~~~~~~~~ main.c: In function ‘main’: main.c:174:9: warning: implicit declaration of function ‘apply_discounts’ [-Wimplicit-function-declaration] 174 | apply_discounts(&items[i], time(NULL)); | ^~~~~~~~~~~~~~~
Lv1
in Information Technology·
2 Apr 2023

Hello. 

are you able to wright an entire code by reading my assignment. Thx.

 

 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.

Lv1
in Information Technology·
2 Apr 2023

I cant exspress this enough as I have spent $$ for someone to wright a FULLY COMPLETED CODE!! based off the ENTIRE BELOW ASSIGNMENT!

Its been over a week and not one person has actualy been able to do.

PLEASE!! dont reply unless you READ the assignment in full, understand it in full and completed code 100%

Thank you.

 

This C code was only completed 15%? I have placed below the entire assignment below which I realy need 100% completion. 

 I have placed the code below question 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.

 

 

#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() {
    int quantity;
    float price, total_price;
    printf("Enter the quantity of the item: ");
    scanf("%d", &quantity);
    printf("Enter the price of the item: ");
    scanf("%f", &price);
    total_price = quantity * price;
    printf("Total price: %.2f", total_price);
    return 0;
}
    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


    // 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 is being returned
        for (j = 0; j < 3; j++) {
            if (bought_items[i] == returned_items[j]) {
                sale_price = 0.0;
                break;
            }
        }

        // Print the barcode and the sale price of the item
        printf("Item %d: %s - $%.2f\n", i+1, barcode, sale_price);

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

    // Print the total price
    printf("Total price: $%.)

 

Lv1
in Information Technology·
2 Apr 2023

I cant exspress this enough as I have spent $$ for someone to wright a FULLY COMPLETED CODE!! based off the ENTIRE BELOW ASSIGNMENT!

Its been over a week and not one person has actualy been able to do.

PLEASE!! dont reply unless you READ the assignment in full, understand it in full. PLEASE! reply and send ONLY 100% completed code that is usable and works.

Thank you.

 

This C code was only completed 15%? I have placed below the entire assignment below which I realy need 100% completion. 

 I have placed the code below question 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.

 

 

#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() {
    int quantity;
    float price, total_price;
    printf("Enter the quantity of the item: ");
    scanf("%d", &quantity);
    printf("Enter the price of the item: ");
    scanf("%f", &price);
    total_price = quantity * price;
    printf("Total price: %.2f", total_price);
    return 0;
}
    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


    // 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 is being returned
        for (j = 0; j < 3; j++) {
            if (bought_items[i] == returned_items[j]) {
                sale_price = 0.0;
                break;
            }
        }

        // Print the barcode and the sale price of the item
        printf("Item %d: %s - $%.2f\n", i+1, barcode, sale_price);

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

    // Print the total price
    printf("Total price: $%.

 

Avatar image
aluseph asked for the first time
Lv1
in Information Technology·
1 Apr 2023

This C code was only completed 15%? I have placed below the entire assignment below which I realy need 100% completion. 

 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.

 

 

#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() {
    int quantity;
    float price, total_price;
    printf("Enter the quantity of the item: ");
    scanf("%d", &quantity);
    printf("Enter the price of the item: ");
    scanf("%f", &price);
    total_price = quantity * price;
    printf("Total price: %.2f", total_price);
    return 0;
}
    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


    // 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 is being returned
        for (j = 0; j < 3; j++) {
            if (bought_items[i] == returned_items[j]) {
                sale_price = 0.0;
                break;
            }
        }

        // Print the barcode and the sale price of the item
        printf("Item %d: %s - $%.2f\n", i+1, barcode, sale_price);

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

    // Print the total price
    printf("Total price: $%.

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
academic-help answered this question
Avatar image
academic-help answered this question
Avatar image
academic-help answered this question
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;
}


Start filling in the gaps now
Log in