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 modularized body mass index program

Write a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player. The formula to calculate the BMI is as follows.

  Implementation of a simple traffic capturing application

Implementation of a simple traffic capturing application. The application is a web-based system that consists of two parts. The web server written in python

  Implement a function that takes a filename as input

FIT1008 - Implement a function that takes a filename as input and reads it into an instance of the class you implemented on Task 2. For each line in the file

  Plot the bar chart of a dataset

MA1008 Introduction to Computation Thinking - Compose the chart from basic graphic elements like points, lines and texts using functions in Turtle

  Write two versions of a factorial function

You need to write a few functions in Python. Write two versions of a factorial function.

  Explain what python ides are being used in the industry

Explain what Python IDEs are being used in the industry? Compare/contrast features (chart might be helpful). Research differences between JES, IDLE and PyCharm.

  Adopt a service oriented architecture

adopt a Service Oriented Architecture (SOA) for its future IT infrastructure. Queensland Health executives were impressed with your Template based, Reference

  Write program that lets the user enter a non-negative

Write program that lets the user enter a non-negative integers than uses a look to calculate the factorial of that integer. Display the factorial.

  Project- add time and object interaction to the simulation

Project: Add Time and Object Interaction to the Simulation. Bring the simulation to life with simulated time and object interaction. Illustrates the alternative flow of control for errors provided by try/catch in place of returned error codes

  Write a program to sort the tuples by ascending order

You are required to write a program to sort the (name, age, height) tuples by ascending order where name is string, age and height are numbers.

  Create a function that takes an argument

Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.

  Permutation ciphers

Permutation Ciphers (a.k.a. Transposition Ciphers) are another class of simple cryptosystems. For this we use the functions apply(.,.) and inv(.) from Homework 4; copy these two functions into your le as auxiliary functions.

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