3
answers
0
watching
167
views
brmLv1
3 Apr 2023
here it is:
6 of 202
assignment 158
School ITD Canada
Michael Banville <[email protected]>
Mar 23, 2023, 4:20 PM (11 days ago)
to Farid
Hello Farid.
Here's my assignment 158.
Regards.
Michael Banville
4 Attachments • Scanned by Gmail
Michael Banville
Mar 30, 2023, 9:14 AM (4 days ago)
---------- Forwarded message --------- From: Michael Banville <[email protected]> Date: Thu, Mar 23, 2023 at 4:20 PM Subject: assignment 158 To: Farid
Farid Vahedi
Mar 30, 2023, 9:39 AM (4 days ago)
Hi Mike, The project you have submitted is missing a long list of the requirements of the assigned project. What is submitted at this point is about 15% of what
Michael Banville <[email protected]>
Mar 30, 2023, 12:38 PM (4 days ago)
to Farid
Thank you, I will do that.
ReplyForward
#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;
}
here it is:
6 of 202 assignment 158 School ITD Canada Michael Banville <[email protected]> Mar 23, 2023, 4:20 PM (11 days ago) to Farid Hello Farid. Here's my assignment 158. Regards. Michael Banville 4 Attachments • Scanned by Gmail Michael Banville Mar 30, 2023, 9:14 AM (4 days ago) ---------- Forwarded message --------- From: Michael Banville <[email protected]> Date: Thu, Mar 23, 2023 at 4:20 PM Subject: assignment 158 To: Farid Farid Vahedi Mar 30, 2023, 9:39 AM (4 days ago) Hi Mike, The project you have submitted is missing a long list of the requirements of the assigned project. What is submitted at this point is about 15% of what Michael Banville <[email protected]> Mar 30, 2023, 12:38 PM (4 days ago) to Farid Thank you, I will do that. ReplyForward #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; }
vietchanghgLv10
3 Apr 2023
Read by 1 person
3 Apr 2023
Already have an account? Log in