Posts

Showing posts from February, 2019

Finding the next Palindrome

Image
Hello, here's a quick post I'm making for a simple program. There will likely be another as my professor is currently making me do more basic programs at this point instead of a more major project like the calculator. This programs does one task: when given a number, it will find the next palindrome after the number. You can find it here on github . It does some other tasks as well such as validating if the input was a number and making sure the number can be turned into an integer. The finding of the next palindrome is done by checking the first half of the number and comparing its reverse to the latter half of the number. If the reversed first half is larger than the latter half, the output will just be the first half combined with the latter half being the reversed first half. In odd length numbers, the middle number is increased by 1.  If the reversed first half is smaller than or equal to the latter half, the output will be the first half plus 1 and the rever

A Text Replacing Program

Wow. As the calculator is put to the back burner for the moment, I've gotten time to work on other programs and get a post out at a decent time. Hopefully I'll be able to keep this up. The class has been tasked to write a conditional character replacement program. The objective is to replace characters in a text file which aren't in specific words or adjacent to specific characters. This was apparently a difficult task for many, even myself. However, with some review from the other classmates in the class, I've created a method for replacing a certain character under specific conditions. The program can be found here on github. The program works basically in the following way: Text is inputted from a file. Each line of text in the file is to put into a list as an item. The restricted words, restricted characters, the character to be replaced, and the character to replace, are inputted by the user within the console. The user can input multiple restricted words an

An Update on the Calculator: Now with Parentheses

Image
This second edition of the calculator took longer than expected. Originally, I thought it was going to be some complex, but easy to implement, code. However, it came to appear almost as an impossible task. Worse, for almost a month, our professor has not had the situation where he could come to class, so for most of the time since the last post we had to work on our own. However, after several written up concepts and reviews from others students and failed attempts, I've coded up this new calculator. Here it is on Github. The prior calculator was very basic, it did less than a calculator one could get for free at a convention. The code for it was too simple, the new calculator had to be mostly remade or greatly modified at several key places. However, I did get this completed only a few days ago. The new calculator is quite close to a basic scientific calculator. It can now do order of operations. One can input several numbers and operators, and the calculator will foll