Progeek37's Posts
Nairaland Forum › Progeek37's Profile › Progeek37's Posts
1 2 3 4 5 6 7 8 9 10 11 12 13 (of 13 pages)
asalimpo:You seem to be approaching the problem from a different perspective. I may not doubt its possibility of working but have you tested it to be working? Note that there can be more prefixes, 0902, 0703, 0706, 0903, 0906, 0812, 0815, 0701, 0807 etc. That is why it is better to be passing the prefix as an argument. So that anytime you need the program to find a certain prefixed-numbers you can simply pass the prefix as a parameter and call the method/function with the prefix. Prefixing is actually the most trivial part of the problem, you should first make sure the program can print all the 7-digit numbers accurately before appending the required prefix to make them 11-digits numbers. Programming is done by actual implementation. Consider writing the codes and check if everything works fine. I have attached screenshots of a sample run of my solution on my Ubuntu terminal. Note: In this screenshots, I passed "0813" prefix as an argument and print the numbers of that prefix that ends with "3431". The first screenshot shows that the first number of the 0813-numbers that ends with "3431" is "0813 000 3431" , this is correct since the first number without any attached condition is "0813 000 0000". The second screenshot shows a portion of the output where my MTN number 0813 568 3431 can be found, can you spot it out? You can also see that the total available possible numbers in the enter 0813-prefixed numbers is 10 000 000, from the screenshot. I ran the program as a module, i hid the source code. Consider writing the program with your own approach and compare with my own sample run. Thanks
|
asalimpo:You are really thinking algorithmically! The total number of numbers of each prefix is correctly 10, 000 000. But it seems that you calculated it with basic knowledge of permutation and combination rather than from your code. The program should be able to show that the total number is 10 000 000. For instance, if you are using Python you can store all the numbers in a list, and at the end you will find the length of the list which should produce 10 000 000. However, you have taken the right approach since your program must concur with Maths calculation. But you have to think more if you want to solve the problem, because you are going to face a tougher challenge at a point. But if you think more algorithmically you can win the battle. I will not give further clues on the core logic of the problem. But let me rather give a trivial assistance: consider tackling the program functionally rather than procedurally. Define a function/method and pass to it the prefix as an argument/parameter. This will make your program flexible: you can be able to change the prefix by just calling the function/method with the needed prefix, isn't it smart? |
airsaylongcon:Yes, they are all valid. But it seems that network providers reserve such numbers as special numbers that can be acquired with huge price. For instance, Airtel reserves 0802 000 0009 as their Message Centre number. MTN Message Centre number is 0803 00 0000 but they remove the last zero! |
airsaylongcon:No! The total number of possible subscribers remains the same..."0803", "0813" etc are just prefixes. Note: The prefix just makes the numbers in it different from the numbers in other prefixes. As we know when the number of subscribers reaches the total, the network providers will respond by introducing another prefix. |
Here is a sample question In Nigeria, mobile phone numbers begin with the digit 0 and can contain and digits(0,1,2,3,4,5,6,7,8,9). The first 4 digits of the numbers determine the particular network provider. For instance, GlobalCom Nigeria Limited numbers can begin with 0805, MTN 0803 and Airtel 0802 etc. The mobile phone numbers must have 11 digits all together. For instance, this is my MTN number: 0813 568 3431. Write a program that can calculate the total number of possible subscribers of MTN numbers that begin with 0813 and print out all the numbers. HINT total_digits = 11: total digits of each number digits_needed = 7: digits needed to complete 0813 to 11-digit numbers. available_digits = 10: i.e 0,1,2,3,4,5,6,7,8,9 Note: Computer CPU has some limitations, some may not print out all the numbers. Instead of printing out all the numbers in computers with low processor speed and RAM. Consider printing out numbers that meet some certain conditions like numbers that ends with "3431" like my number in the question. But your program must be able to count all the total available numbers in "0813" even though it may not print them all out to the console. Also you have to make the program flexible such that you can easily change the lines for instance, you change can "0813" to "0806", "0803", "0805", "0902" etc or even make it start with country code "+234813". Goodluck. |
horlahwaley:Okay. Welcome to the world of programmers. Luckily you are one of the forerunners of this great vision as you are one of the first people to join. |
CONSIDER JOINING MY TUTORIAL GROUP Anyone can use frameworks and libraries to develop softwares and applications. There seems to be frameworks and libraries for many applications, this has shifted the attention of some people from understanding the core principles of softwares engineering... algorithms and data structures. There are many frameworks and libraries for virtually anything we want to do, but can they meet all our needs? No, not at all. You would like to program how your software should work the way you want it to work. Then learn to program first. At a professional level what distinguishes one programmer from the others is the knowledge of algorithms and data structures. No matter what you may think this is an absolute truth! Software companies are riddled with a shocking amount of self-taught amateurs who, despite having programmed on a salary for years, have no grasp of the fundamentals of programming and have no idea what a hash table is, how polymorphism works and how to work with bitwise operations. Don’t be like them! Learn the basics of programming first and then the technologies. Otherwise you risk having your programming skills crippled, more or less, for years, if not for life. To join the group send me a private message and note I'm not promising to teach you web, mobile or desktop development and as well I'm not promising to make you to be a professional programmer, no not all, and no one person or book or tutorial can do that. To become a proffesional programmer you will have to work hard for some years, years of active and committed programming and project building. My tutorial will certainly pave a way for this journey! What do I promise? I'm going to teach you how to program, how divide programming problems into steps and tackle them without fear or visiting the internet. This is the most important thing you need, the rest will become easier if grab these fundamentals As improbable as it might seem to you, the basic principles of writing computer programs have not changed all that much in the past 15 years. Programming languages change, technologies get modernized, integrated development environments get more and more advanced but the fundamental principles of programming remain the same. When beginners learn to think algorithmically, and then learn to divide a problem instinctively into a series of steps to solve it, as well as when they learn to select the appropriate data structures and write high-quality programming code that is when they become programmers. Once you acquire these skills, you can easily learn new languages and various technologies – like Web programming, HTML5 and JavaScript, mobile development, databases and SQL, XML, REST, ASP.NET, Java EE, Python, Ruby and hundreds more. If you’ve never written a computer program, don’t worry. There is always a first time. In this tutorial I will teach you how to program from scratch. I do not expect any previous knowledge or abilities. All you need is some basic computer literacy and a desire to take up programming. The rest you will learn from the tutorial. If you can already write simple programs or if you have studied programming at school or in college, or you’ve coded with friends, do not assume you know everything! Join the group there might be many things you are missing out along the way. As the world has moved to digital era, where artificial intelligence can take control of the affairs of the world. There is a need to train programmers who will be the driving forces. Nigerians should not be left behind in this matter, we need experienced programmers who can bring innovations to our country. Some people keep asking how do I learn programming and what is the best programming language to start with. I have a simple answer to this question: Start by learning the fundamentals of programming itself and how algorithms work. The programming language to use is really irrelevant at the moment, and no programming language is better than the others, every programming language was developed to meet urgent needs and was created for a particular purpose. Every language has its own advantages and every single one of them could solve most of the problems you'll face in software development process. You should choose the language that you're familiar with. Great softwares are made by great programmers, not by languages they use. So stop wasting your time jumping from one search engine to another to find out the best and lucrative programmming language. I repeat, you can start from any programming language. You must be determined if you really want to learn programming, don't give up easily. Some people have given up before they reach the rewarding apex of programming career. You should love coding, you should love solving problems. Don't love money! Love coding instead. If you love money you may give up before reaching a point where you will start receiving the money. Programming is a lifetime commitment, are you prepared to take it up? I repeat there is no end in coding. You will code until you grow gray hair and die. Are you willing to sacrifice that much time? Programmers are really the most current professionals. they adapt to new technologies like chameleon. If you are determined let's start now! If you have a tendency to give up at a slight encounter of difficult syntax then I would rather recommend a programming language that has simpler approach to syntax, such languages include Python, Java, C#, Ruby and Javascript. I strongly recommend Java. Starting with C or C++ may discourage some who are new to programming because of C strong use of syntax, to be able to solve a simple problem in C, you need to write many lines of code and follow many rules, the beginners who are not determined to learn programming may easily be discouraged. However, if you are determined, not even C can deter you from learning coding. Resist the temptation to start programming by designing and developing websites and mobile apps, you can never be successful if go on like that. If you start programming like that, you will end up being a laughing stock in a software company. I repeat, don't start programming with building website applications and app development, those things are not bad but you need to start them when you have understood how algorithms work. What is algorithm? A sequence of steps to achieve, complete some work or obtain some result is called an algorithm. This is how programming is related to algorithms. Programming involves describing what you want the computer to do by a sequence of steps, by algorithms. Some of your colleagues directly begin programming with Web or mobile applications and databases without knowing what an array, a list or hash table is. Do not envy them! They have set out to do it the hard way, backwards. They will learn to make low-quality websites with PHP and MySQL, but they will find it infinitely difficult to become real professionals. You, too, will learn web technologies and databases, but before you take them up, learn how to program! This is much more important. Learning one technology or another is very easy once you know the basics, when you can think algorithmically and you know how to tackle programming problems. Starting to program with web applications or/and databases is just as incorrect as studying up a foreign language from some classical novel rather than from the alphabet and a textbook for beginners. It is not impossible, but if you lack the basics, it is much more difficult. It is highly-probable that you would end up lacking vital fundamental knowledge and being the laughing-stock of your colleagues/peers Reading books without practising is meaningless! You must spend much more time on writing programs than reading the text itself. It is just like learning to drive: no one can learn driving by reading books. To learn driving, you need to drive many times in different situations, roads, cars, etc. To learn programming, you need to program! Everybody has studied maths in school and knows that learning how to solve maths problems requires lots of practice. No matter how much they watch and listen to their teachers, without actually sitting down and solving problems, they won’t learn. The same goes for programming. You need lots of practice. You need to write a lot, to solve problems, to experiment, to endeavour in and to struggle with problems, to make mistakes and correct them, to try and fail, to try anew and experience the moments when things finally work out. You need lots and lots of practice. This is the only way you will make progress. So people say that to become a developer you might need to write at least 50,000 – 100,000 lines of code, but the correct number can vary a lot. Some people are fast learners or just have problem-solving experience. Others may need more practice, but in all cases practising programming is very important! You need to solve problems and to write code to become a developer. There is no other way! I have created a WhatsApp tutorial group to be run using the Zoom app which allows sharing of computer screens, you can send me a WhatsApp message if you need the tutorial. Please note is the tutorial is available in Java and Python now.For details send me a WhatsApp message. |
