ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information...

1 answer below »
please make sure there is no plagiarism occurs




ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology ITECH5403 - Assignment 2 – Parallel Implementations 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, · 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 several 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/ Eclipse for Java 7 or Java 8 Eclipse may be freely downloaded from: http://www.eclipse.org/downloads/ Eclipse does not come with the Java JDK, which must the downloaded separately from: http://www.oracle.com/technetwork/java/javase/downloads/index.html Ensure that your Eclipse type and Java type match – i.e. 32-bit Java for 32-bit Eclipse, or 64-bit Java for 64-bit Eclipse. If you mix and match it won't work. GNU CLisp for Common Lisp CLISP 2.49 can be sourced from: http://sourceforge.net/projects/clisp/files/latest/download Any good text editor would be suitable for writing the source code. 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. The mark distribution for this assignment is explained on the next page. 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: CRICOS Provider No. 00103D Page 1 of 4 CRICOS Provider No. 00103D Page 1 of 4 CRICOS Provider No. 00103D Page 1 of 4
Answered Same DaySep 02, 2020ITECH5403

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

Snehil answered on Sep 21 2020
141 Votes
My Work/C/Parallel implementation Pizza 33284/bin/Debug/Parallel implementation Pizza 33284.exe
My Work/C/Parallel implementation Pizza 33284/obj/Debug/pizza.o
My Work/C/Parallel implementation Pizza 33284/Parallel implementation Pizza 33284.cbp

    
    
        
        
        
        
            
                
                
                
                
                
                    
                
            
            
                
                
                
                
                
                    
                
                
                    
                
            
        
        
            
            
            
        
        
            
        
        
            
            
            
        
    
My Work/C/Parallel implementation Pizza 33284/Parallel implementation Pizza 33284.depend
# depslib dependency file v1.0
1537340191 source:c:\programming\tfth\33284\my work\c\parallel implementation pizza 33284\pizza.c
    
    
    
    
My Work/C/Parallel implementation Pizza 33284/Parallel implementation Pizza 33284.layout

    
    
        
    
My Work/C/Parallel implementation Pizza 33284/pizza.c
#include
#include
#include
#include
#define MAX_
PIZZA 10
#define MAX_ORDERS 10
struct pizza
{
char size[10];
char toppings[4][20];
int num_toppings;
    float cost;
};
typedef struct pizza pizza;
struct order
{
pizza pizzas[MAX_PIZZA];
int num_pizzas;
char name[50];
char phone_number[20];
char address[100];
int to_be_delivered;
float cost;
};
typedef struct order order;
void print_summary(order o);
void process_order(order o[], int num_orders);
float add_pizza(pizza *arg_p);
int isempty(const char *s);
int main()
{
order o[MAX_ORDERS];
int i, num_orders=0, choice=-1;
while(1)
{
printf("Options\n1. Order pizza\n2. View all orders\n3. Exit\nEnter your choice : ");
scanf("%d",&choice);
while ((getchar()) != '\n');
switch(choice)
{
case 1:
if(num_orders==MAX_ORDERS)
{
printf("\nMaximum orders received.\n");
}
else
{
process_order(o,num_orders);
num_orders++;
}
break;
case 2:
if(num_orders==0)
{
printf(("\nNo orders received yet.\n"));
}
else
{
for(i=0;i {
print_summary(o[i]);
}
}
break;
case 3:
exit(0);
default:
printf("Invalid choice, try again.\n\n");
}
}
}
void process_order(order o[], int num_orders)
{
int choice=-1;
char c='a';
    do
    {
        printf("Enter your name : ");
        scanf("%[^\n]49s", o[num_orders].name);
        while ((getchar()) != '\n');
    }while(isempty(o[num_orders].name));
    do
    {
        printf("Enter your phone number : ");
        scanf("%[^\n]19s",o[num_orders].phone_number);
        while ((getchar()) != '\n');
    }while(isempty(o[num_orders].phone_number));
    while(!(c=='c'||c=='C'||c=='d'||c=='D'))
    {
        printf("Will the pizza be [c]ollected or [d]elivered: ");
        scanf("%c",&c);
        while ((getchar()) != '\n');
    }
    o[num_orders].to_be_delivered=0;
    if(c=='d'||c=='D')
    {
        do
        {
            printf("Enter your address : ");
            scanf("%[^\n]99s",o[num_orders].address);
            while ((getchar()) != '\n');
        }while(isempty(o[num_orders].address));
        o[num_orders].to_be_delivered=1;
    }
    o[num_orders].num_pizzas=0;
    do
    {
        printf("\nOptions\n1. Add pizza\n2. Checkout\nEnter your choice : ");
        scanf("%d",&choice);
        while ((getchar()) != '\n');
        switch(choice)
        {
        case 1:
            if(o[num_orders].num_pizzas >= MAX_PIZZA)
            {
                printf("\nMaximum pizzas ordered\n");
            }
            else
            {
                o[num_orders].cost += add_pizza(&(o[num_orders].pizzas[o[num_orders].num_pizzas]));
                o[num_orders].num_pizzas++;
                printf("Total current order cost : $%.2f\n\n",o[num_orders].cost);
            }
            break;
        case 2:
            if(o[num_orders].num_pizzas==0)
            {
                printf("\nOrder at least 1 pizza before checking out.\n");
                choice=-1;
            }
            break;
        default:
            printf("Invalid choice. try again\n\n");
        }
    }while(choice!=2);
printf("\nCost of order : $%.2f\n",o[num_orders].cost);
    if(o[num_orders].to_be_delivered && o[num_orders].cost<30)
    {
     printf("Cost of Delivery : $%.2f\n",8.0);
     printf("Total cost of Order : $%.2f\n\n",o[num_orders].cost+8.0);
    }
    else
{
     printf("Cost of Delivery : $%.2f\n",0.0);
     printf("Total cost of Order : $%.2f\n\n",o[num_orders].cost);
}
}
float add_pizza(pizza *arg_p)
{
char toppings[][20] = {"Bacon", "Olives", "Ham", "Mushrooms", "Pineapple", "Salami", "Anchovies"};
char pizza_sizes[][10]={"small", "medium", "large"};
float pizza_size_cost[]={5,8,12};
float cost_of_pizza = 0;
int choice=-1,i;
pizza p;
p.num_toppings = 0;
while(1)
{
printf("\nEnter pizza size\n1. Small\n2. Medium\n3. Large\nEnter your choice : ");
scanf("%d",&choice);
while ((getchar()) != '\n');
if(choice>=1 && choice<=3)
{
strcpy(p.size,pizza_sizes[choice-1]);
cost_of_pizza += pizza_size_cost[choice-1];
break;
}
else
{
printf("Invalid choice. try again\n\n");
}
}
choice=-1;
while(p.num_toppings<4)
{
printf("Add topping\n");
for(i=0;i<7;i++)
{
printf("%d. %s\n",i+1,toppings[i]);
}
printf("8. Close topping selection\nEnter your choice : ");
scanf("%d",&choice);
while ((getchar()) != '\n');
if(choice>=1 && choice<=7)
{
strcpy(p.toppings[p.num_toppings],toppings[choice-1]);
printf("\n%s added to pizza.\n\n",toppings[choice-1]);
p.num_toppings++;
}
else if(choice==8)
{
break;
}
else
{
printf("Invalid choice. try again\n\n");
}
}
if(p.num_toppings==4)
{
printf("\nMaximum toppings selected");
}
cost_of_pizza+=p.num_toppings;
    p.cost = cost_of_pizza;
*arg_p=p;
printf("Cost of pizza : $%.2f\n",cost_of_pizza);
return cost_of_pizza;
}
void print_summary(order o)
{
int i,j;
printf("----------------------------------------------------------------\n");
printf("Customer Name: %s\n",o.name);
printf("Customer Phone Number: %s\n",o.phone_number);
if(o.to_be_delivered)
{
printf("Customer Address: %s\n",o.address);
}
for(i=0;i {
printf("\nPizza %d:\n",i+1);
printf("Size: %s\n",o.pizzas[i].size);
if(o.pizzas[i].num_toppings>0)
{
printf("Toppings:\n");
for(j=0;j {
printf("%d: %s\n",j+1,o.pizzas[i].toppings[j]);
}
}
        printf("Cost: $%.2f\n",o.pizzas[i].cost);
}
printf("\nCost of order : $%.2f\n",o.cost);
if(o.to_be_delivered && o.cost<30)
    {
     printf("Cost of Delivery : $%.2f\n",8.0);
     printf("Total cost of Order : $%.2f\n",o.cost+8.0);
    }
    else
{
     printf("Cost of Delivery : $%.2f\n",0.0);
     printf("Total cost of Order : $%.2f\n",o.cost);
}
printf("----------------------------------------------------------------\n");
}
int isempty(const char *s)
{
while(*s)
{
if(!isspace(*s))
return 0;
s++;
}
return 1;
}
My Work/Java/Parallel Implementaion Pizza 33284/.classpath

    
    
    
My Work/Java/Parallel Implementaion Pizza 33284/.project

     Parallel Implementaion Pizza 33284
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
My Work/Java/Parallel Implementaion Pizza 33284/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
My Work/Java/Parallel Implementaion Pizza 33284/bin/Order.class
public synchronized class Order {
private java.util.ArrayList pizzas;
private String customerName;
private String customerPhone;
private String customerAddress;
private boolean isOrderToBeDelivered;
private float cost;
public void Order();
public void SetName(String);
public void SetPhoneNumber(String);
public void SetAddress(String);
public boolean isOrderToBeDelivered();
public int getNumPizzaOrdered();
public float getCost();
public void addToCost(float);
public void setOrderToBeDelivered(boolean);
public void AddPizza(Pizza);
public void PrintDetails();
}
My Work/Java/Parallel Implementaion Pizza 33284/bin/Pizza.class
public synchronized class Pizza {
private String size;
private java.util.ArrayList toppings;
private float cost;
public void Pizza();
public void SetSize(String);
public void AddTopping(String);
public int GetNumToppings();
public void PrintDetails();
public void SetCost(float);
public float GetCost();
}
My Work/Java/Parallel Implementaion Pizza 33284/bin/PizzaShop.class
public synchronized class PizzaShop {
private java.util.ArrayList orders;
private java.util.Scanner scanner;
public void PizzaShop();
Order ProcessOrder();
Pizza AddPizza();
public static void main(String[]);
}
My Work/Java/Parallel Implementaion Pizza 33284/src/Order.java
My Work/Java/Parallel Implementaion Pizza...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here