Home / Questions / Draw a flowchart that presents the steps of the algorithm required to perform the task spe...
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:
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.
Program A
Data type | Test data | Reason it was selected | Expected output | Screenshot of actual output |
---|---|---|---|---|
Normal | ||||
Normal | ||||
Normal | ||||
Abnormal | ||||
Abnormal |
Program B
Data type | Test data | Reason it was selected | Expected output | Screenshot of actual output |
---|---|---|---|---|
Normal | ||||
Normal | ||||
Normal | ||||
Abnormal | ||||
Abnormal |
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
Apr 02 2020 View more View Less
Highland Mining and Minerals Co. is considering the purchase of two gold mines. Only one investment will be made. The Australian gold mine will cost $1,671,000 and will p...
Apr 03 2020A dice is rolled and a card is picked from a deck of 52. What is the probability that a 5 is rolled and a king is drawn?
Apr 23 2020Tech Enterprises is considering a new project that will require $325,000 for fixed assets, $160,000 for inventory, and $35,000 for accounts receivable. Shortterm debt is...
May 22 2018(a) Find the Thévenin equivalent circuit that the load RL sees in Figure 4–15. >(b) Then if RP = r = RL = 10 kΩ, RS = 1kΩ, and vS = 1 V, find the power delivered to the l...
Jul 28 2020International trade organizations promote free trade by encouraging countries to A. Maintain their tariffs. B. Establish their trade quotas. C. Limit their protectionism ...
May 05 2021Which of the following scales of measurement assigns names and divides the data into discrete categories?a. nominalb. ordinalc. intervald. ratio
Aug 18 2021Table Completion Financial and Operational Risk This is the first step in developing a risk assessment and management policy. In developing your policy, consideration of...
Nov 26 2019Who said there is would always be adequate amount of expenditure on goods so that there is full employment Not yet answered 1 Marked out of 2 Select one: O a. Adam smith ...
Apr 28 2021A $1 per unit tax levied on consumers of a good is equivalent toa. a $1 per unit tax levied on producers of the good.b. a $1 per unit subsidy paid to producers of the goo...
Jul 03 2021Which of the following compounds is an aldehyde? A. CH3CH2CH2COOH B. CH3CH2CHO C. CH3CH2CH2OH D. CH3CH2COCH312. Which of the following compounds is an alcohol? A....
Dec 10 2019