Sponsored Content
Full Discussion: Help with assignment2
Homework and Emergencies Homework & Coursework Questions Help with assignment2 Post 302477482 by bakunin on Sunday 5th of December 2010 11:17:22 AM
Old 12-05-2010
I think your problem is not the script but even before. Let us talk about the program structure prior to attempting to solve it in any language.

1. You need some kind of input validation. How should your program react when the input is unintelligible? Throw an error? Try to correct it? Leave it to the user to recognize that some output might be nonsense? Have correct input as a (silent) prerequisite?

Every answer to this is "valid" in its own right, but you will have to answer it before you can even try to create some program logic. Programming is automated problem solving - you could, using your file, convert currencies yourself (otherwise you wouldn't be able to write program at all). The program is just a generalized, fomalized description of what you would do.

It is good style to document with every possible exactitude what *is* done by the program and what *isn't*. Doing "A and B, but not C and D" is absolutely ok, but stopping for no obvious reason is not. Leaving it to the user to find out when the program output is valid and when it is non-sensical is not ok either.

2) Create a program logic before creating code. This helps in bringing your thoughts to formal conclusion. There are some formal approaches to this, but every method is as good as any other - what really helps is that you do it at all.

You probably have seen people - programmers - hearing a problem description and start right away typing code. They do in fact the same - create some plan first - but they are that much trained that they can do it in mind and instantly. Very likely they go back to coming up with such a "program plan" first before writing the code once the problem gets complex enough.

Write your plan here, we will discuss it and only then implement it.

I hope this helps.

bakunin
 
DEBCONF-MERGETEMPLATE(1)					      Debconf						  DEBCONF-MERGETEMPLATE(1)

NAME
debconf-mergetemplate - merge together multiple debconf template files SYNOPSIS
debconf-mergetemplate [options] [templates.ll ...] templates DESCRIPTION
Note: This utility is deprecated. You should switch to using po-debconf's po2debconf program. This program is useful if you have multiple debconf templates files which you want to merge together into one big file. All the specified files will be read in, merged, and output to standard output. This can be especially useful if you are dealing with translated template files. In this case, you might have your main template file, plus several other files provided by the translators. These files will have translated fields in them, and maybe the translators left in the english versions of the fields they translated, for their reference. So, you want to merge together all the translated templates files with your main templates file. Any fields that are unique to the translated files need to be added in to the correct templates, but any fields they have in common should be superseded by the fields in the main file (which might be more up-to-date). This program handles that case properly, just list each of the translated templates files, and then your main templates file last. OPTIONS
--outdated Merge in even outdated translations. The default is to drop them with a warning message. --drop-old-templates If a translation has an entire template that is not in the master file (and thus is probably an old template), drop that entire template. SEE ALSO
debconf-getlang(1) AUTHOR
Joey Hess <joeyh@debian.org> 2012-09-10 DEBCONF-MERGETEMPLATE(1)
All times are GMT -4. The time now is 05:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy