01-07-2010
Unix Scripting Question (Homework)
Hello im currently taking up Operating Systems and we're on unix ryt now. we have to make a script and here are the requirements.. can someone please help me. I would reli appreciate it.. because i dont reli know how to make scripts yet.
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am writing a script that will identify the oldest file in a directory. Here's the syntax:
#!/bin/ksh
cd directory
chmod 777 *
ls -r -1t > file1
sed -n -e "1P" < file1 > file2
So my problem is, now I have file2, which contains the name of the oldest file in the directory. How do I use,... (1 Reply)
Discussion started by: kristy
1 Replies
2. Shell Programming and Scripting
Hello
I am working on cleaning up permissions on Oracle mountpoints and datafiles in unix. I am looking for a script or a scripting idea to 1st.
1. grep for owner oracle
2. ensure its a directory owned for oracle
3. chmod 750 on the oracle owned directory.
4. grep for oracle files, etc... (3 Replies)
Discussion started by: jigarlakhani
3 Replies
3. Shell Programming and Scripting
Folks;
I'm writing a shell script to extract some fields out of a log file & it will run periodically, how can i make it runs starting from where it left of. for example;
if the script will do the extract every 2 days, let's say the first run will extract fields until July 25, 2007 @ 11:15:22... (1 Reply)
Discussion started by: moe2266
1 Replies
4. UNIX for Dummies Questions & Answers
folks;
I have a script to remove any files that older than 14 days then move any files that younger than 7 days to another directory. but for some reason it doesn't move the files, when i do it manually it works but not through the script. i tried 2 different ways in writing the move part but it... (6 Replies)
Discussion started by: Katkota
6 Replies
5. Programming
i just need guidance in this please.
people who will argue " homeworks are not allowed" , i just need help not solutions . thanks
CEG433/CEG633 - Operating Systems
please (1 Reply)
Discussion started by: evantheking
1 Replies
6. Homework & Coursework Questions
Hi :
I cant understand some subjects on DATABASE Class here i'm in small twon
i can't find someone to expalin it it to me
How can i get good site to find any tutoring throgh the chat or any way
i tried to find tutor in the irea but i failed . my question how to understand the... (1 Reply)
Discussion started by: Scotch
1 Replies
7. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Here is the problem:
Lesson 13 OBJ1: OST Class online.
Write a script called obj13-1.pl and a library... (2 Replies)
Discussion started by: valhalla
2 Replies
8. UNIX for Dummies Questions & Answers
Unix script coding help?
i am trying to write a code that will display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform... (0 Replies)
Discussion started by: renegade755
0 Replies
9. Shell Programming and Scripting
hi all,
I am writing a script and beginner in shell scripting. I have tried the below script. could you please check and let me know whether the below scirpt is correct.
Unix details : HP Unix
Input file.
cat input.txt | tail -4
HTS40002.W1978.PROM
HTS40003.W1978.PROM... (17 Replies)
Discussion started by: arun888
17 Replies
10. UNIX for Beginners Questions & Answers
Hi I just started scripting in my Unix class, but can't understand it and have trouble with homework. This is my homework:
Dean needs a daily written report of the status of his Unix computer. He wants to obtain certain information about users and processes that are only accessible by executing... (1 Reply)
Discussion started by: arbogastcarl
1 Replies
SUMO(1) User Commands SUMO(1)
NAME
SUMO - A microscopic road traffic simulation SUMO
SYNOPSIS
sumo [OPTION]*
DESCRIPTION
SUMO sumo Version 0.15.0
Copyright (C) 2001-2012 DLR and contributors; http://sumo.sourceforge.net
A microscopic road traffic simulation.
Configuration Options:
-c, --configuration-file FILE
Loads the named config on startup
--save-configuration FILE
Saves current configuration into FILE
--save-template FILE
Saves a configuration template (empty) into FILE
--save-schema FILE
Saves the configuration schema into FILE
--save-commented
Adds comments to saved template, configuration, or schema
Input Options:
-n, --net-file FILE
Load road network description from FILE
-r, --route-files FILE
Load routes descriptions from FILE(s)
-a, --additional-files FILE
Load further descriptions from FILE(s)
-w, --weight-files FILE
Load edge/lane weights for online rerouting from FILE
-x, --weight-attribute STR
Name of the xml attribute which gives the edge weight
Output Options:
--netstate-dump FILE
Save complete network states into FILE
--netstate-dump.empty-edges
Write also empty edges completely when dumping
--summary-output FILE
Save aggregated vehicle departure info into FILE
--tripinfo-output FILE
Save single vehicle trip info into FILE
--vehroute-output FILE
Save single vehicle route info into FILE
--vehroute-output.exit-times
Write the exit times for all edges
--vehroute-output.last-route
Write the last route only
--vehroute-output.sorted
Sorts the output by departure time
Time Options:
-b, --begin TIME
Defines the begin time; The simulation starts at this time
-e, --end TIME
Defines the end time; The simulation ends at this time
--step-length TIME
Defines the step duration
Processing Options:
-s, --route-steps TIME
Load routes for the next number of seconds ahead
--no-internal-links
Disable (junction) internal links
--ignore-accidents
Do not check whether accidents occure more deeply
--ignore-route-errors
Do not check whether routes are connected
--max-num-vehicles INT
Quit simulation if this number of vehicles is exceeded
--incremental-dua-step INT
Perform the simulation as a step in incremental DUA
--incremental-dua-base INT
Base value for incremental DUA
--scale FLOAT
Scale demand by the given factor (0..1)
--time-to-teleport TIME
Specify how long a vehicle may wait until being teleported, defaults to 300, non-positive values disable teleporting
--max-depart-delay TIME
How long vehicles wait for departure before being skipped, defaults to -1 which means vehicles are never skipped
--sloppy-insert
Whether insertion on an edge shall not be repeated in same step once failed.
--lanechange.allow-swap
Whether blocking vehicles trying to change lanes may be swapped.
Report Options:
-v, --verbose
Switches to verbose output
-p, --print-options
Prints option values before processing
-?, --help
Prints this screen
-V, --version
Prints the current version
-W, --no-warnings
Disables output of warnings
-l, --log FILE
Writes all messages to FILE (implies verbose)
--message-log FILE
Writes all non-error messages to FILE (implies verbose)
--error-log FILE
Writes all warnings and errors to FILE
--no-duration-log
Disable performance reports for individual simulation steps
--no-step-log
Disable console output of current simulation step
Routing Options:
--device.rerouting.probability FLOAT
The probability for a vehicle to have a routing device
--device.rerouting.explicit STR
Assign a device to named vehicles
--device.rerouting.deterministic
The devices are set deterministic using a fraction of 1000
--device.rerouting.period TIME
The period with which the vehicle shall be rerouted
--device.rerouting.pre-period TIME
The rerouting period before depart
--device.rerouting.adaptation-weight FLOAT
The weight of prior edge weights.
--device.rerouting.adaptation-interval TIME
The interval for updating the edge weights.
--device.rerouting.with-taz
Use zones (districts) as routing end points
Emissions Options:
--device.hbefa.probability FLOAT
The probability for a vehicle to have an emission logging device
--device.hbefa.explicit STR
Assign a device to named vehicles
--device.hbefa.deterministic
The devices are set deterministic using a fraction of 1000
TraCI Server Options:
--remote-port INT
Enables TraCI Server if set
Random Number Options:
--random
Initialises the random number generator with the current system time
--seed INT
Initialises the random number generator with the given value
GUI Only Options:
--gui-settings-file FILE
Load visualisation settings from FILE
-Q, --quit-on-end
Quits the GUI when the simulation stops
-G, --game
Start the GUI in gaming mode
-S, --start
Start the simulation after loading
-T, --disable-textures
Do not load background pictures
EXAMPLES
sumo -b 0 -e 1000 -n net.xml -r routes.xml
start a simulation from time 0 to 1000 with given net and routes
sumo -c munich_config.cfg
start with a configuration file
sumo --help
print help
REPORTING BUGS
Report bugs at <http://sourceforge.net/apps/trac/sumo/>.
Get in contact via <sumo-user@lists.sourceforge.net>.
Copyright (C) 2001-2012 DLR and contributors; http://sumo.sourceforge.net
SUMO sumo Version 0.15.0 is part of SUMO.
SUMO is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/gpl.html
SUMO sumo Version 0.15.0 May 2012 SUMO(1)