C++ code "Engineering journal"

Need help to make c++ code

Page 1 of 1

2 Replies - 2188 Views - Last Post: 02 May 2009 - 10:07 AM Rate Topic: -----

#1 tov1980  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-April 09

C++ code "Engineering journal"

Posted 02 May 2009 - 05:44 AM

Hi , can somebody help me to do the c++ code to this assignment "Engineering Journal" :

You are to write a program to manage an engineering journal. An engineering journal is a record of a person’s activities and thoughts while they work on a project. Entries are added to a journal but they can not be deleted. An employer can read a worker’s engineering journal and see how they are going.
The format of this journal will be simple. Each entry will have a one line title and a one paragraph text entry (an example text file is provided).

Encoding and Decoding
Entries in the journal are private, so the journal is encoded and protected using a pin.
When the program is executed it will ask for a 4¬digit pin. The pin is to be stored in the
program as an integer array. You are to use this pin to encode and decode the journal
entries (but NOT the titles – they are to remain in plain text).
When saving the file, each character in the journal paragraph is to have the integer value
of the next digit in the pin added to the character to encode. When decoding the file, the
next digit in the pin is subtracted from the character.
To encode the entry when saving to file:
The first digit will be added to the first character of the text.
The second digit will be added to the second character of the text.
The third digit will be added to the third character of the text.
The fourth digit will be added to the fourth character of the text.
… and so the cycle repeats.
The first digit will be added to the fifth character of the text.

E.g. if using the pin 1234, the entry abcdefgwould be encoded bdfhfhj
Program Features
The program is to provide the following facilities using a menu:
• Display a list of the titles in the journal.
• Display the contents of a selected entry (by number)
• Add an entry to the journal
• Quit

Error Handling
You are to handle the errors if a file fails to open for reading or writing (with appropriate
error messages). You should also display an error and re¬prompt the user if they do not
enter 4 characters for the pin, or if the pin contains a non¬numeric character.
Note that you do not need to keep the list of titles or journal entries in memory. You can read them from the file each time entries or titles are displayed. The journal file provided for this assignment is the required format you must use.
All files should be submitted by uploading them through LearnJCU. If you do your planning by hand, you should clearly label this paper and hand it in to your lecturer.
Planning (one document – Word doc or PDF):

• IPO charts for each function with the algorithm in either pseudocode or flowchart

If you are doing a flowchart, it may be hand¬drawn, but it must be neat. See your textbook examples for the desired format. This part of the assignment can be shown to your tutor during the practical in week 10, when they will make comments or suggestions. You can show them again in week 11 to confirm.
• A completed desk¬check table

This only needs to be done for one run through the program – using logical values. Name this file: LastnameFirstnameA2.doc or .docx or .pdf
Program (one code files):
Hand in a single .cpp file (no projects or other files). You may like to show your tutor your code during the practical in week 11 in order to get appropriate feedback. Name this file: LastnameFirstnameA2.cpp
Note that your code must work with the journal file provided, so do not upload a new journal text file.
Sample Output:
Note that the following runs of the program all use the same journal.txt file above.
Engineering Journal – Your Name
Enter your 4 digit pin number: 1234
Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): l

1. Program Design

2. Flow Charts

3. Encoding and Decoding

Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): d
Please enter item number: 1
Must read the program description thoroughly. I don't want to miss out on easy marks like I did in the previous assignment.
Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): a
Enter Title: File I/O
Enter new item: Must remember to close the file every time it is opened. I will also need error checking in case the file fails to open.
Save new item [y/n]: Y
Journal entry saved.
Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): l

1. Program Design

2. Flow Charts

3. Encoding and Decoding

4. File I/O Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): d Please enter item number: 4 Must remember to close the file every time it is opened. I will also need error

checking in case the file fails to open. Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): Q
Note that the pin “1234” was the right pin for decoding the entry thus the entry was displayed properly.
Another run… (same file)
Engineering Journal – Your Name Enter your 4 digit pin number: qwerty Invalid pin. Enter your 4 digit pin number: 43x1 Invalid pin. Enter your 4 digit pin number: 432 Invalid pin. Enter your 4 digit pin number: 4321 Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): i Invalid option. Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): l

1. Program Design

2. Flow Charts

3. Encoding and Decoding

4. File I/O Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): d Please enter item number: 4 Jttw↔qfpblcho▼ur↔bmrpd!wed!ifkf#bufuv▼uljd!lq▼jv↔nqhkde1↔H!zfkm#^ktr↔mfha

▼fuons#`gffhhoj↔ho#``th↔sih↔ejob▼gdfkt#qn!rmdo1 Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit): q

Note that although the pin format was valid and was accepted, it was the wrong pin for decoding these entries. Note also that there is no display or pause after quitting.

journal.txt ( Program Design

Nwvx!thee"wlf"svpiuen"giteumqvlso"wlptryhjo}/"L$eqq+u"zeov#xp"pmtu#svv#so"het{#qbtnw!nlof"L$ekg$jp#xig#tsgympwv$buvmhppiov1

Flow Charts

Xkop!phie"d$tgsescwi!hosx"flbtw$)qu$quhyeq#gpfh-!hrv!odmo"dre"iss"hedj#moflzjfxem"iyoewmpp1$Nclr!ylpm"qiff#xp"ei!ulqqnh$bpg$xkop!wvi!hxrdvlso"femnv$gqu$fcfl!hxrdvlsoco$cnrgl"zmujlr!vki!rushtdq!k1i/"omtv/$ekvtmc|$fpwvz"dre"dhe"hrut|2!Uksvng$hgw$qkq$bnvs!dh$b"viqcueug#jvpfxjqqC

Encoding and Decoding

J"wljpn$J"zmmn#mokwmbno}!yumug#xig#tsqjvbo#{jvksvv#ioerhjpj$bpg$egfsekqk/"Rrdg#xig#tsqjvbo#mt"zssmlrh"L$xkop!cgh!vkitg#et"iyoewmppv$mcwis"dre"femn#xigp$kwvx!dhjpth$fcfl!thee"dre"zvjvh2

File IO

Nwvx!thqfoeis"ws!eostg#xig#jjnh$fxhvz"wmng#mu"lw!qsiogg2!K#{jno$bnvs!phie"hvsqu$djhglkqk!kq$dcvi!vki!hlpf"iejnv$uq#sqgq2

IPO Chart

Icyi!lxwu"fsnroiugg$n{#MQQ#gicux!cqh!hosx"flbtw2!Ylpm"qsx"gitm#gigfo!vkin"ws!odof"vysg#qz"dphqumujp$ju#gptuidv#ffhrvf"L$cgjmo"ws!kptmgpiov#xig#gpfh2 )

Is This A Good Question/Topic? 0
  • +

Replies To: C++ code "Engineering journal"

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: C++ code "Engineering journal"

Posted 02 May 2009 - 06:09 AM

Please help us help you. Post your code you have so far so that someone could help. I doubt that there are people here that will do the work for you


And welcome to </dream.in.code> :)

This post has been edited by PennyBoki: 02 May 2009 - 06:09 AM

Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is online

  • Saucy!
  • member icon

Reputation: 5951
  • View blog
  • Posts: 23,215
  • Joined: 23-August 08

Re: C++ code "Engineering journal"

Posted 02 May 2009 - 10:07 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1