My Two Projects for Finals

So it has been almost a month since my last post. It's been a busy time. I have to dealt with final projects in all of my classes and had to study for various exams. With Thanksgiving and a relative's graduation, I had to also do various things with my family. One other thing I had to do is my programming class' final project.

So for my first programming class I had to create two programs:
  1. One that gets a number in its numerical form and then state the number as words instead of numbers.
  2. One which will translate a number in one base and translate it to another base, such as translating a number from binary to hexadecimal.
These were probably the hardest programs I've ever made so far. I had to learn various code pieces such as dictionaries and chars. Much time had to be put into them, and countless times did they have errors while running. Nevertheless, I shall go into what I have made.

Number to Word Translator



This is a simple program to which takes a number, turns it into a word, adds a currency name at the end, and displays it in an ordered list. It works with these basic steps:
  1. Get the inputted string
  2. Validate the input; making sure the input can be a number, is greater than 0 and less than 1 billion, and will not cause overflow or argument errors
  3. Find the amount of digits in the number
  4. For the amount of digits in the number, get the current number at each digit, and run a function to find the word it should be given
    1. A special function is given to numbers in the tens, as their names are different from other numbers
    2. Once the number's word is found, add it to a string
  5. Add the number and the string to a sorted dictionary
  6. For every item in the sorted dictionary, add the number and the string to a list box
The most difficult part was in dealing with the teen letters. In the English language, a number such as 22 can be ready while only knowing the digit and the value. 22 is "twenty-two," where one is simply saying "twenty" for the 20 and "two" for the 2. 17, however, is not said as "ten-seven," but "seventeen." One has to say the value of the following digit first. I found it to be such a problem, I considered doing this program in a different language.

Nevertheless, I've decided to do keep with English and resolved the issue by having a special function deal with getting the names of these certain numbers.

Another issue I had was in putting the number and names into an array, sorting them, and keeping them together. It was here I learnt about sorted dictionaries in VB.Net. I have decided to use this for the program so all the numbers inputted shall be sorted from smallest to largest.

With those two problems resolved, the rest was a breeze. I also did some minor designing. I found it to be quite a good program.

Base Translator



This program will take an inputted number from a certain base chosen by the user, translate it to base 10, and translate it to a another base chosen by the user. That's it basically, the only other things it does is validate the inputs and display the values.

There is little specific to the process. This program simply follows the steps of converting to and from binary, but instead of just binary it does any base from 1 to 36. It goes from base 1, which is only 1s representing tally marks, to base 36, using all numbers 0-9 and all letters A-Z. As far as I'm aware, it should be accurate for all translations.

I will likely not post these two projects to Github. If I do, I will likely have these programs redone in some other code and display such as with HTML and JavaScript. These are also likely the last Visual Basic programs I will make. While I may appreciate the easy way of designing a program in VB and a coding language that does not require semicolons at the end of each line, I do not see much future use in it and my future programming classes won't use VB.

With myself now on break, I will likely be able to keep up with posting and not have a massive gap as with November. I do have some ideas to do in coding, though it may be awhile until my I do anything in an engine like Unity again. As for now, farewell.

Comments

Popular posts from this blog

Version 2:The Not-So Barebones Clicker

A Prime Factorization Algorithm that Uses a Text File

Aesthetico Ultimate Designer - A Python Turtle Program