Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

FIT9136 Algorithms and Programming Foundations in Python

Assignment 2

1. Key Information

Purpose

This assignment will develop your skills in designing, constructing, testing, and documenting a Python program according to specific programming standards. This assessment is related to the following learning outcome (LO):

LO2 - Restructure a computational program into manageable units of modules and classes using the object-oriented methodology

LO3 - Demonstrate Input/Output strategies in a Python application and apply appropriate testing and exception handling techniques

Your task

This assignment is an individual task where you will work independently. Your

task is to develop a simple car purchase advisor system using Python code, based on the provided specifications.

Value

45% of your total marks for the unit.

Due Date

Friday, 22 September 2023, 4:30 PM (AEST)

Submission

Via Moodle Assignment Submission.

FIT GitLab check-ins will be used to assess the history of development

JPlag will be used for similarity checking of all submissions.

Assessment Criteria

This assessment includes a compulsory interview with your tutor following the submission date. At the interview you will be asked to explain your

code/design/testing, modify your code, and discuss your design decisions and alternatives. Marks will not be awarded for any section of

code/design/functionality that you cannot explain satisfactorily. Failure to attend the interview will result in your assessment not being marked. You will be

provided with the timing of the interviews at a later date.

The following aspects will be assessed:

1.    Program functionality in accordance to the requirements

2.    Code Architecture and Adherence to Python coding standards 3. The comprehensiveness of documented code

Late

Penalties

10% deduction per calendar day or part thereof for up to one week

Submissions more than 7 calendar days after the due date will receive a mark of zero (0) and no assessment feedback will be provided.

Support

Resources

See Moodle Assessment page and Section 8 in this document

Feedback

Feedback will be provided on student work via

general cohort performance

specific student feedback ten working days post submission

2. Instruction

For this assignment, your goal is to create a Car Purchase Advisor System that utilises files "stock.txt"  and “order.txt”  located  in  the  "data" folder. The application will feature a text interface to act as the advisor system for a car retailer. The functionalities include:

Functionality 1:

When  the  program  starts,  test  data  needs  to  be  automatically  generated.  The generated test data needs to be reflected in the “stock.txt” file and also loaded in the program  memory.  For  the  format  of  the  test  data,  you  can  refer  to  the  provided example “stock.txt”.  Please  ensure  that  the test  data  presents a certain degree of randomness.

Functionality 2:

After generating the test  data,  a  menu  should  be  presented to the  user  with the following options:

a)   Look for the nearest car retailer

b)   Get car purchase advice

c)   Place a car order

d)   Exit

Functionality 3:

If  the  user  selects  the  option  for  checking  the  nearest  car  retailer,  the  program should  ask  for  the   user ’s  postcode  to  identify  the   nearest  car  retailer  (here  we assume that suburbs with smaller differences in postcodes are geographically closer, for more information please refer to section 2.3.6).

Functionality 4:

If the user selects the option for getting car purchase advice, the program needs to:

a)   First  list  all  the available car  retailers and  prompt the users to select one to continue the advising process;

b)   Then show a sub-menu with the following options:

i)       Recommend a car

ii)       Get all cars in stock

iii)       Get  cars  in stock  by car types  (the car types is a list of strings, e.g., [“AWD”, “RWD”])

iv)       Get probationary licence permitted cars in stock

c)   The option i) should randomly select one car from the current stock of the car retailer, the options ii) to iv) should show the current stock of a car retailer. You need to first print the retailer ID and the retailer name, and also ensure that the printed stocked cars are well-formatted.

Functionality 5:

If the user selects the option for placing a car order, the program should ask for the retailer  ID  and  the  car   ID  from  the  user  separated  by  a  space.  However,  before placing the order, the program needs to check whether the current time is within the business  hours  of  the target  retailer.  If  not, an order should  not  be created and a message should be prompted to the user. For any other invalid cases, you need to handle them  properly.  Otherwise,  in  valid  cases,  an  order  should  be  created  and stored in “order.txt” and the order details should be printed to the user.

Please  note  that  the program will continue to run until  the  user  chooses  to  exit  the application.

To develop this application, you will need to create four classes, each defined in a separate Python file (i.e. *.py), and one main Python file to execute the program. All the required files can be found in the RENAME_ME.zip file, which is located in the Assessments section on Moodle. It is important to note that the addition of supplementary classes exceeding the prescribed four may incur a penalty in the form of mark deduction.

2.1. Car Class

Contains all the operations related to a car.

Required Class

Variables

N/A (You can add if you need)

Required Methods

2.1.1. __init__()

Constructs a car object.

Arguments

car_code (must be unique and in the format of two uppercase letters plus 6 digits, e.g.,

MB123456)

car_name

car_capacity (Each car has a maximum seating capacity)

car_horsepower (in kilowatts)

car_weight (in kilograms) - the car_weight is the tare weight of the vehicle (the weight of an empty standard vehicle with all of its fluids and

specifically 10 litres of fuel in the tank)

car_type (values should be one of “FWD”, “RWD” or “AWD”)

Returns

N/A

*All arguments of the constructor must have a default value.

2.1.2. __str__()

Return the unit information as a formatted string.

Arguments

N/A

Returns

a string in the following format:

"car_code, car_name, car_capacity,

car_horsepower, car_type"


2.1.3. probationary_licence_prohibited_vehicle()

Return whether the vehicle is a prohibited vehicle for probationary licence drivers

Arguments

N/A

Returns

A boolean value of True or False

Note:

A car with a Power to Mass ratio greater than 130 kilowatt per tonne is a prohibited vehicle for probationary licence drivers

The formula to calculate the Power to Mass ratio is:

weight(Round)of(up)og(ow)r(a)