当前位置:天才代写 > C++/C代写,c语言代写代考-100%安全,包过 > 面向对象编程代写 tkinter框架代写 图书馆管理系统代写

面向对象编程代写 tkinter框架代写 图书馆管理系统代写

2021-05-24 17:50 星期一 所属: C++/C代写,c语言代写代考-100%安全,包过 浏览:912

面向对象编程代写

ICT162

面向对象编程代写 This End-of-Course Assessment paper contains THREE (3) questions and comprisesFIFTEEN (15) pages (including the cover page).

End-of-Course Assessment – January Semester 2019

Object Oriented Programming

INSTRUCTIONS TO STUDENTS:

  1. This End-of-Course Assessment paper contains THREE (3) questions andcomprises FIFTEEN (15) pages (including the cover page).
  1. You are to include the following particulars in your submission: Course Code, Title of the ECA, SUSS PI No., Your Name, and Submission Date.
  2. Late submission will be subjected to the marks deduction scheme. Please refer to the Student Handbook for details.

ECA Submission Guidelines 面向对象编程代写

Please follow the submission instructions stated below:

This ECA carries 70% of the course marks and is a compulsory component. It is to be done individually and not collaboratively with other students.

Submission

You are to submit the ECA assignment in exactly the same manner as your tutor-marked assignments (TMA), i.e. using Canvas. Submission in any other manner like hardcopy or any other means will not be accepted.面向对象编程代写

Electronic transmission is not immediate. It is possible that the network traffic may be particularly heavy on the cut-off date and connections to the system cannot be guaranteed. Hence, you are advised to submit your assignment the day before the cut-off date in order to make sure that the submission is accepted and in good time.

Once you have submitted your ECA assignment, the status is displayed on the computer screen. You will only receive a successful assignment submission message if you had applied for the e-mail notification option.

ECA Marks Deduction Scheme

Please note the following:

a)Submission Cut-off Time – The cut-off time for ECA submission will be at 2355 hrs on the day of the deadline. All submission timings will be based on the time recorded by

b)Start Time for Deduction – Students are given a grace period of 12hours. Hence calculation of late submissions of ECAs will begin at 12:00 noon the following day (this applies even if it is a holiday or weekend) after the

c)How the Scheme Works – From 12:00 noon the following day after the deadline, 10 marks will be deductedfor each 24-hour  Submissions that are subject to more than 50 marks deduction will be assigned zero mark. For examples on how the scheme works, please refer to Section 5.2 Para 1.7.3 of the Student Handbook.面向对象编程代写

Any extra files, missing appendices or corrections received after the cut-off date will also not be considered in the grading of your ECA assignment.

面向对象编程代写
面向对象编程代写

Plagiarism and Collusion

Plagiarism and collusion are forms of cheating and are not acceptable in any form of a student’s work, including this ECA assignment. You can avoid plagiarism by giving appropriate references when you use some other people’s ideas, words or pictures (including diagrams). Refer to the American Psychological Association (APA) Manual if you need reminding about quoting and referencing. You can avoid collusion by ensuring that your submission is based on your own individual effort.面向对象编程代写

The electronic submission of your ECA assignment will be screened through a plagiarism detecting software. For more information about plagiarism and cheating, you should refer to the Student Handbook. SUSS takes a tough stance against plagiarism and collusion. Serious cases will normally result in the student being referred to SUSS’s Student Disciplinary Group. For other cases, significant marking penalties or expulsion from the course will be imposed.

Note to Students:

Submit your solution document in the form of a single MS Word file. You are to include the following particulars in your submission: Course Code, Title of the ECA, SUSS PI No., Your Name, and Submission Date. Put this information in the first page of your solution document. Use the template word document provided – SUSS_PI-No_FullName_ECA.docx. Rename the file with your suss PI and full name join with “_ECA” e.g. “SUSS_PI- TomTanKinMeng_ECA.docx” (without the quotes). Do NOT submit as a pdf document.

You should make only one submission for ECA.面向对象编程代写

You are to copy and paste the source codes of each program you write into your solution document, provided in the template word document. If you submit the source codes as a screenshot, you will be penalized. Submit screenshots for only the output of your program, where applicable.

Answer all questions. (Total 100 marks)

Question 1 面向对象编程代写

A library wishes to allow members to search for library items based on title, keywords and authors, and to make enquiry on fines for items should they be returned late.

Write the following classes that construct the necessary class hierarchy and associations for the library application:

(a)Itemclass

This class is an abstract superclass.

  • Thereare five object attributes: isbn, title, price, authors and year of  Write a constructor for the class. The constructor has five parameters. Make every word in the title start with an uppercase letter. You should choose an appropriate collection type for author(s).
  • There is one class attribute: an administrative charge of$30.
  • Write the accessor and mutator methods for this class
  • Write the accessor and mutator methods for the object attribute
  • Writeonly accessor methods for all other object  The accessor method for the object attribute authors should return a string containing the authors, separated by commas (,).面向对象编程代写
  • Write TWO (2) abstract methods: getLateCharges and

lossSurchargeRate.

getLateCharges method has one parameter: number of days.

lossSurchargeRate method does not have parameter.

  • Write the method lossPenalty which returns the sum of 3 values: the item price, the loss surcharge (or loss surcharge rate × item price) and the administrative
  • Write the method matchKeyWords which has a parameter: a list of keywords. The method returns true if the title contains all the
  • Writethe method isWrittenBy which has a parameter: an  The method returns true if the author is the author or one of the authors.
  • Write a string method that returns a representation of the item as a
Two examples are shown below:

ISBN: 9781234567890 Title: Python For Beginners Price: $29.99 Authors: Tom Smart, Alice Alanis

Year Published: 2019 面向对象编程代写

ISBN: 9781234567891 Title: Fun With Python Price: $10.00 Author: Tom Smart

Year Published: 2018

Use the header Author if there is only one author, and Authors if otherwise.

(11 marks)

(b)Book

The Book class is a subclass of the Item class.

  • There are six object attributes: isbn, title, price, authors, year of publication and edition. Write a constructor for the class. The constructor has six
  • Thereis one class attribute: loss surcharge rate which is 2 (that is, 20%). Write the getter and setter method for the class attribute.面向对象编程代写
  • Implement the abstract method getLateCharges defined in the superclass. The method returns the late charges in dollars. The fine per day is 20 cents for the first 7 days, 50 cents per day for the next 7 days (day 8 to day 14), and $1 per day for subsequent days (day 15 onwards). The fines should not exceed the loss
  • Write the method lossSurchargeRate which returns the value of class attribute for loss surcharge
  • Write a string method to return a string representation of the

Two examples are shown below:

ISBN: 9781234567890 Title: Python For Beginners Price: $29.99 Authors: Tom Smart, Alice Alanis

Year Published: 2019 Edition: 2

ISBN: 9781234567891 Title: Fun With Python Price: $10.00 Author: Tom Smart

Year Published: 2018 Edition: 1

(7 marks)

(c)Libraryclass 面向对象编程代写

The Library class has a collection of items such as books.

  • There is one object attribute: the collection of

Write a constructor for the class. The constructor does not have any parameter.

  • Write the method searchItem which has a parameter: the isbn of an item (a uniquenumber). The method returns the item if there is an item with the matching isbn. Otherwise, the method returns
  • Write the method addItem which has a parameter: an item. The method adds the item to the collection if there is currently no item in the collection with the same isbn. The method returns true if the add is successful and false
  • Write the method removeItem which has a parameter: an isbn of an item.The method removes the item from the collection if there is an item in the collection with the isbn. The method returns true if the remove is successful and false otherwise.
  • Write a class method showResult. This method has one parameter: a collection of items. The method returns a string representation of the items, including the item position starting from 面向对象编程代写
An example is shown below:

Item 1:

ISBN: 9781234567890 Title: Python For Beginners Price: $29.99 Authors: Tom Smart, Alice Alanis

Year Published: 2019 Edition: 2

Item 2:

ISBN: 9781234567891 Title: Fun With Python Price: $10.00 Author: Tom Smart

Year Published: 2018 Edition: 1

  • Write the methods itemsByAuthor, itemsWithTitle, itemsWithKeywordsand listItems.

The method itemsByAuthor has a parameter: an author. It locates the items that are written by the author, and returns a string representation of these items. The method itemsWithTitle has a parameter: a title. It locates items with the title, and returns a string representation of these items.

The method itemsWithKeywords has a parameter: a list of keywords. It locates items whose title contains all the keywords, and returns a string representation of these items.面向对象编程代写

The method listItems does not have any parameter. It returns a string representation of all the items in the library.

The methods itemsByAuthor, itemsWithTitle, itemsWithKeywords

and listItems must call the method showResult.

(9 marks)

(d)Write a main function to test your classes. The main function should do thefollowing:

#create a Library object

#create 2 Book objects with these details add them to the library

# First Book ISBN: 9781234567890 Title: Python For Beginners Price: $29.99 # Authors: Tom Smart, Alice Alanis Year Published: 2019 Edition: 2

# Second Book ISBN: 9781234567891 Title: Fun With Python Price: $10.00 # Author: Tom Smart Year Published: 2018 Edition: 1

#display the list of items 面向对象编程代写

#search and display items with title Fun with python #search and display items with author Tom Smart #search and display items with keywords fun and python #search and display items with keyword python

# remove the item with isbn 9781234567890

# display the late charges when the book with isbn 9781234567891 is returned # 1, 8, 19 and 100 days late

(4 marks)

(e)Useexamples from your solutions to parts a) to d) to explain and illustrate how to apply the concepts of THREE (3) SOLID

(9 marks)

NOTE TO STUDENTS: Copy and paste the Python code for classes Item, Book and Library and the function main IN THIS ORDER. Write your answer to Q1(e) in the word document. Copy and paste the screenshot showing the output from running the function main.

Question 2 面向对象编程代写

The cost of a travel pass includes a $5 administrative charge and the cost of one unit of trips (or 10 trips) at $1.50 per trip. A passenger who has a travel pass can perform these operations:

  • make trips as long as there is at least one unconsumedtrip,
  • top up in multiples of units of trips without incurring administrativecharge
  • get a refund at $1.20 per unconsumed

When a refund is made, the travel pass is surrendered. Thus, the passenger must repurchase a travel pass if he subsequently wishes to make a trip.

The following describe the structure of the classes. To demonstrate how classes can be used to organize information, write the following classes and an application that provides a menu to ONE (1) passenger.面向对象编程代写

(a)InsufficientAmountException, InputErrorand TravelException, classes.

InsufficientAmountException and InputError are subclasses of

TravelException. These classes do not require any additional attributes or methods.

An exception from the InsufficientAmountException class is raised whenever the amount tendered to buy or to top up a travel pass is insufficient.

An exception from InputError class is raised whenever the user enters an invalid value when prompted for a menu option or when prompted for an amount for buying or for topping up a travel pass.面向对象编程代写

An exception from TravelException class is raised whenever these requests cannot be carried out: purchase travel pass, top up, get refund and make a trip.

(1 mark)

(b)TravelPassclass

The class attributes of this class are cost of a trip ($1.50), the number of trips (10) sold as a unit, the refund amount per unconsumed trip ($1.20), and the administration charge ($5). You can introduce any other necessary class attribute(s) where necessary.

Write the class methods:

  • getNumberOfTripsPerUnit that returns the number of trips in oneunit
  • getCostPerUnitthat returns the cost of one unit of trips.
  • costOfTravelPass that returns sum of the cost of a unit and the administration
  • getRefundPerTripthat returns the refund amount per unconsumed trip

You must call the class methods for the values in the class attributes as the values in the class attributes may change. Do not hardcode their values in your processing or output statements.面向对象编程代写

There are two object attributes:

travel pass id and the number of unconsumed trips. Write Python code to complete the class definition for TravelPass.

  • constructor with a parameter: an amount in dollars. The constructor raises an InsufficientAmountException exception with the message Minimum amount to buy a pass is $20.00if the amount is less than the cost of a travel pass. The travel pass id is auto-generated. The id of first travel pass is id 1, the second is 2, and so
  • getter method for the number of unconsumed 面向对象编程代写
  • method makeTrip that raises an TravelException exception with the message Travel pass has 0 trips left if there is no unconsumed trip left. Otherwise, the method decrements the number of unconsumed trip(s) by
  • method topup with a parameter: the amount to top up. The method raises an InsufficientAmountException exception with the message Minamount to top up is $15.00 if the amount is less than the cost of a unit of trips. If the amount is sufficient, the method computes the number of units possible, and increases the number of unconsumed trips by the number of trips in the units. The method returns a string containing the travel pass details before and after the top up, as well as the amount of change. For example, if the amount is 22 and the travel pass has 10 unconsumed trips, the method returns the following string:
Before top up:

Travel Pass: 0000001 Number of trips left: 10 After 1 unit top up: Travel Pass: 0000001 Number of trips left: 20 Change = $7.00

  • method getRefund that raises an TravelException exception with the message There is no trip refund if there is no unconsumed trip left. Otherwise,the method computes the refund amount of all unconsumed trips and sets the number of unconsumed trips to zero. It returns the refund amount.
  • method str that returns a string representation of the travel pass.  An  example is shownhere:

Travel Pass: 0000001 Number of trips left: 20

(14 marks)

(c)Passengerclass

The object attributes of this class are: passenger id and a travel pass. Write Python code for the class definition for Passenger:

  • constructor with two parameters: passenger id and a travel pass with default value None. A passenger may be created with or without a travel
  • getter method for the travel pass using the property
  • method hasTravelPass that returns True if the passenger has a travel pass and False otherwise.面向对象编程代写
  • method getTravelPass with a parameter amount. The method raises an TravelException exception with the message Please use existingxx trips in current pass or get a refund first if there are xx unconsumed trips left in the passenger has a travel pass with unconsumed trips. Otherwise, it creates a travel pass for him with
  • method topup with a parameter amount.

The method raises an TravelException exception with the message No travel pass!Please get a travel pass if the passenger does not have a travel pass. Otherwise, the travel pass is topped up with the amount and the result of the top up operation is returned. The method does not handle

  • methodrefund that raises an TravelException exception with the message No travel pass! Please get a travel pass if the passenger does not have a travel  Otherwise, the method gets the refund amount of the travel pass, sets the travel pass of the passenger to None, and returns the refund amount. The method does not handle exception.

 

  • method makeTrip that raises an TravelException exception with the messageNo travel pass! Please get a travel pass if the passenger does not have a travel pass. Otherwise, the travel pass is used to make trip. The method does not handle

 

  • method str that returns a string representation of the  passenger and  his travel pass. An example is shownhere:

Passenger Id: T1234X Travel Pass: 0000001 Number of trips left: 10

(12 marks)

(d)Write the following functions with relevant parameter(s), if necessary for the application:

  • function getMenuOption that displays a menu and prompts the passenger for a choice. If the passenger enters non-numeric value non-whole numbers, the function raises an InputError exception with the message Error in choice. Please enter a whole number 0 to 4. The function returns the passenger’s choice as a wholenumber.面向对象编程代写

 

  • functiongetAmount that prompts the passenger for an  If the passenger enters a non-numeric value or a number not greater than 0, it raises an InputError exception with the message Error in amount. Please enter a positive decimal number. The function returns the amount as a decimal number.

 

  • function getTravelPass that raises a a TravelException exception with the message Please use existing xx trips in current pass or get a refund first if there is xx unconsumed trip left in the passenger’s travel pass. Otherwise, the function prompts the passenger for an amount. If the passenger has a travel pass with no unconsumed trips, the function prompts the passenger whether he wishes to top up instead. If so, it invokes a top up for the passenger. Otherwise, the function gets a travel pass for the passenger and displays the amount of change.面向对象编程代写

 

  • function topup that raises a TravelException exception with the message No travel pass! Please get a travel pass if the passenger does not have a travel pass. Otherwise, the function prompts the passenger for an amount and invokes a top up for the

 

  • functionmain that creates a passenger with id T1234X but without a travel  The function displays a menu repeatedly for the passenger to choose an operation until he chooses to exit.
For the following descriptions for function main,

note that xx in the output message refers to the whole number that the passenger has entered for a menu choice, and yy refers to the operation corresponding to the menu choice. For example, if xx is 1, then yy is Get Travel Card.

  • If the passenger enters an invalid option, that is, not between 0 and 4, print the message Invalid choice: xx If the choice is valid, the function calls the relevant functions to perform the selected operation, and handles these exceptions:

 

  • InputErrorby simply printing the exception message
  • InsufficientAmountException by appending a prefix Insufficientamount to yy  \nReason: to the exception message
  • TravelException by appending a prefix yy operationis unsuccessful.\nReason: to the exception message
  • Ifthe operation is successful, the function prints the passenger detail and the message yy operation is successful on separate lines.面向对象编程代写

(9 marks)

An example run (characters in green are user input):

面向对象编程代写
面向对象编程代写

面向对象编程代写
面向对象编程代写

NOTE TO STUDENTS: Copy and paste all required Python code for parts Q2(a), Q2(b), Q2(c) and Q2(d) to the word document. Copy and paste ONE (1) screenshot to show a test run of the functions and methods in your application.

Question 3 

Develop a GUI using tkinter framework to allow a user to enquire on the rental cost of a specific class of car according to the daily rates in Table Q3(a). For simplicity, ignore public holidays.

Class of Car Rate per day for Weekday (Mon to Fri) Rate per day for Weekend (Sat – Sun)
A 100 120
B 150 180
C 250 320

Table Q3(a)

(a)Figure Q3.1 shows the initial GUI. Implement the GUI.

面向对象编程代写
面向对象编程代写

Figure Q3.1

(6 marks)

(b)Addcode to part a) to implement event handling in your GUI to respond to user

(i)Figures Q3.2, Q3.3 and Q3.4 show the output after the button Enquire Cost is clicked.

Figure Q3.2 shows the output when the class of car is invalid (not A, B or C).

Figure Q3.2

Figure Q3.3 shows the output when the end date is earlier than the start date.

面向对象编程代写
面向对象编程代写

Figure Q3.3

Figure Q3.4 shows the cost breakdown of the rental when the data entered by the user is valid.

Figure Q3.4

Implement the necessary callback function(s) for the button Enquire Cost.

(11 marks)

(ii)When the button Clear Data is clicked, the GUI reverts to its initial state as shown in Figure Q3.1. Implement the necessary callback function(s) for the button Clear Data.

(3 marks)

(c)Makea copy of solutions to part a) and b). To the copy, introduce modifications to your GUI so that the user will be able to see the rates for the different classes of cars. Justify the widgets that you use.

(4 marks)

NOTE TO STUDENTS: Copy and paste the Python code for part Q3(a) and Q3(b) as ONE (1) program, and part Q3(c) as ANOTHER program. Copy and paste screenshot showing the output of one valid enquiry.

—– END OF ECA PAPER —–

面向对象编程代写
面向对象编程代写

其他代写:web代写 program代写 cs作业代写 app代写  Programming代写 homework代写 source code代写 考试助攻 Exercise代写 代写CS C++代写 java代写 r代写 finance代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式