Based on the above, create a program with the following requirement
• GetLicenseInfo() method that input license number and renewal period from user. Display an information to the user either to renew the license for 1,2,3 or 5 years.
• CalculateLicensePrice() method that will calculate price for driving license depends on the renewal period of 1,2,3 or 5 years. The renewal fee is RM30 per year
• A method DisplayLicenseInfo() that will display each details including license number,renewal period and license price.
Just because someone helped a person who asked a specific question, doesn't mean he'll do your homework. Imagine what this forum would look like if every person with a question started to hijack threads ?
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Ignore the others - I'll help you. Of course, you'll have to pay the daily rates my company charges, but what the hell - we'll throw in a years support contract for a very reasonable fee. We will expect an initial payment before work commences, but once we have the contract in place, we'll be good to go.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
Are you a cool kid who wants to impress your friends and family with your mad skillz?
If you think you're a "cool" kid who can impress people with 1337 programming skillz0r then you really need to go outside. I knew from the beginning that programming wasn't going to make me the life of a party, it's not right for Microsoft to lie to kids this way.
and you can still capture it if you install a keyboard hook.
This is a bit late, I know, but I am having terrible problems with my ISP at the moment (I'm stuck on 53.6 kbps at the moment, when I can get a connection that is ).
My point was that Alt-Space is one of the less well known keyboard shortcuts but nonetheless some people do use it (me for instance) and because of that it might be worth the OP considering an alternative. There is little that is worse than using a 'standard' shortcut only to find that the app you are using has decided to use it for formatting the C: drive.
As far as I am aware you can capture any key combo with a global hook but whether you should is another thing.
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I'm sorry about your connection speed but I had a laugh.
Henry Minute wrote:
My point was that Alt-Space is one of the less well known keyboard shortcuts but nonetheless some people do use it (me for instance) and because of that it might be worth the OP considering an alternative.
There are many valid reasons to execute code when the user is pressing this key combo (amongst many other combos). For instance, if your application does not have a system menu, and you want to emulate it yourself. Or your application is largely ownerdrawn (we have an app where there's just one window and everything else is drawn as bitmaps in runtime) and it emulates a lot of stuff (context menu drawing, system menu drawing, cursor, etc.,) based on keyboard and mouse inputs. This can be done only with the help of a hook. And this is not going to affect the way other applications work (you execute your code, only if your window is active).
Henry Minute wrote:
As far as I am aware you can capture any key combo with a global hook
Not any key combo. The SAS (Ctrl+Alt+Del) key combo is not something that can be trapped because it triggers a hardware interrupt that isn't notified of outside the ring0 level. (OK, may be that can as well be trapped, but that will require ninja windows programming skills). Even with ninja skills, it is almost impossible to trap it on x64 versions of Windows, because of Kernel Patch Protection.
I am not sure how to express what I need. However...
I've got a code which generates all permutations of an array of numbers 0 to n-1, which can be used to generate permutations of any array, since every element can be mapped to it's index and vice versa.
Here it is:
public IEnumerable<int> GetPermutations()
if (n == 1)
var generator = new PermutationGenerator(n - 1); // recursionbool even = false;
foreach (int permutation in generator.GetPermutations())
for (int i = 0; i < n; i++)
yieldreturn InsertN(permutation, i);
elsefor (int i = n - 1; i >= 0; i--)
yieldreturn InsertN(permutation, i);
even = !even;
In an algorithm I am currently writing, sometimes it is good to skip some permutations. E.g. I have reached , and realize that I don't need any perm. which starts with [123.....], so I would like to skip 5! permutations and go in one step to [124.....]. It basically means that I would like to put a "return" in a given level of recursion. The code would look like this I suppose:
I was thinking of that, but like I said, hard to wrap my brain around your algorithm right about now...
What you could do is set a boolean flag on your generator class in the SkipPermutations function... And in GetPermutations(), you can "yield return 0" instead of running a block of code whenever you want to skip an entry. I'm not sure where exactly to put it though.
Basically MoveNext() will continue GetPermutations() until it hits the next "yield" statement. If it's a "yield return", it'll set the Current property to the result and return true... If it's a "yield break", it'll return false. So you just need GetPermutations() to "yield return 0" until the skip flag is turned off.