Results 1 to 3 of 3
Name of script : parkingcharge.sh
Create a script that computes for the total parking charge of a customer. The following information are to be collected as inputs from the standard ...
- 01-07-2010 #1Just Joined!
- Join Date
- Jan 2010
- Posts
- 2
Unix script help :-(
Name of script : parkingcharge.sh
Create a script that computes for the total parking charge of a customer. The following information are to be collected as inputs from the standard input :
Plate number (format : 7 characters, the first 3 are characters from ato z followed by a dash followed by a 3 digit number; i.e. : XXX-123)
Time in (format : military time; i.e. 1500 => 3 PM)
Time out (format : military time; i.e. 1900 => 7 PM)
Type of vehicle : can either be the following characeters: L, U or H which stands for Light vehicle, Utility vehicle or heavy vehicle respectively.
The parking lot operates starting at 7 AM and closes at 11:30 PM. The rates of the parking lot is as follows:
Standard parking fee (minimum of 2 hours) – 50 pesos
Succeeding hour or less in excess of 2 hours for :
Light vehicles – 5 pesos
Utility vehicles – 15 pesos
Heavy vehicles – 25 pesos
Futhermore, the maximum parking charge for the following vehicles applies:
Light vehicles – 100 pesos
Utility vehicles – 150 pesos
Heavy vehicles – 250 pesos
The script should be able to validate whether the time in and time out values are VALID inputs based on the value that is entered (time out > time in). Other validations are not to be filtered by the script. The output of the script is the parking charge of the vehicle and its details.
Sample run:
$ parkingcharge.sh
Please enter the plate number (i.e. : AAE-775) : XNY-123
Please enter the type of vehicle (L/U/H) : U
Please enter the time the vehicle entered the parking lot : 0845
Please enter the time the vehicle entered the parking lot : 1915
The vehicle with plate number XNY-123 was parked for 10 hours and 30 minutes. The parking charge for the vehicle is 150 pesos
Try again? : N
Sample run:
$ parkingcharge.sh
Please enter the plate number (i.e. : AAE-775) : GMA-111
Please enter the type of vehicle (L/U/H) : L
Please enter the time the vehicle entered the parking lot : 1245
Please enter the time the vehicle entered the parking lot : 1315
The vehicle with plate number XNY-123 was parked for 0 hours and 30 minutes. The parking charge for the vehicle is 50 pesos
Try again? : N
Note: Make sure the program keeps on repeating until the user enters ‘N’ to quit the program.
Hint : You can use the following commands/control structure to complete your script : expr, if, test, for
- 01-07-2010 #2Just Joined!
- Join Date
- Jan 2010
- Posts
- 2
...
can some1 pls help me with this script... we are asked to do it, but i dont reli know how to.. would reli appreciate it...
- 01-07-2010 #3forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,093
Welcome to the forums!

Very sorry, but homework questions are not allowed on the forums:
http://www.linuxforums.org/forum/lin...ums-rules.html
Locking thread...oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.


