ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and Physical Sciences CRICOS Provider No. 00103D Page 1 of 4 ITECH5403 - Assignment 2 – Parallel...

1 answer below »
There is marking criteria at the end of assignment i want according to it once you see it let me know the price and any questions.


ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and Physical Sciences CRICOS Provider No. 00103D Page 1 of 4 ITECH5403 - Assignment 2 – Parallel Implementations Due Date: 16:00, Friday of Week 10 This assignment will test your skills in programming applications to specification in a number of different programming languages, and is worth 20% of your non-invigilated (type A) marks for this course. Assignment Overview You are tasked with creating a program for a pizza shop – however, as this is a comparative languages course, you will be creating the same application in the following programming languages: • C, • Python, • Java and • Lisp. As you implement the application in each language, you should keep notes on the features of the languages used, which you found useful, as well as any issues or complications which arose due to the complexity or lack of any language features. A brief discussion based on these programming features for each individual language accompanying each implementation is required. Finally, a comparative overview of the languages highlighting applicability based on your experience in the design, implementation and debugging of your code is also required. If you foresee or encounter any complications, you may opt to implement or incorporate additional language features which may be lacking, i.e. data structures. This can be done via: • Your own implementation, • Through libraries, or • Via the incorporation of existing source code. You can use code found on the Internet, but use of any existing code must be referenced. Program Specification Users may order one or more pizzas, where each pizza may be either: small, medium or large. Small pizzas cost $5, medium pizzas cost $8 and large pizzas cost $12. All pizzas come on a tomato base (for our pizza shop, this will be the only option), and will have the topping cheese by default, at no extra cost. Users may choose up to a maximum of four additional toppings (bringing the total to five) from the following list, where each topping adds an additional $1 to the price of the pizza: • Bacon, • Olives, • Ham, • Mushrooms, ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and Physical Sciences CRICOS Provider No. 00103D Page 2 of 4 • Pineapple, • Salami, • Anchovies. A pizza order consists of an order for one or more pizzas, where each pizza has a size, and may optionally include a list of up to four additional toppings. Each pizza order must be marked as either to be collected or to be delivered. If the pizza is to be collected then the order requires a name and a phone number to be valid. If the pizza is to be delivered then a name, phone number and address are required to be valid. In addition, if the order total is less than $30 then an $8 delivery fee is added to the total. The application must be error tolerant and capable of accepting keyboard input to store a number of pizza orders in memory (they do not have to be persisted to file), as well as displaying an order summary which include details of all orders, including: • The details of each pizza in the order, • The total cost of the order, and • The name, phone number and (if required) address of the person who made the order. Suggested Development Environments Codeblocks for C '99 Code::Blocks can be downloaded from: http://www.codeblocks.org/downloads/binaries To create a new C project is: When you create a project, choose File | New and then Console Application, and then choose C as the programming language. IDLE for Python Python, including the IDLE development environment can be downloaded from: https://www.python.org/downloads/ NetBeans for Java 7 or Java 8 NetBeans may be freely downloaded from: https://netbeans.org. It does not come with the Java JDK, which must the downloaded separately from: http://www.oracle.com/technetwork/java/javase/downloads/index.html GNU CLisp for Common Lisp CLISP 2.49 can be sourced from: http://sourceforge.net/projects/clisp/files/latest/downloadhttps://sourceforge.net/projects/clisp/ Any good text editor would be suitable for writing the source code. http://www.codeblocks.org/downloads/binaries https://www.python.org/downloads/ http://www.oracle.com/technetwork/java/javase/downloads/index.html ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and Physical Sciences CRICOS Provider No. 00103D Page 3 of 4 Additional Documentation – Language Suitability Report The design of each programming language incorporates a number of decisions about the language which make it more or less suitable for given tasks. During your implementation of the pizza program in each of the languages you should make notes about the language features which exist or do not exist, and which have therefore made program development easier or more difficult. Where a language has not provided a feature which would have been useful to the implementation of the program, or where the complexity of using a language feature has been high you should remark upon it and briefly discuss a mechanism or feature of another language which would have made development easier. After completing the application in all languages (or as many as you can), discuss the comparative ease of implementation in terms of the design, implementation and debugging for each programming language, including how robustness issues were addressed. Submission and Marking Process You must supply your program source code files and language suitability report documentation in as single compressed archive called: ITECH5403_Assignment_2__.zip You may supply your programming language suitability report in either Word or LibreOffice/OpenOffice format in which the document can be edited – no proprietary Mac specific formats, please. Assignments will be marked on the basis of fulfilment of the requirements and the quality of the work. In addition to the marking criteria, marks may be deducted for failure to comply with the assignment requirements, including (but not limited to): • Incomplete implementation(s), and • Incomplete submissions (e.g. missing files), and • Poor spelling and grammar. Submit your assignment (all program source files plus your discussion document) to the Assignment 2 Upload location on Moodle before the deadline of Friday of week 10 at 5pm. The mark distribution for this assignment is explained on the next page. ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and Physical Sciences CRICOS Provider No. 00103D Page 4 of 4 Assignment 2 – Parallel Implementations Student name: Student ID: Requirement Weight Mark Implementation of the pizza shop program in the C programming language. Areas of note include: - Use of data structures, - Robust input handling which does not cause program termination if provided with bad data (i.e. program expects a number, gets given alphanumerical data). Discussion on implementation: - Language features, issues and suitability. 15 5 Implementation of the pizza shop program in the Python programming language. Areas of note include: - Python Standard library, - List mechanisms, Discussion on implementation: - Language features, issues and suitability 15 5 Implementation of the pizza shop program in the Java programming language. Areas of note include: - Object orientation mechanism / method calls, - Error handling - Standard Java libraries Discussion on implementation - Language features, issues and suitability 15 5 Implementation of the pizza shop program in the Lisp programming language. Areas of note include the Lisp: - Use of recursion - lists - Inbuilt data structures Discussion on implementation - Language features, issues and suitability 15 5 Documentation and discussion of the comparative ease of implementation (design / implement / debug) in each programming language, including how robustness issues were addressed. 15 Spelling and grammar 5 Assignment mark total / 100 Contribution to unit mark (out of 20%) % Comments: Due Date: 16:00, Friday of Week 10 Codeblocks for C '99 IDLE for Python GNU CLisp for Common Lisp
Answered Same DaySep 29, 2021ITECH5403

Answer To: ITECH5403 – Comparative Programming Languages School of Engineering, Information Technology and...

Neha answered on Oct 08 2021
141 Votes
66745 - pizza parallel/C Language/pizza_order.txt
66745 - pizza parallel/C Language/PizzaShop.c
#include
#include
#include
#include
#include
const char *creds = "pizza_order.txt";
char sizes[4][8] = {"None", "Small", "Medium", "Large"};
int price[4] = {0, 5, 8, 12};
char toppings[8][10] = {"None", "Bacon", "Olives", "Ham", "Mushrooms", "pineapple", "Salami", "Anchovies"};
char ortype[3][8] = {"None", "Collect", "Deliver"};
int order[10][8]= {{0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0},
                 {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}};
void start0();
void main(){
start0();
}
    
void mainMenu();
void start0(){
    printf("\n--------------------- Welcome to Pizza Shop ---------------------");
    printf("\n**************************************************************************");
    printf("\nMain M
enu : ");
    printf("\n 1.) Add Order.");
    printf("\n 2.) View Orders.");
    printf("\n 3.) Exit.");
    mainMenu();
}
void new_Order();
void views();
void endprog();
void mainMenu() {
    printf("\nPlease select (1,2 or 3):");
    int ip0a;
    scanf("%d", &ip0a);
    if (ip0a == 1) {
        new_Order();
    } else if (ip0a == 2){
        views();
    } else if ( ip0a == 3){
        endprog();
    } else {
        printf("\n\nPlease select valid Option.");
        mainMenu();
    }
}
void endprog() {
    printf("\nDo you really want to QUIT ?");
    printf("\n[Y]es / [N]o : ");
    char aq5[3];
    gets(aq5);
    if (strcmp(strupr(aq5), "Y")==0){
        printf("\n Thank You! See you soon. \n");
        exit(0);
    }
    else if (strcmp(strupr(aq5), "N")==0){
        printf(" ");
        system("cls");
        start0();
    } else {
        printf("\n\nPlease select valid Option.");
        endprog();
    }
}
void new_Order();
void addOrder(){
    printf("\nAdd a new Order...");
    new_Order();
}
void sizeselect();
void new_Order(){
    printf("\nPlease Select an Option for pizza Size from below: ");
    printf("\n 1.) Small pizza - $5 ");
    printf("\n 2.) Medium pizza - $8 ");
    printf("\n 3.) Large pizza - $12 ");
    sizeselect();
}
int psize=0;
void sizesave();
void sizeselect(){
    printf("\nPlease Enter an Option for pizza Size : ");
    int ip1a;
    scanf("%d", &ip1a);
    switch (ip1a) {
        case 1:
            psize = 1;
            sizesave();
            break;
        case 2:
            psize = 2;
            sizesave();
            break;
        case 3:
            psize = 3;
            sizesave();
            break;
        default:
            printf("\nPlease Enter the Correct Option.");
            sizeselect();
            break;
    }
}
int i;
void selectToppings();
void sizesave() {
    for (int j = 0; j<9; j++) {
        int s = order[j][0];
        if (s != 0) {
            i++;
        }
    }
order[i][0] = psize;
    printf("\n\nPizza Base : Tomato");
    printf("\nToppings : Cheese"");
    printf("\nExtra Toppings : Maximum 4");
    printf("\nExtra $1 for each toppings");
    
    printf("\nPlease Select an Option for Toppings from below: ");
    printf("\n Option 0.) No Topping");
    printf("\n Option 1.) Bacon");
    printf("\n Option 2.) Olives");
    printf("\n Option 3.) Hum");
    printf("\n Option 4.) Mushrooms");
    printf("\n Option 5.) pineapple");
    printf("\n Option 6.) Salami");
    printf("\n Option 7.) Anchovies\n");
    selectToppings();
}
void showpizza();
void selectToppings() {
    printf("\nPlease Enter an Option between '0' and '7' : ");
    printf("\nPlease enter value for First topping : ");
    int topping1;
    scanf("%d", &topping1);
    printf("\nPlease enter value for Second topping : ");
    int topping2;
    scanf("%d", &topping2);
    printf("\nPlease enter value for Third topping : ");
    int topping3;
    scanf("%d", &topping3);
    printf("\nPlease enter value for Fourth topping : ");
    int topping4;
    scanf("%d", &topping4);
    if (((topping1 >= 0) && (topping1 <= 7)) && ((topping2 >= 0) && (topping2 <= 7)) &&
        ((topping3 >= 0) && (topping3 <= 7)) && ((topping4 >= 0) && (topping4 <= 7))){
        order[i][1] = topping1;
        order[i][2] = topping2;
        order[i][3] = topping3;
        order[i][4] = topping4;
        showpizza();
    } else {
        printf("\nPlease Enter Valid Toppings Options...");
        selectToppings();
    }
}
void pizzacount();
void showpizza() {
    printf("\nYour Customized pizzas are: ");
    for(int j = 0;j < 9; j++){
        int s = order[j][0];
        if (s != 0) {
            printf("\n\n Pizza Size: %s, Toppings: %s, %s, %s, %s.\n", sizes[order[j][0]], toppings[order[j][1]],
                    toppings[order[j][2]], toppings[order[j][3]], toppings[order[j][4]]);
        }
        if (order[j][5] != 0) {
printf(" Quantity: %d.", order[j][5]);
}
    }
    pizzacount();
}
void addNewPizza();
void pizzacount(){
    printf("\nPlease Enter number of Pizzas: ");
    int pizzano;
    scanf("%d", &pizzano);
    order[i][5] = pizzano;
    
    addNewPizza();
}
void ordertype();
void addNewPizza() {
    printf("\nWould you like to Add another Pizza in your Order ? \n([Y]es/[N]o)");
    char ans[3];
    gets(ans);
    if (strcmp(strupr(ans), "Y")==0) {
        new_Order();
    } else if (strcmp(strupr(ans), "N")==0){
        ordertype();
    } else {
        printf("\n\nPlease Enter Valid Option...");
        addNewPizza();
    }
}
void customerdetails();
void ordertype() {
    printf("\nWill you [C]ollect your Order from Shop or want to get [D]elivered to you ?");
    char ans[3];
    gets(ans);
    for (int j=0; j<9; j++){
        int s = order[j][0];
        if (s != 0) {
            if (strcmp(strupr(ans), "C")==0){
                order[j][6] = 1;
                order[j][7] = 0;
            } else if (strcmp(strupr(ans), "D")==0){
                order[j][6] = 2;
                order[j][7] = 8;
            } else {
                printf("\n\nPlease Enter Valid Option.");
                ordertype();
            }
        }
    }
    customerdetails();
}
char name[50], address[100] = "Not Applicable";
char phoneno[17];
void showorder();
void customerdetails() {
    printf("\nPlease enter your Name: ");
    gets(name);
    printf("\nPlease enter your phone Number: ");
    gets(phoneno);
    if(order[0][6] == 2){
        printf("\nPlease enter delivery Address: ");
        gets(address);
    }
    showorder();
}
void question();
void showorder() {
    printf("\n--------------------- Order Invoice ---------------------");
    
    printf("\nName: %s\nPhone Number: %s \nAddress: %s.", name, phoneno, address);
    char invoicep1[300];
    sprintf(invoicep1, "Name: %s\nPhone Number: %s\nAddress: %s.", name, phoneno, address);
    int totalprice = 0;
    int k = 1;
    char invoicep2[10][500];
    for (int j=0; j<9; j++ ) {
        int s = order[j][0];
        if (s != 0) {
            
            for (int k=1; k<=4; k++) {
                if (order[j][k] != 0) {
                    totalprice = totalprice + order[j][5];
                }
            }
            totalprice = totalprice + (price[order[j][0]] * order[j][5]);
            sprintf(invoicep2[j], "\n%d.) Pizza size: %s, Price: $%d, Number of Pizzas: %d, \n Toppings: %s, %s, %s, %s.",
k, sizes[order[j][0]], price[order[j][0]], order[j][5], toppings[order[j][1]],
toppings[order[j][2]], toppings[order[j][3]], toppings[order[j][4]]);
            printf("\n\n%d.) Pizza size: %s, Price: $%d, Number of Pizzas: %d, \n Toppings: %s, %s, %s, %s.",
k, sizes[order[j][0]], price[order[j][0]], order[j][5], toppings[order[j][1]],
toppings[order[j][2]], toppings[order[j][3]], toppings[order[j][4]]);
                    
            k++;
        }
    }
    printf("\n\n1$ charged for Each Topping on each pizza.\nOrder Type: %s.", ortype[order[0][6]]);
    char invoicep3[80];
    sprintf(invoicep3, "\n1$ charged for Each Topping on each pizza.\nOrder Type: %s.", ortype[order[0][6]]);
    char invoicep4[50];
    sprintf(invoicep4, " ");
    printf(" ");
    if ((totalprice <= 30) && order[0][6]==2){
        totalprice = totalprice + 8;
        printf("\n\n(Additional $8 Delivery Charge for Total Amount below $30.)");
        sprintf(invoicep4, "\n(Additional $8 Delivery Charge for Total Amount below $30.)");
    }
    
    char invoicep5[30];
    sprintf(invoicep5, "\nTotal Amount: $%d.\n", totalprice);
    printf("\n\nTotal Amount: $%d.\n\n", totalprice);
    
    
    char save[5000];
    sprintf(save, strcat(save, invoicep1));
    
    for (int j=0; j<9; j++){
        if (invoicep2[j] != NULL ){
            sprintf(save, strcat(save, invoicep2[j]));
}
}
    
    sprintf(save, strcat(save, invoicep3));
    sprintf(save, strcat(save, invoicep4));
    sprintf(save, strcat(save, invoicep5));
    
    FILE* fp;
    fp = fopen(creds, "a");
    fprintf(fp, "\n");
    fprintf(fp, save);
    fprintf(fp, "\n");
    fclose(fp);
    
    for (int j = 0; j<9; j++) {
        for (int k = 0; k<8; k++){
            order[j][k] = 0;
        }
    }
    strcpy(save, " ");
    strcpy(name, " ");
    strcpy(phoneno, " ");
    strcpy(address, " ");
    strcpy(invoicep1, " ");
    strcpy(*invoicep2, " ");
    strcpy(invoicep3, " ");
    strcpy(invoicep4, " ");
    strcpy(invoicep5, " ");
    
    question();
}
void question() {
    printf("Do you want to [A]dd another Order or [R]eturn to main Menu ?");
    char ans[3] ;
    gets(ans);
    if (strcmp(strupr(ans), "A")==0){
        addOrder();
    } else if (strcmp(strupr(ans), "R")==0){
        system("cls");
        start0();
    } else {
        printf("\n\nPlease Enter a Valid Option...");
        question();
    }
}
void menuSelection();
void views(){
    FILE * fp;
    char str[maxchar];
    fp = fopen(creds, "r");
    if (fp == NULL){
        printf("\n\nCould not open file %s", creds);
    }
    int ordno = 1;
    while (fgets(str, maxchar, fp) != NULL) {
        printf("%s", str);
        ordno = ordno + 1;
    }
    fclose(fp);
    
    menuSelection();
}
void menuSelection() {
    printf("\n\nDo you want to [R]eturn to main Menu or [Q]uit ?");
    char ans[3] ;
    gets(ans);
    if (strcmp(strupr(ans), "Q")==0){
        endprog();
    } else if (strcmp(strupr(ans), "R")==0){
        system("cls");
        start0();
    } else {
        printf("\n\nPlease Enter a Valid Option...");
        menuSelection();
    }
}
66745 - pizza parallel/Java Code/pizza_order.txt
66745 - pizza parallel/Java Code/PizzaShop.java
66745 - pizza parallel/Java...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here