Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage1of10ITECH5403 - Assignment 2 – Parallel ImplementationsDue Date: 5pm,...

1 answer below »
ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage1of10ITECH5403 - Assignment 2 – Parallel ImplementationsDue Date: 5pm, Friday of Week 11 (Sem 1807)This assignment will test your skills in identifying comparative features of different programming languages through implementing a programming application. This task worth 20% marks of this course and belongs to the non-invigilated (type A) assessment task.Assignment OverviewYou are tasked with creating a text-based program for library admins to store data on a Library System. However, as this is a comparative languages course, you will be creating the same application in the following three programming languages:• Java,• Python, and• Lisp or Perl (you may choose either of these).As you implement the application in each language you should keep notes on:- The features of the languages used,- Which features you found useful, and- Any issues or complications which arose due to the complexity or lack of any language features.A brief discussion document based on these programming features for each individual language accompanying each implementation is required. Finally, a comparative overview of the languages highlighting how they were suitable or not suitable for the creating this type of application is also required.It is recommended that the first version of the application you write is in the programming language which is most familiar to you. This will help you to have a working 'template' which you can then translate into the other programming languages.Program SpecificationWhen the program first launches, there is a menu which allows the users (library admins) to select one of the following options:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) QuitITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage2of10The functionalities of these options are as follows:1) When users add a new member they provide a member-name which are stored in some manner of array or list. Members are assigned a unique ID value where the first member added is assigned the ID value 1, the second member added is assigned the ID value 2 and so on.2) When users add a new book they provide a book-title, and the number of copies of that book. These information are stored in some manner of array or list. Books are also automatically assigned a unique ID values such as 1, 2, 3 etc. Additionally, information needs to be kept regarding books whether they are available or not.3) When users process a borrowing they provide a member-ID, and book-ID. The IDs must be registered on the system. That is, to successfully create a book borrowing:• The member ID must be of an existing member in the system• The book ID must be of a book that exists in the system, and• The book must be available to be borrowedAfter processing a borrowing, the information regarding the number of books should be updated. If no more copy of that book is available then the book is not available for borrowing.4) When users process a returning, they provide a member-ID, and book-ID. The book should be taken off from that member’s record, and the number of available book information should be updated.5) If the users opt to view member status then they are prompted to enter the member ID - and then any books borrowed by that member are displayed including:- The member’s name, and the title of books they are currently keeping.6) If the users opt to view book status then they are prompted to enter a book ID - and then the following information are displayed:- number of available copy of the book, if it is zero then a message that the book is not available and- the list of members’ name who borrowed it.7) When a user chooses to Quit, the program terminates with a goodbye message.Where required, your program should check for valid data entry and loop until valid data is entered.Each implementation of your project (in each of the three languages you choose) should aim to closely match the setup and structure of the program as shown in the example output on the following pages.Add codes to pre-create a few members, books and borrowings on each run of your code to avoid the need to type in those details over and over when testing your program. However your program should not depend only on those hard-coded items. Instead it should be capable of taking new items as inputs and give proper outputs according to those new inputs. These will be checked by the assessor at the time of marking your assignment.ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage3of10Example Program OutputStartup and add new member example output--------------------------------- XXXXXXXXXXWelcome to ITECH5403 Library System -------------------------------- XXXXXXXXXXMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) Quit1Adding a new member:Please enter a new member name:AminaMember [Amina] has been created with member ID: [1]Would you like to [a]dd a new member or go-[b]ack to the previous menu?aPlease enter a new member name:JohnMember [John] has been created with member ID: [2]Would you like to [a]dd a new member or go-[b]ack to the previous menu?aPlease enter a new member name:AlexMember [Alex] has been created with member ID: [3]Would you like to [a]dd a new member or go-[b]ack to the previous menu?bAdd new book example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) Quit2Adding new book:Please enter a new book title:ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage4of10Romeo et JulietteBook already exists:Book ID: 1Book Title: Romeo et JulietteNumber of copies: 1Please enter a new book title:Sense and sensibilityPlease enter number of copies:3New book added:Book ID: 2Book Title: Sense and sensibilityNumber of copies: 3Would you like to [a]dd a new book or go-[b]ack to the previous menu?aPlease enter a new book title:PrometheusPlease enter number of copies:2New book added:Book ID: 3Book Title: PrometheusNumber of copies: 2Would you like to [a]dd a new book or go-[b]ack to the previous menu?bProcess borrowing example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) Quit3Please enter a valid member ID:99Member does not exist.Please enter a valid member ID:1Please enter a valid book ID for borrowing by member [Amina]:66Book does not exist.Please enter a valid book ID for borrowing by member [Amina]:3*** Borrowing processed successfully***Member: AminaBorrowed Book title: PrometheusNumber of books remaining: 1ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage5of10Would you like to [p]rocess a new borrowing or go-[b]ack to the previous menu?pPlease enter a valid member ID:2Please enter a valid book ID for borrowing by member [John]:3*** Borrowing processed successfully***Member: JohnBorrowed Book title: PrometheusNumber of books remaining: 0Would you like to [p]rocess a new borrowing or go-[b]ack to the previous menu?pPlease enter a valid member ID:3Please enter a valid book ID for borrowing by member [Alex]:3Sorry!!! Book titled [Prometheus] currently is not available for borrowing.Would you like to [p]rocess a new borrowing or go-[b]ack to the previous menu?pPlease enter a valid member ID:3Please enter a valid book ID for borrowing by member [Alex]:2*** Borrowing processed successfully***Member: AlexBorrowed Book title: Sense and sensibilityNumber of books remaining: 2Would you like to [p]rocess a new borrowing or go-[b]ack to the previous menu?pPlease enter a valid member ID:3Please enter a valid book ID for borrowing by member [Alex]:1*** Borrowing processed successfully***Member: AlexBorrowed Book title: Romeo et JulietteNumber of books remaining: 0Would you like to [P]rocess a new borrowing or go-[b]ack to the previous menu?bProcess returning example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) QuitITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage6of104Please enter a valid member ID:999Member does not exist.Please enter a valid member ID:1Please enter a valid book ID returned by [Amina]:66Book does not exist.Please enter a valid book ID returned by [Amina]:3*** Returning processed successfully***Member: AminaBook returned: PrometheusAfter returning Number of books [Prometheus] available in stock: 1Would you like to [p]rocess a new returning or go-[b]ack to the previous menu?pPlease enter a valid member ID:3Please enter a valid book ID returned by [John]:2*** Returning processed successfully***Member: JohnBook returned: PrometheusAfter returning Number of books [Prometheus] available in stock: 2Would you like to [p]rocess a new returning or go-[b]ack to the previous menu?bView member status example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) Quit5Please enter a valid member ID:99Member does not exist.Please enter a valid member ID:2Member [2] : JohnBorrowed Books: NoneWould you like to view a new member’s [s]tatus or go-[b]ack to the previous menu?sITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage7of10Please enter a valid member ID:3Member [3] : AlexBorrowed Books: Sense and Sensibility, Romeo et JulietteWould you like to view a new member’s [s]tatus or go-[b]ack to the previous menu?bView book status example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member status6) View book status7) Quit6Please enter a valid book ID:99Book does not exist.Please enter a valid book ID:3Book [3]: PrometheusAvailable number of copies: 2List of Members borrowing: NoneWould you like to view a new book [s]tatus or go-[b]ack to the previous menu?sPlease enter a valid book ID:2Book [2] : Sense and SensibilityAvailable number of copies: 2List of Members borrowing: AlexWould you like to view a new book [s]tatus or go-[b]ack to the previous menu?bQuit example outputMain Menu - please select an option:1) Add new member2) Add new book3) Process borrowing4) Process returning5) View member statusITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage8of106) View book status7) Quit7Thanks for using ITECH5403 Library System!Suggested Development EnvironmentsEclipse for JavaEclipse 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.htmlEnsure 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.PyCharm or IDLE for PythonPython, including the IDLE development environment can be downloaded freely from: https://www.python.org/downloads/PyCharm Community Edition can be downloaded freely from: https://www.jetbrains.com/pycharm/GNU CLisp for Common LispCLISP 2.49 can be obtained from: http://sourceforge.net/projects/clisp/files/latest/downloadAny good text editor would be suitable for writing the source code.Stawberry Perl for PerlStrawberry Perl can be obtained from: http://strawberryperl.com/Any good text editor would be suitable for writing the source code.ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103DPage9of10Additional Documentation – Language Suitability ReportEvery programming language is designed to be used for different types of tasks, and has features which allow it to be a good choice for those tasks, while perhaps not as good at different types of tasks.During your implementation of the program in each of the languages chosen 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 ProcessYou must supply your program source code files and language suitability report documentation in as single compressed archive called:__ ITECH5403_Assignment_2.zipYou may supply your programming language suitability report in either Word or PDF format.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 11 at 5pm.The mark distribution for this assignment is explained on the next page.ITECH5403–Comparative Programming LanguagesSchool of Science, Engineering and Information TechnologyCRICOS Provider No. 00103D10of10Assignment 2 – Parallel ImplementationsStudent ID: Student Name:RequirementWeightMarkImplementation 1: Java- Functionality- Adherence to the specification- Robustness / input handling10Implementation 2: Python- Functionality- Adherence to the specification- Robustness / input handling10Implementation 3: Perl or Lisp- Functionality- Adherence to the specification- Robustness / input handling10Documentation and discussion of the comparative ease of implementation (design / implement / debug) in each programming language, including how robustness issues were addressed.10Spelling and grammar5Assignment mark total45Contribution to unit mark (out of 20%)20Comments:
Answered Same Day May 21, 2020 ITECH5403

Solution

Snehil answered on May 28 2020
150 Votes
Java/Book.java
Java/Book.java
import java.util.A
ayList;
import java.util.List;
public class Book
{
    private static int count=0;
    private String title;
    private int id;
    private int amount;
    private List members;
    
    public Book(String title, int amount)
    {
        this.title = title;
        this.amount = amount;
        id = ++count;
        members = new A
ayList
();
        System.out.println("New book added");
        System.out.println("Book ID: ["+id+"]");
        System.out.println("Book Title: "+title);
        System.out.println("Number of copies: "+amount);
    }
    
    public String getTitle()
    {
        return title;
    }
    public void setTitle(String title)
    {
        this.title = title;
    }
    public int getId()
    {
        return id;
    }
    public void setId(int id)
    {
        this.id = id;
    }
    
    public int getAmount()
    {
        return amount;
    }
    public void setAmount(int amount)
    {
        this.amount = amount;
    }
    public boolean isAvailable()
    {
        return amount!=0;
    }
    public void bo
owBook(Member member)
    {       
        members.add(member);
        amount--;
        member.bo
owBook(this);
    }
    
    public void returnBook(Member member)
    {
        members.remove(member);
        amount++;
        member.returnBook(this);
    }
    
    public void viewStatus()
    {
        System.out.println("Book ["+id+"] : "+title);
        System.out.println("Available number of copies: "+amount);
        if(members.size()>0)
        {
            System.out.print("List of Members bo
owing: ");
            for (int i=0;i            {
                System.out.print(members.get(i).getName()+", ");
            }
            System.out.print(members.get(members.size()-1).getName());
        }
        else
        {
            System.out.println("List of Members bo
owing: None");
        }
        System.out.println();
    }
}
Java/Li
ary.java
Java/Li
ary.java
import java.util.A
ayList;
import java.util.List;
import java.util.Scanner;
public class Li
ary
{
    private Scanner scanner;
    private List members;
    private List books;
    
    public Li
ary()
    {
         scanner = new Scanner(System.in);
         members = new A
ayList
();
         books = new A
ayList
();
    }
    public static void main(String[] args)
    {
        Li
ary obj = new Li
ary();
        int choice;
        do
        {
            System.out.println("Main Menu - please select an option:");
            System.out.println("1) Add new member");
            System.out.println("2) Add new book");
            System.out.println("3) Process bo
owing");
            System.out.println("4) Process returning");
            System.out.println("5) View member status");
            System.out.println("6) View book status");
            System.out.println("7) Quit");
            choice = obj.scanner.nextInt();
            obj.scanner.nextLine();
            
            switch(choice)
            {
            case 1:
                obj.AddMember();
                
eak;
            case 2:
                obj.AddBook();
                
eak;
            case 3:
                obj.Bo
owBook();
                
eak;
            case 4:
                obj.ReturnBook();
                
eak;
            case 5:
                obj.ViewMemberStatus();
                
eak;
            case 6:
                obj.ViewBookStatus();
                
eak;
            case 7:
                System.out.println("Thanks for using ITECH5403 Li
ary System!");
                
eak;
            default:
                System.out.println("Invalid Selection\n");                  
            }
        }while(choice!=7);
        obj.scanner.close();
    }
    
    void AddMember()
    {
        String input;
        System.out.println("Adding a new member:");
        boolean memberExists = true;
        while(memberExists==true)
        {
            System.out.println("Please enter a new member name:");
            input = scanner.nextLine();
            memberExists = false;
            for(Member member:members)
            {
                if(input.equals(member.getName()))
                {
                    memberExists = true;
                    System.out.println("Member already exists:");
                    System.out.println("Member ID: "+ member.getId());
                    System.out.println("Member Name: "+ member.getName());
                    
eak;
                }
            }
            if(memberExists==false)
            {
                members.add(new Member(input));
            }
            System.out.println();
        }
        while(true)
        {
            System.out.println("Would you like to [a]dd a new member or go-[b]ack to the previous menu?");
            input = scanner.nextLine();
            if(input.equals("a"))
            {
                AddMember();
                return;
            }
            else if(input.equals("b"))
            {
                
eak;
            }
            else
            {
                System.out.println("Invalid input.");
            }
        }
        System.out.println();
    }
    
    void AddBook()
    {
        String input;
        System.out.println("Adding new book:");
        boolean bookExists = true;
        while(bookExists==true)
        {
            System.out.println("Please enter a new book title:");
            input = scanner.nextLine();
            bookExists = false;
            for(Book book:books)
            {
                if(input.equals(book.getTitle()))
                {
                    bookExists = true;
                    System.out.println("Book already exists:");
                    System.out.println("Book ID: "+ book.getId());
                    System.out.println("Book Title: "+ book.getTitle());
                    System.out.println("Number of copies: "+ book.getAmount());
                    
eak;
                }
            }
            if(bookExists==false)
            {
                int amount;
                while(true)
                {
                    System.out.println("Please enter number of copies:");
                    amount = scanner.nextInt();
                    scanner.nextLine();
                    if(amount<=0)
                    {
                        System.out.println("Invalid value. Enter positive value.");
                    }
                    else
                    {
                        
eak;
                    }
                }
                books.add(new Book(input,amount));
            }
            System.out.println();
        }
        while(true)
        {
            System.out.println("Would you like to [a]dd a new book or go-[b]ack to the previous menu?");
            input = scanner.nextLine();
            if(input.equals("a"))
            {
                AddBook();
                return;
            }
            else if(input.equals("b"))
            {
                
eak;
            }
            else
            {
                System.out.println("Invalid input.");
            }
        }
        System.out.println();
    }
    
    void Bo
owBook()
    {
        if(members.size()==0)
        {
            System.out.println("Please add some members first.\n");
            return;
        }
        if(books.size()==0)
        {
            System.out.println(("Please add some books first.\n"));
            return;
        }
        
        int memberId, bookId;
        Member member;
        Book book;
        while(true)
        {
            System.out.println("Please enter a valid member ID:");
            memberId = scanner.nextInt();
            scanner.nextLine();
            member = memberExists(memberId);
            if(member != null)
            {
                
eak;
            }
            else
            {
                System.out.println("Member does not exist.");
            }
        }
        while(true)
        {
            System.out.println("Please enter a valid book ID for bo
owing by member ["+member.getName()+"]:");
            bookId = scanner.nextInt();
            scanner.nextLine();
            book = bookExists(bookId); 
            if(book != null)
            {
                
eak;
            }
            else
            {
                System.out.println("Book does not exist.");
            }       
        }
        
        if(book.isAvailable())
        {
            book.bo
owBook(member);
            System.out.println("*** Bo
owing processed successfully***");
            System.out.println("\tMember: "+member.getName());
            System.out.println("\tBo
owed Book title: "+book.getTitle());
            System.out.println("\tNumber of books remaining: "+book.getAmount());   
        }
        else
        {
            System.out.println("So
y!!! Book titled ["+book.getTitle()+"] cu
ently is not available for bo
owing.");
        }
        
        String input;
        while(true)
        {
            System.out.println("\nWould you like to [p]rocess a new bo
owing or go-[b]ack to the previous menu?");
            input = scanner.nextLine();
            if(input.equals("p"))
            {
                Bo
owBook();
                return;
            }
            else if(input.equals("b"))
            {
                
eak;
            }
            else
            {
                System.out.println("Invalid input.");
            }
        }
        System.out.println();
    }
    void ReturnBook()
    {
        if(members.size()==0)
        {
            System.out.println("Please add some members first.\n");
            return;
        }
        if(books.size()==0)
        {
            System.out.println(("Please add some books first.\n"));
            return;
        }
        int memberId, bookId;
        Member member;
        Book book;
        while(true)
        {
            System.out.println("Please enter a valid member ID:");
            memberId = scanner.nextInt();
            scanner.nextLine();
            member = memberExists(memberId);
            if(member != null)
            {
                
eak;
            }
            else
            {
                System.out.println("Member does not exist.");
            }
        }
        while(true)
        {
            System.out.println("Please enter a valid book ID returned by member ["+member.getName()+"]:");
            bookId = scanner.nextInt();
            scanner.nextLine();
            book = bookExists(bookId); 
            if(book != null)
            {
                
eak;
            }
            else
            {
                System.out.println("Book does not exist.");
            }
        }
        if(member.hasBook(book))
        {
            book.returnBook(member);
            System.out.println("*** Returning processed successfully***");
            System.out.println("\tMember: "+member.getName());
            System.out.println("\tBook returned: "+book.getTitle());
            System.out.println("\tAfter returning Number of books ["+book.getTitle()+"] available in stock: "+book.getAmount());    
        }
        else
        {
            System.out.println("Member ["+member.getName()+"] does not have book titled ["+book.getTitle()+"].");
        }
        
        String input;
        while(true)
        {
            System.out.println("\nWould you like to [p]rocess a new returning or go-[b]ack to the previous menu?");
            input = scanner.nextLine();
   ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here