Sbucareer's Posts
Nairaland Forum › Sbucareer's Profile › Sbucareer's Posts
1 2 3 4 5 6 7 8 ... 26 27 28 29 30 31 32 33 34 (of 38 pages)
Here is the implementation class. The class that will run the above class. We are going to called it RadioDemonstration class [color=navy] import java.lang.Object; public class RadioDemonstration extends Object{ //We are going to create Object(s) of class Radio static private Radio firstObject = null; static private Radio secondObject = null; public static void main (String args[]){ //We are going to instantiate two objects we created above firstObject = new Radio (12, 3); secondObject = new Radio (4, 7); //Testing the new Objects or querying their attributes System.out.println (firstObject.getFrequency()); System.out.println(secondObject.getFrequency()); //Changing the identity of the objects we create above, hence assigning new values to their attribute. firstObject.setFrequency(3); secondObject.setFrequency(10); //Testing the new Objects or querying their attributes System.out.println (firstObject.getFrequency()); System.out.println(secondObject.getFrequency()); }//End main }//End RadioDemonstration class [/color] What the above class is doing is instantiating the objects of Radio class and accessing there attributes through getter and setter methods. Here is an assignment for you. 1. Draw a class diagram of temperature 2. Determine the attributes it will have and methods (Setter and getter) 3. Provide a class for temperature and also provide a suitable demonstration class called TemperatureDemonstration. 4. Print out the attributes by accessing its appropriate method (Setter and getter) Post your solution here. Don't send it to my email. When I recieve a reasonable solution I will go to next tutorial. Thanks for reading |
Let me write the above class and we can see what it does. Remember I am NOT teaching programming, I am teaching software development. As you can see we have already start thinking of developing a Radio application. In Java we have libraries like any other language. Why is library good for programmers? 1. It help in developing application fast 2. It has been tested, hence reduce bugs 3. It promotes reuseable code 4. It make life easier for you. All these and many more are the reasons for using libraries. You can develop your libraries if you want, but it will take time to develop a simple application. In java we use the reserved keyword import to add libraries that we want to use. Another key factor to learning java is getting familiar with API (Application Programming Language), really what this means are libraries. We are going to use a Class called Object and we will import it from java.lang.Object. See API [color=navy] import java.lang.Object; public class Radio extends Object{ private int frequency = 0; private int volume = 0; protected boolean working = false; public Radio (int theFrequency, int theVolume){ frequency = theFrequency; volume = theVolume; working = true; }//End constructor public int getFrequency( ){ return frequency; }//End getFrequency public void setFrequency (int toSet){ frequency = toSet; }//End setFrequency public int getVolume( ){ return volume; }//End getVolume public void setVolume (int toSet){ volume = toSet; }//End setVolume protected boolean isRadioWorking(){ return working; }//End isRadioWorking }//End Class Radio [/color] This is the actual code that the class diagram above depict. As you can see it has a class name, attributes (I forgot to add working in the above class diagram), every attributes the class has, it have it getter and setter methods. A getter and setter methods are Java specification for developing beans. The class above could be refer as bean but for now let call it a class. For every variable name you must have a way to change it value(behaviour), hence set and get it. All you do is put get/set in front of the attributes name |
Here is a Class diagram I want to introduce. It helps when you are building your class. You will noticed that the digram is divided into three cross sections namely; 1. Private 2. Public 3. Protected What this means it that each section has a strict rule enforcing it to become what each section is depicting. If a variable or method is on any section it automatically inherit the rule of that section. Let me explain what this Class diagram does. The rectangular shape at the top depicting radio means that, this class name would be called Radio. The rectangles on the right hand side are methods except the first one that shares the same name with the class Radio. It is called constructor. A constructor help initialize the class to initial values and provide an identity for the Object. Remember I told you that a class is the same as Object only that you can have as many objects you want. The rectangle at the middle is the attributes of the class, in some other language called variables. You can see that the variables are private. It means that no Object can see it attributes. The last one if the rectangle at the left with protected attributes. It is a method that return whether the Radio is working or not. The Objects that can access this is the objects within it package. Don't worry too much about package, private, protected and public I will talk about it later in the tutorial. Don't worry it will all make sense soonest, I promise.
|
Remember that every class you create is an object. That class can contain lots of information relating to itself and other classes. An Object is an instance of some class, which has aggregate values, attributes and identity. There are several difinition of Object. You can do a google search or pick up a very known Java book and compare Object definition in correlation to computer programming. Class is basically an Object. Let say that a class is one file named HelloWorld.java, when we instantiate the class it becomes an Object and we can have many insatances of a class. There is no limit to the amount of instances we can have out of a class. I will show you how to instantiate a class at later tutorial |
I will start by explaining what is OOP. OOP is defined as Object Oriented Programming. You will ask yourself what the heck is OOP; I know I asked myself the same question when I started learning OOP. Well let’s take a simple example of OOP from a different point of view. Let say someone is sick and he go and visits the doctor and the doctor said you have cold, hence high temperature, and headache. Listen cold, temperature and headache, three things at the same time. I am not a doctor but I will think the doctor will give the patient three pills to help and solve each problem. But wait, wouldn’t it be nice if the doctor had given him just one pill that contains all the medicine for the three type of problem he had? Well, I know I will like it, as I hate taking medicine. What does that means, in computer world OOP means a revolutionary concept that changed the rules in computer program development, object-oriented programming (OOP) is organised around "objects" rather than "actions," data rather than logic. Like our pill scenario, we can put more that one thing in a container, that container is called Object. We can access the Object and get other information it contains. If an Object contains headache medicine or temperature medicine we can ask for these information. Remember that Object belong to a data type i.e Integer, Char, String, Boolean, and Object. There is some thing we call Poloymorphysim, we will discuss about that later on, basically it is a way to change an object to another data type. It helps in managing the class and less coupling in program. I will also discuss about coupling at a later stage. |
Test your IDE and Java installation plus environment setting by running a simple HelloWorld program [color=navy] public class HelloWorld extends Object{ public static void main (String args[]){ System.out.println("Hellow World" ;}//End main }//End program HelloWorld [/color] Don't worry about any of the above code, just copy/type it into your IDE, compile and run it. I will explain what is happening in a later tutorial. |
This is how the system property looks like from your window control panel
|
Download and install textpad, I used it because it is shareware but allows you unlimited access to the IDE, but there is some annoying glitches, you will soon find out. I'd introduced you to a more complex IDE but it will take time to configure and it will forfeit the idea of the tutorial, as unnecessary time will be wasted learning IDE. If you are confident or want to do extra learning as most student do, you can try the Netbeans or Eclipse The configuration of the above IDE is out of the context of this tutorial. Download java 1.5 and install it into your system following the installation wizard. Java 1.5 will install in your windows directory i.e. C:\Program Files\Java\jdk1.5.0_06, don't bother yourself with _o6 this is for stability version. We are not developing critical system yet so we will not bother about stable version. Go to your system control panel and double click on your systems, select the advance tab and click on environment variables, this is on windows XP Prof. For other windows platform, locate you systems from control panel and find environment variables it looks like this. You have two components there, user Variables and System Variables. You will need the system variables, and do this. From the system variable click new and edit as follows Variable name: JAVA_HOME Variable value: C:\Program Files\Java\jdk1.5.0_06 Click ok to come off the screen. Find in the system variable, a variable called path and click the edit button. Leave the Variable name: path and add this to your, NOTE do not delete anything just add ; at the end of the variable and add your JAVA_HOME like this ;%JAVA_HOME%\bin Here is how my path looks like Variable value: C:\Program Files\Microsoft.NET\FrameworkSDK\Bin\;C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE\;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\;C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%JAVA_HOME%\bin;%CATALINA_HOME%\bin;C:\Program Files\MySQL\MySQL Server 4.1\bin;c:\Program Files\Microsoft SQL Server\90\Tools\binn\ You can see where I added my JAVA_HOME highlighten in blue. Once you have done this fire up your texpad and write this program and compile it. If it works you have completed tutorial one if not PM [email=valentine.obih@gmail.com?subject=Help with installing java from Nairaland.com]my email[/email] |
[size=24pt][center]Learning Java - from a system approach[/size][/center] I will not bore you with the history of programming and why Java was introduced. But if you want to learn the reasons behind java, which it may also be, you can read this There is no point teaching students a language without telling them how or where to use it and all the tools they need for it. To learn java you will need these tools 1. IDE 2.Java 1.5 Compiler 3.Set the environment for your system. Emr, I will be teaching this on windows, but if you are reading this from a unix web browser (Probably Firefox) let me know I will write-up examples of installing these tools and setting up your environment for you. |
Thank you for opening this thread. I will be giving a tutorial on Java and C++. I will start with Java and progress through C++. I will be using a reference material, basically a book by Professor Fintan Culwin, a Head of Software Engineering at the school of Computer Information Systems and Mathematic at London South Bank University. The book is called A Java Foundation Classes Primer, ISBN 0-333-77339-X The book discuses Software Engineer rather to Software programming, which is what I will be teaching. I have to start making you think like a software Engineer rather than programming. The truth is that you can learn software programming in little as two to three weeks, but it will take you years to learn software Engineer/Development. The C++ I will use this book as a reference by Deitel & Deitel, Third Edition, How to Program C++. It has a UML for Software Engineers. ISBN 0-13-089571-7 |
8 * 3 = 24, hence 8 hours work, 8 hours recreation and 8 hours sleep, QED. abbreviation for quod erat demonstrandum (Latin “which was to be proved”), added at the end of a geometry proof. |
If you are considering the speed of processing time of an application, you have to consider the hardware/architecture of existing technology. You said ASM could be used in (For example, data representation, memory organization, elements of computer architecture, how input/output operates, etc, ) And mochafella said Mission critical, real-time embedded systems, where human life is in danger e.g. vehicular braking systems, manned space flights. All make a lot use of ASM. Remember that the highest wave frequency for transmitting wireless data is currently at 54Mbps, LAN and WAN is currently at 1000Mbps and 155Mbps respectively. The computer architecture is currently (Mother Board) at 133Mbps and the [url=http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=deskbar&q=define%3A+FSB]FSB[/url] is currently less than 1Gbps. All these issues have to be considered as well. Like Moore said transistor found in CPU chip has doubled every two years. It is still useless if the data bus cannot shift the data as quickly as possibly to the CPU. ASM, like in life has become old language and people tend not to bother to learn it. But I believe it use in today critical systems will still strive the force for its longer life. |
pendelite, your theories are frightening but realistic. These proxybot could develop awareness like human beings did over the millennia. Humans were not like this before. We could even say we were advanced proxybot. Millions of years ago all we were after was food and shelter. As time goes by we began to develop awareness to distinguish us from other animals. Do you not think that these proxybots will one day do so? I am sure you know what virus is? A malfunction bot will probably have is program changed by the virus and alter its program sub-routine and being to feel differently and not let anyone know and by doing so help reprogram other bots. I am not saying this is real, but the people that wrote this film Battle Star Galactica must have some sort of ideas in their head. Remember that science fiction always end into science reality. The most powerful tool on earth is knowledge. Once you can think abstractly believe me your thoughts can become reality. As of your project, I'd like to see a copy or overview when you have finished. [email=valentine.obih@gmail.com?subject=Pendelite project regarding South Africa To Acquire Rights To Produce Nigerian Cars in Nairaland.com]Email me[/email] |
Another problem with software is maintenance, 99% of software lifetime is spent on maintenance. If assembly language is used the problem will be getting professionals to support these systems. Moreover, assembly language is architecture dependent and probably OS dependent, which can cause portability or interoperatebility issues |
I don't think so personally. Like what you have enumerated that faced our young programmer. Most do not understand memory blocks and how high-level language assigns an address to the variable, which part of the memory address the variables are stored, also the computer/chip architecture. All these are very important to know. But the high level language has addressed these issues and provides a platform for young programmer to concentrate on the task at hand rather to understanding all these architecture and memory management. Assemble language I think has it own application suppose like dedicated system i.e. automatic gearbox, digital watches etc. But certainly assemble is not gone for good, it will still be around for some time. |
@gbengaijot, start a thread I will tech you how to develop software using java. It is better than learning how to program. |
@pendelite, well spoken. Education and good leadership is the key to any sucess. Beside, if knoweldge is power, the elements of knowledge must surely be found at the four walls of the education system. pendelite, I like your encryption f@&.%ed. |
@ joftech, I hear you and I agree with you, but we will not say because fish died in water and not drink water anymore. We have serious problem and we need serious solutions. It is a shame that our graduates are not leaving up to standard and who do you blame? |
Because I am a very reasonable man, I would let that slur go. As much as I do not like to direct affront phase to people particularly in a public forum like this I will disregard this slight. To administrator, I am sure you will take note of this. Knowledge is NOT shareable but if you want it by all cost you can acquire it. Thanks to google that can search the world in some few nanosecond. |
My friend, the future is not robotic, the future is knowledge. Information is the future. read this. We are in the era of information Age. We have already moving away from information age and entering knowledge age, which after will be Artificial Intelligence Age (AI). With knowledge you can build an artificial life you refer to as robot. How would you program it to learn without knowledge? What will you teach it, 419? Do you know that robots can develop self-awareness and rebel against their masters? No I don’t think you can understand what I am talking about. Do you also know we can program feelings, pain, love, affection, etc. into robots? First we need understanding, hence knowledge. Have your thought of employment issues robots will cause? Have you taught of electricity they would use? Lets develop our country through our leaders and provide environment to academic achievements, then sky would be our limits. Read this |
A medical science student has told me this and another argument I went into in the past has uprooted the same theory. Why don't you do your research to prove me wrong? Don't always depend on people to feed you like a baby. If I do not have reference at least you can do your research and post it here for disagreeing with me. I will not provide you any reference, off course I have seen a good academic article on the web for my claim but I have decided not to show you unless you can prove me wrong. If not you can’t say I wrong for saying what I said. Have a nice day. |
I am not for any indifferent person that would set-up a cult/society to fight Nigerian government. Martin Luther King Jr. did not do so. Many martyr did not do so. I wish universities in Nigeria should be encourage to participate in online discussion like Nairaland.com This people have the power in any society in the world. The truth is that universities are the key success of any nation. They say knowledge is power and I wonder where all Nigerian graduate power is? Write a letter to the police commissioner asking for police to be supplied for a peaceful match to the house of senate on so so date. People like Nobel prize winner Wole Soyinka etc will come on that day. We should have petition from students upraise to fight this corrupt government and install someone that can do the job. We have the power that is why we are practicing or trying to practice democracy. The government for the people by the by. This is just my recommendation, some might even come up with better plan. Even boycott Voting day. If we don’t challenge the ruling power thing will never change. If we don’t make them feel that their seat is attainable they would remain supreme. We need to take some sort of action. |
It is hard but it can work. It has worked for Africans and European girls and vice versa. You have to be open-minded person and willing and ready to change and adapt. Love conquers everything. But love can be dangerous too. |
Tell me what you think is the main economy stability today in Germany? @ayanfe. Manufacturing cars is enormous venture. A business man wants to see his profit margin between a period of 2-3 months not wait till his children grows up and enjoy his money or even worst, the government takes over the business, like US wants to do to Mr Gates. I am looking at that car becoming something in about 50-100 years. Not just the car the technologies and employment it will provide. My brother go to Munich in Germany you will see what I am talking about. If you can build cars the concept from building a plane or any aircraft is feasbile and that is what we call development. Do you think civilization will come from heaven? Maybe God will send us civilization since we do not want to embrace our kind to good human endeavour |
The original inventor of motor like Nicolaus August Otto in 1876 never knew the product would change into cars and even planes etc. The concept was there and their people welcome him and encouraged him to forge forward. Can you say that to Nigeria? I think you answer had better be no. Nigeria do not encourage people especially when you are out of the zonal region that dominate the office of the presidency. i.e. if you are Igbo, calabar, Ijaw etc. |
@ayanfe, you are a short sighted man, no insult intended but you have to think beyond this. Even the altimate driving machine today we all enjoy Mercedes Benz started like this
|
[quote author=AK-47]It’s the fault of the man, so he needs to take it like that. by the way what is the different. if he is not srong enough to produce a boy, he should keep pounding for more girls.[/quote] I disagree with you AK-47. It is not the fault of the man. It is no ones fault. Some women have very acidic virginal fluids that kill the sperms. Some women are very difficult to come wet, if you understand me. That fluid help to neutralise the walls of the virgina before the sperm can come in. If this is not done on a timely fashion it affects the rational probability of sex. Because men can produce the chromosome of both male and female whilst women can only produce the chromosomes of female do not exempt them from the problem domain of sex issues. But the truth is that every party is to be blamed particularly men. I see no reason for having unwanted children for the sake of a male child. We ought to have grown out of this nonesense male child thing. A woman can do whatever a man can do, even better. Let a woman rule Nigeria you will see difference. |
Oasis, I totally agree with you on central database scheme. It would solve lots of our problems and enhance our public services applications. Also geton I agree with your quote We go manage am now, All we they pray is for God to answer our prayer That is a typical Nigeria man attitude to a serious delicate problem. We always confined to God to come down from heavens and solve our problems. God might have done it for Israel in the bible but the people of Israelites prepared themselves before they Egyptians came running into a big hole they have dogged coupled with a shinning glass that blinded their vision against the sun. The point is that we need to stand up for ourselves like geton said and fight the government. Like our work union, universities organizing a peaceful demonstration calling for resignation of corrupt politicians and demanding new and working policies for our country. Media, providing accurate coverage for the world to see what is happening. You will see people abroad will help by protesting in their countries of residence by means of peaceful matching to their respective government office with placard calling for some resignation of some top officials. The idea of the database by oasis is very well taken in, how are we going to secure and process it? This database would provide a primary focal point in our national security. I would recommend this type of database NOT to be online. Like the police in this country do, they call in to a person that can access the database intranetly and obtain information via radio. These database can then be fragmented to various location according to state turple. Database would solve lots of our problem that is for sure. To geton, electing a leader is simple, like I said above, let say you have a company and you have the interest of your company at heart, you'd employ someone with a good track record to help you company grow. How do you do this? By posting you advertisement far and wide also conducting a very good constructive interview, even maybe asking the interviewees to take a test to prove their ability. The same thing can be done in politics. I can't say we need massive education, as Nigeria is a well-educated nation. The amount of graduates coming out of university every year across all state is mind blowing. I can not really answer this question How many educated people are back home? because we do not keep database like oasis said. But it'd bee nice to know this figure. So, educating people is not really the key for people giving their votes to cowboys. Everyone know what is good and bad but I think Nigeria are refusing to change from their bad ways and it is really a shame. Every country is moving forward, India, China, South Africa, Ghana, Gabon, Zimbabwe, Sierra Leon etc but Nigeria is going down day by day, it is really a shame to African giant Oil producing state. I am sure God will ask everyone not just the leaders what did you do for Nigeria? Did you love yourself so much you careless about Nigeria? |
Thank you very much geton for your insight to this conversation. Let me try and answer your question one after the other. Now, we are practicing democracy right? Which means we must have parties. I am not really familiar with parties in Nigeria but I know of one party called PDP. Who is the party chairman? I mean who is the chairman of PDP. Can you tell us what he did in his past life? What is he doing today? Can you also tell us the slogan of PDP? It is like looking for job, you have to take time and learn about the company so you don't get caught unawares at the interview. Who are the other body that makes up PDP? If you can answer these questions you have already know what the party is all about. Now coming to electing a leader. We do not have choice on that, the party elect leader and we vote for the party. Now, if you give your precious vote to a cowboy party with little or no interest of you, then what is happening in Nigeria today is what we get. I heard that Rtd General Badamasi Babangida is coming back again. Come on how many times are we going to be fooled. It takes only one look to know a nefarious person. Why does he really want to come back? What will he do this time differently? What will he do about growing tribal disagreements, marginalization, poverty, international debt, schools, health, banking, electricity, roads, housing, etc? He should be put on TV for an interview. They do it here in the UK when a party elect a new leader. Besides, don't we have a shadow president? Do leaders always emerge during general election? He should be campaigning since 8 years ago and providing solid laws and reforms within his party and challenging President Olushegu Obasango policies that he did not like. Where do he think he can learn all these things? When he presides the site of the presidency? Come on! It is unfortunate, the person I would have like him to rule the country is dead, Kain Saro-Wiwa, not that he qualifies for the post by merit but his vision towards his people. He has the interest of his people at heart. Someone of that calibre is what we need, someone that has the interest of Nigerians particularly ordinary man at heart. Many Nigerians do not do research as to whom they want to give their vote. As long as the man speaks their language it is ok for them because that ignorance that the man will have their interest overshadow their thought, forgetting that this is not just a one language country, that this is multi lingual Nigerian and any leader should have showed tolerance of this in the past. |
1 2 3 4 5 6 7 8 ... 26 27 28 29 30 31 32 33 34 (of 38 pages)
;