Develop an additional system for storing and retrieving park


Assignment Task: Working with Files and Strings

After your successful development of the parking rate calculator, SPA has decided to further employ you to develop an additional system for storing and retrieving parked car details. This system has two main programs and a module that contains the common functions used in the two programs.

Program A:

The first program will allow the operator to enter the details for each car parked during the day, and save these details into a file named 'cars-parked-w.txt'. The entered details are the car plate number, the car entrance time in hours:minutes and the car exit time in hours:minutes. The program must use a loop that allows the operator to enter another car details. The program should also check the input for validity according to the following rules:

  • Car plate number must be an alpha numeric string of exactly six digits (e.g. ABC123).
  • Car entrance and exit times must be in the format hours:minutes and can take values from 00:00 to 23:59.
  • The exit time must be greater than the entrance time.

The file should record each car information on a single line so that the output file has the following appearance:

ABC123,13:30,16:20

WX89YZ,04:05,11:17

A typical example of the display of your program should be similar to the following:

-------------------------------------------------

Superstar Parking Australia (SPA) Car information

-------------------------------------------------

Car plate number : ABC 123

Enterance time : 13:30

Exit time : 16:20

Do you want to enter another car? (y/n): y

Car plate number : WX 89 YZ

Enterance time : 04:05

Exit time : 11:17

Do you want to enter another car? (y/n): n

Goodbye.

-------------------------------------------------

In case of an invalid input, the display should be similar to the following:

...

Car plate number : ABC-123

Invalid input! Car plate number must be an alpha numeric string.

Car plate number : ABC 123

...

Program B:

The second program will open a file 'cars-parked-r.txt' for reading and read each record, splitting it into its component fields and checking each field for validity. The rules for validity are similar to those of Program A, with the additional rule that each record must contain exactly three fields separated by commas. Your program should print out each valid record it reads. Your program should terminate when it reads an invalid record, printing out on which line number the error occurred, and what the error was.

A typical example of the display of your program should be similar to the following:

-------------------------------------------------

Superstar Parking Australia (SPA) Car Information

-------------------------------------------------

Car (1) Details

-------------------------------------------------

Car plate number : ABC123

Enterance time : 13:30

Exit time : 16:20

Car (2) Details

-------------------------------------------------

Car plate number : WX89YZ

Enterance time : 04:05

Exit time : 11:17

-------------------------------------------------

End of Car Information

-------------------------------------------------

In case there is a record with an invalid data, for example:

ABC123,13:30,16:20

WX89YZ,04:05,44:17

The output should be similar to the following:

-------------------------------------------------

Superstar Parking Australia (SPA) Car Information

-------------------------------------------------

Car (1) Details

-------------------------------------------------

Car plate number : ABC123

Enterance time : 13:30

Exit time : 16:20

-------------------------------------------------

Invalid record at line (2)!

Time can only take values from 00:00 to 23:59.

-------------------------------------------------

Common Module

The common module should contain common functions that are used in both Program A and Program B, such as error validation functions. This module should be imported in each of Program A and Program B.

You need to develop your programs by completing the following tasks:

Task 1: Draw a flowchart that presents the steps of the algorithm required to perform the task specified.

Task 2: For each program, select at least three sets of test data that will demonstrate the normal operation of your program; that is, test data that will demonstrate what happens when a valid input is entered. Select two sets of test data that will demonstrate the abnormal operation of your program.

Set it out in a tabular form as follows: test data type, test data, the reason it was selected, the output expected due to using the test data, and finally a screenshot of the output actually observed when the test data is used. It is important that the output listings (i.e., screenshots) are not edited in any way.

Task 3: Implement your programs in Python. Comment on your code as necessary to explain it clearly. Run your programs using the test data you have selected and complete the last column of test data tables above.

RATIONALE:

This assessment task will assess the following learning outcome/s:

- be able to identify, isolate and correct errors in all phases of the programming process.

- be able to apply sound program analysis, design, coding, debugging, testing and documentation techniques to simple programming problems.

- be able to write code in an appropriate coding language.

- be able to examine, recognize and be aware of alternate programming approaches to include a broad discussion of procedural and object oriented approaches.

This assessment task is designed to reinforce topic material related to simple functions, files, exceptions and lists.

Attachment:- Programming Principles.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Develop an additional system for storing and retrieving park
Reference No:- TGS03035333

Expected delivery within 24 Hours