Python console application assessment

Assignment Help Python Programming
Reference no: EM133539200

Programming Fundamentals

Assessment - Python Console Programs

Objectives
This assessment item relates to the unit learning outcomes as in the Unit Profile.

Details
For this task, you'll be enhancing the capabilities of your Python Console Application, "Places to Visit," which you created in Assignment 1 Part A. This extension will involve showcasing your comprehension of list algorithms used for sorting and searching, along with skills in string formatting and file handling. It's important that your program generates accurate outcomes as required.

What you need to submit for this assignment.

The Python source codes:
You are advised to work on the assignment following incremental approach by making incremental progress on a weekly basis. Specifically for this assignment, your submission should consist of just the following two files. (Further details provided below.)

places_visit.py and place.py.

To get you started the source code for implementing the required functionalities is present in the files "places_vist.py" and "place.py". After you've finished developing all the programs and are prepared to submit, compile all source files into a singular zip file for submission. Please exclude your report from this zip file. Remember to submit in the zip format, not as a rar file. Accuracy in naming the files is
crucial.

o Ass2.zip
Similar to Part A, please include a report with your submission. This report should encompass the approximate duration taken to develop the programs, any challenges faced during the process, and
screenshots showcasing the generated output. (Utilize Alt-PrtScrn to exclusively capture the console window or dialog boxes; subsequently, paste them into your Word document.) Additionally, create a
comprehensive test plan that accounts for every potential scenario within the program. Ensure your test screenshots are annotated accordingly.

Assignment specification
You have already developed the "Places to Visit" application in Assignment 1 Part A. You can find the entire source code in the files "places_visit.py" and "place.py" both of which are available on the Moodle unit website within the Assessment Block.

The specification of Place class is as follows:

Class Name: Place

• Attributes:
o place_name (string), place_address (string), num_days (integer), total_cost (float)
• Methods:
o Constructor init (self, place_name, place_address, num_days, total_cost): Initializes a Place object attributes with the arguments passed to the
constructor (the init () method).
o String Representation str (self):
• Returns a human-readable string representation of the Place object.
• Format: "place_name at place_address, num_days days,
$total_cost".
o Equality Comparison eq (self, other): Compares the attributes of two Place objects for equality.
• Parameters: other parameter is a "Place" object
• Returns True if the objects have the same place_name values, otherwise
False.
o Less Than Comparison lt (self, other): Compares two Place objects based on their place_name attribute.
• Parameters: other parameter is a "Place" object
• Returns True if the calling object's attribute place_name is alphabetically less than other object's attribute place_name, otherwise False.
o Greater Than Comparison gt (self, other): Compares two Place objects based on their attribute place_name.
• Parameters: other is another Place object to compare.
• Returns True if the calling object's attribute place_name is alphabetically greater than other object's attribute place_name, otherwise False.
Add the following functionalities to the application:

Sort Places:
Write a function called sort_places() that takes a list of Place objects as input and sorts the list in ascending order of their names. The function should use the selection sort algorithm, that you learnt in week 7.

Add a new place:
Whenever a new place is added, the application must automatically arrange the places in alphabetical order by their names.

For instance, consider a list with the following data:

and if the user enters the following place:

The application should sort the list, and the output should be as follows:

Print places:
Upon selecting the "Print Places" option by the user, the list should be printed in a tabular format as depicted below:

You must update the print_places() function so that it prints the places list in tabular format. This concept was covered during the week 7 tutorial exercise in question 3, as demonstrated in the display_students(lst) function.
Delete a place:
When a user chooses to remove a place from the list, instead of requesting the user to provide the index for deletion, the user can now input the name of the place. The application will then search for the specified place within the list and proceed to delete it if located. If the place is not found in the list, a message will be displayed to inform the user about the absence of the specified place. The search operation must be performed without considering the character case. For instance, if a user searches for "New York," the search should also match "new york" or "NEW YORK" in a case-insensitive
manner. In this situation, the lower() and upper() methods of the string class would prove to be valuable.

You are required to employ the most optimal method for searching the list for the designated place. Keep in mind that the places list is organized in alphabetical order. Utilize this insight to select the suitable searching algorithm for implementation.

Below is the sample output:

Notice the user has entered the place name "taj mahal" all-in lower-case characters. If the user now prints the list of places the following table is displayed:

The search function overlooked the distinction in character case. The user entered "taj mahal" and the name of the place in the list was "Taj Mahal," the search function successfully identified and removed the place named "Taj Mahal."

If the place with the name entered by the user is not in the list the following message is printed:

Data persistence:
The application should have the ability to retain the inventory of planned travel destinations. For this purpose, each object is converted into a string representation, which is then saved on an individual line within the "planned_places.txt" file. The structure of each string adheres to the subsequent format:

Name| Address| Days| Cost Name| Address| Days| Cost Name| Address| Days| Cost Here's what each component represents:
• Name: The value of the place_name attribute of the place object (e.g., "Christ the Redeemer").
• Address: The value of place_address attribute of the place object (e.g., "Cristo Redentor, Rio de Janeiro, Brazil").
• Days: The number of days value of the num_days attribute of the place object (e.g., "2" indicating 2 days).
• Cost: The value of total_cost attribute of the place object (e.g., "300" indicating total cost is $300).

These components are separated by the vertical bar (or a pipe chacracter) (|) delimiter to maintain a consistent format for storing and later retrieving Place object information from the file. This character must not appear in the values of any of the instance attributes.

Create the write_file(lst, file_name) and read_file(lst, file_name) functions.
The lst parameter represents the list of place objects, and file_name is a string denoting the
filename to save the list of places. The write_file() function should save the list of place objects to the file_name file, while the read_file() function should retrieve the place objects from the same file. A similar implementation of these functions was done during the week 8 tutorial exercise, specifically question 3, involving a list of book objects. Modifications can be applied to adapt that implementation to cater to the requirements of this functionality.

Exception Handling:
The application should strive for consistent and reliable functionality. To achieve this, you must address the handling of the following two exceptions:

• ValueError
• FileNotFoundError
ValueError exception: This exception is triggered when a function receives an argument with the accurate data type but an incorrect value. In the context of the application, this exception can arise when the user provides values for the number of days and cost per day (while entering details for a new place). If the user inputs an incorrect value, this exception might be raised. To ensure smooth operation, you must address this exception by allowing the user to re-enter the value until a valid input is provided.

Attachment:- Programming Fundamentals.rar

Reference no: EM133539200

Questions Cloud

Complete the procurement process from a specified scenario : HI5001 Accounting for Business Decision - Complete the procurement process from a specified scenario and produces several screenshots to verify the completion
Climate control products is located in new york : Climate control products is located in New York they filed a motion to dismiss for lack of subject matter jurisdiction how should the court rule
Describe how experience might contribute to your involvement : Describe how the experience might contribute to your involvement (current or future) in helping individuals that may be at risk of substance use disorder.
What bird has the heart to sing in a thicket of thorns : Discuss the relaBonship between the Magistrate and the barbarian girl in terms of differences in power, language, culture, and experience.
Python console application assessment : Python Console Application Assessment - implementing the required functionalities is present in the files "places_vist.py" and "place.py".
Describe the stem professions : The body of your essay should: briefly describe the STEM professions. discuss some opportunities and challenges that are present in the STEAM professions.
Evaluate role of hris and role of metrics in practice of hr : Evaluate the role of HRIS and the role of metrics in the practice of HR. Analyze how the use of an employee survey supports HR in this organizational scenario.
What are some of the ghosts saul is talking about : Describe what Saul sees at the end of chapter. Why do you think this particular vision appears to Saul?
Make payment of instalment on time : Discuss the legal position if Murti fails to make payment of an instalment on time.

Reviews

len3539200

10/5/2023 2:37:32 AM

Need to do assignment 1 Part B (part a is already done, solution is attached if required) A detailed specification can be found under the “assessments” tile on the unit website You are to submit the following: A zipped project folder with your program. Your completed Report.docx. A template for the report is provided on the unit website. This report is to include your name, student ID number, unit name, unit code, the phase completed, a test plan, and test results. More details about the test plan can be found in the detailed specification (and in the “Test Plans” documents in resources under the “unit introduction” tile).

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd