basic programming task
DESCRIPTION
C++ based programming task for in depth check of knowledge.TRANSCRIPT
Programming Fundamentals
Lab Assignment 1
Session: Fall 2014
Faculty of Information Technology
UCP Lahore Pakistan
Submission Deadline: 8 Nov 2014
My name is TurboByte (nick actually). My real name is difficult to pronounce so leave it. Here is my
Display Pic (Hmm not photogenic so leave it too). Born and raised somewhere in Pakistan.
And after many years I became the most expensive developer of my company. What happened in between
well we’ll talk someday later.
Here is my work station Cool nah...
We will have more fun on the way. Let check the emails for today’s tasks. By the way my boss is too
grumpy :P
Ok this informal email is from the CSA (Chief Software Architect) about task.
It reads:
This software is confidential and required by one of military Station. It’s not the actual thing we
are developing, it’s just a mockup of which type of things we will do in this project on full scale. Please
check the attached files for complete info. These are informal files typed by me so try not to be surprised
if you are unable to find your favorite jargons. And also the info is purely fictional but based on the actual
requirements.
Regards
Hmm ok let check what’s in the files.
Requirements as per Major Daud:
1) The software must be able encrypt/decrypt messages.
2) Every message should be decrypt and info to be stored in the system.
3) Saved info could be viewed by authorized persons only.
4) We need different levels of authorizations.
5) Our Current list of entities is as follows:
a) Ammunition Store:
4 types of ammunition numbered from 0-3.
10 boxes of each type numbered from 0-9.
Each box contained max 500 rounds.
b) Airplanes:
a. 5 Squadrons numbered from 0-4.
b. 10 airplanes in each squadron.
c) Soldiers:
a. 10 Sections.
b. 50 soldiers in each Section.
d) Check posts:
a. 20 check posts.
b. 15 soldiers on each check posts.
6) Messages are of the following format:
a. “Send Ammo Type:0 Quantity:350” means We need to send ammunition
from type 0 and Quantity is 350. Now system should tell us from which boxes
should we pick the bullets. For example in box 0 we have only 50 bullets left.
So the expected message should be like “50 from box 0, 300 from box 1”. And
also it should minus the quantity from the respective boxes.
b. “Recv Ammo Type:3 Quantity:500” means we received ammunition of type 3
and quantity is 500. Now add this to boxes but make sure that no box can
handle more than 500. For example in box 0 the quantity is 500, in box 1 its
400, in box 2 its 300 and in box 3 its 200. System should add 100 in box 1, 200
in box 2 and 200 in box 3. And display message and tell us that ammunition
was added to which box.
c. “Takeoff Squadron:2 Hawk:4” means Airplane no 4 from Squadron no 2 took
off. Now system should update the status of plane which 0 if on ground, 1 if
its in air. In this case the status should be 1.
d. “Landed Squadron:3 Hawk:7” means Airplane no 7 from Squadron number 3
just landed. Update its status to 0.
e. “Dispatch Count:10 CP:14” means dispatch 10 soldiers to Check Post
number(CP) 14. Now System should determine that from which section 10
soldiers are available. Remember all soldiers which are to be dispatched
should be from one section. Update the count in sections from which the
soldiers were dispatched and also update the count in the Check post where
they were sent.
f. “Arrive Count:15 CP:9” means 15 soldiers arrived from Check post number
9. Now update the count in Check post number 9 and add these soldiers to
the section where 9 slots are available. Remember each section can have 50
soldiers max. if no slot of 9 is available then display the alert message that
please inspect the soldiers.
g. As we have 500 soldiers (10 sections with 50 soldiers each). So our Tally of
Soldiers in all Check Posts and Sections should sum up to 500.
7) We should be able to view the following info:
a. Status of Ammunition: A table where we could see the quantity of
Ammunition in each box.
b. Airplane Status: A table where we could see which plane is in air and which is
on ground.
c. Status of Check Post: Show the number of soldiers in each check posts.
d. Status of Sections: Show the number of soldiers in each Sections.
e. Search Low ammunition: System should ask the type of ammo and the
quantity now it should search and display all the boxes from the give type
which are less than the given quantity. E.g type: 2 quantity: 100. Now output
all boxes from type 2 which are having quantity less than 100.
8) We have three types of users 1) Dispatcher: He can only encrypt the message and
view the encrypted one. 2) Receiver: He can only get the Decrypted message and
enter that in the system. 3) Admin: He can view all the above reports.
Hmm Ok that was lot of info to digest let’s have a cup of tea.
Ok now next file is from CSA lets peek in to that.
Technical Briefing by CSA:
I am sure you might be having a rough idea by that what they require from us.
For encryption/decryption we will use Caesar cipher . For info on that please read this link
http://en.wikipedia.org/wiki/Caesar_cipher .
So the flow of program should be like:
Firstly Program should ask the username and password. Usernames are given above i.e. Dispatcher,
receiver and admin. Upon login users should see only those options for which they are authorized like the
dispatcher should only be able to enter the message and see the encrypted string. Receiver could only
enter the encrypted message and see the results (refer to point 6 in Major Daud’s file). Admin Should be
able to view all the require reports (refer to point 7 in Major Daud’s File).
The actual system would be on different Computers communicating through secure network. For now to
simulate the program do this:
a) Login from the Dispatcher account Enter the message and note down the encrypted string.
b) Login from the Reciver account and add the encrypted message into the system.
c) Login from the Admin account to see the reports.
Make sure of 3 things:
a) Program should not be terminate when we logout from any account. It should ask to login
again to the same or other account. There should be an option to terminate the program
other than that option program should not be termiated or close.
b) All info should come from the message. Program should decrypte the Message and then
it should update the info accordingly. No manual entry of any info.
c) When The program starts it should put the status of Airplane 0, All checkpost empty, all
sections full and Ammunition to full.
Login by using the username and password
Dispatcher: Enter the message
Reciever: Enter the Encrypted
Message
Admin: View the reports
Finally over with is brief. Hmm wait there is another email from Senior White Box tester.
It reads :
Please make sure that your code is according to the following guidelines:
http://geosoft.no/development/cppstyle.html
Code Should be properly Indented and well Commented.
Regards
Now we are over with this brief and honestly that was bit hard to digest all this. Let have a
hot pizza :
Ok now we are refreshed Lets start Coding…
Note: Post all your queries to the study group at https://www.facebook.com/groups/pff14/
keep in touch with group to see what others students are asking. Join or Create discussions
on any topic related to CS.