Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,180 members, 7,818,565 topics. Date: Sunday, 05 May 2024 at 06:53 PM

Learning To Program With Java by the Fulaman - Programming (6) - Nairaland

Nairaland Forum / Science/Technology / Programming / Learning To Program With Java by the Fulaman (41553 Views)

How To Program Arduino Uno / How To Program With Your Android Phone Using Aide IDE Environment / Which Training Center Can Someone Learn How To Program Quickly (2) (3) (4)

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (16) (Reply) (Go Down)

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 2:23am On Apr 25, 2016
macaranta:


Awesome,just let us know when you're ready.
Kind regards

I will sir thank you.
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 2:28am On Apr 25, 2016
It's very late in the night (I should really morning) and I have been up all night working on some code for a project. In any case, I wanted to post a portion on the while loop.

The while loop is just like the for loop except that it uses a different format to continue iteration. Below is the format for the while loop:


while (statement is true) {

//Do the following code in this block


}


The while loop repeats a statement or group of statements while an expression is true. Let's look at some code and assess how it works.

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 2:31am On Apr 25, 2016
In the code segment given, an integer variable 'i' is declared and initialised to 0. After that a while statement is performed with the expression (i < 20), we tell the computer to output to the console "This is a test " with the value of i next to it. After we output, we increment the value of i by one via the 'i++'.

The loop will repeat until i reaches 19 because the condition to be met in the expression is "i is less than 20".

1 Like 1 Share

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 2:37am On Apr 25, 2016
Assigned reading:

http://codingbat.com/doc/java-for-while-loops.html

Read this segment from start to finish to improve your knowledge regarding for and while loops. I will be giving you guys an assignment after a go over do-while loops.

If you see anything regarding arrays, please kindly ignore it.
Re: Learning To Program With Java by the Fulaman by Nobody: 9:02pm On Apr 25, 2016
any developer here conversant with c-sharp, mysql database to help me out please?
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 12:17am On Apr 28, 2016
Collinz2:
Is it just me or the java language. Anytime i read online tut at first i get the msg but later i wil be totally confuse.
That's probably because you have no one to learn with... Learning with people is more fun and easier that learning alone
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 9:46am On Apr 28, 2016
hardebayho:

That's probably because you have no one to learn with... Learning with people is more fun and easier that learning alone
hmmm
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 12:58am On Apr 29, 2016
Fulaman198:
In the code segment given, an integer variable 'i' is declared and initialised to 0. After that a while statement is performed with the expression (i < 20), we tell the computer to output to the console "This is a test " with the value of i next to it. After we output, we increment the value of i by one via the 'i++'.

The loop will repeat until i reaches 19 because the condition to be met in the expression is "i is less than 20".


We re grateful sir. We are gradually progressing in this journey
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 8:16am On Apr 29, 2016
satmaniac:



We re grateful sir. We are gradually progressing in this journey

Excellent I'll post an assignment today. Thanks!

1 Like 1 Share

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:06pm On May 01, 2016
Day 5 Cont:

Greetings once again dear NL folk. I am sorry for not posting in a while. I hope that you understand that I have been busy with other stuff in my life. In any case, I don't want to go into other details. I will continue with the Day 5 tutorial. The 3rd iteration process that I would like to discuss is the do-while loop. It's structure is as follows:



do {
//These commands
} while (boolean expression is true)


Let us look at some code and assess how it works.
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:12pm On May 01, 2016
In the code sample below, I have created a very simple do-while loop to illustrate how it works.

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:13pm On May 01, 2016
The output is as follows:

It looks until you see 99 which is less than 100.

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:25pm On May 01, 2016
Assigned reading:

http://www.tutorialspoint.com/java/java_do_while_loop.htm

If my tutorial isn't enough for you, please do this reading.

Assignment:

Write a programme(program) that Outputs a list from 1 - 5, where 1. convert some units from cm to inches (use the value of 2.54 cm = 1 inch), 2. that converts metres to feet (use the conversion rate of 1 metre = 3.28 feet) , 3. that converts Centigrade(Celsius) to Fahrenheit (the formula for that is (9/5)C + 32 = F) 4. Convert naira to euros (where 1 euro = 227.96 Naira), 5. Exit the application

Use a combination of what you have learned thus far with conditional statements and looping/iteration statements. The application should keep looping until the user presses '5'. Once the user presses 5, the application terminates.

The programme should be able to accept input e.g. if the user presses number 3 which converts degrees celsius to fahrenheit, the programme should do something like this:

Please enter a value in degrees celsius that you would like to convert to degrees fahrenheit:
100
Output: 100 Degrees Celsius is the equivalent to 212 degrees Fahrenheit.


Enjoy the assignment. I made it a bit harder this time, though for some of you, it's more than likely quite easy if you have done something like this in another language.
Re: Learning To Program With Java by the Fulaman by Nobody: 8:35pm On May 01, 2016
Fulaman198:
In the code sample below, I have created a very simple do-while loop to illustrate how it works.
java is very similar to c++
Re: Learning To Program With Java by the Fulaman by Nobody: 8:58pm On May 01, 2016
Fulaman198:
Java is an object-oriented programming language that was first developed in 1995 under Sun Microsystems which today has been acquired by Oracle. The Java language today is used in a lot of server side applications, database programming alongside SQL, embedded controls, games, etc. Many people often rank it as the First or second most important programming language to learn. Most importantly, Java is used to create Android Applications.

So what is Java? as aforementioned it's an Object-oriented programming language much like C#, Objective-C, Swift, Ruby, C++, etc. We will get into what it means to be object-oriented later.

Today, we will construct our own first program, but before we can begin, I need you to install the JDK (Java Development Kit), current release from the official website, which comprises of the compiler, JVM, etc. The JDK can be found from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Please scroll down to where you see Java SE Development Kit 8u77 and select your operating system's version of Java to install (I assume that you have some basic computing knowledge and know which OS you are using).

For the time being, it's optional if you would like to use an IDE (integrated Development Environment) to write your programs. If so, I recommend Netbeans which can be found here and is the official IDE created and updated by Oracle: https://netbeans.org/, or alternatively Eclipse: http://www.eclipse.org/downloads/ or IntelliJ: https://www.jetbrains.com/idea/.

If Data is an issue, don't worry, you can simply use a text editor, but the JDK is mandatory to compile your programs and for them to run on the Java Virtual Machine (which we will discuss in detail later in day 2 of Java Programming).

When you have finished installing, you can check what version of java you are running with the following command on command line terminal

Mac: java -version in terminal
Linux: java -version in terminal
Windows: java -version (in command prompt)

you should see something similar to the screenshot below:


Hi, good evening, I CNT see java dev kit 8u77 in website you gave, only 8u91-8u92 should I download?
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:54pm On May 01, 2016
Sugarhugs:



Hi, good evening, I CNT see java dev kit 8u77 in website you gave, only 8u91-8u92 should I download?

At the time that tutorial was edited, 8u77 was the latest version, it is perfectly ok to obtain the latest. Thanks!
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:54pm On May 01, 2016
Sugarhugs:



Hi, good evening, I CNT see java dev kit 8u77 in website you gave, only 8u91-8u92 should I download?

At the time that tutorial was written, 8u77 was the latest version, it is perfectly ok to obtain the latest. Thanks!
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:56pm On May 01, 2016
MuhdG:

java is very similar to c++

That's correct little bro just like C++ and C#, it's a C-based language.
Re: Learning To Program With Java by the Fulaman by Nobody: 10:43pm On May 01, 2016
Fulaman198:


At the time that tutorial was written, 8u77 was the latest version, it is perfectly ok to obtain the latest. Thanks!
.

Thanks smiley

1 Like

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 11:04pm On May 01, 2016
Sugarhugs:
.

Thanks smiley

No problem smiley
Re: Learning To Program With Java by the Fulaman by Nobody: 2:53am On May 02, 2016
smiley

1 Like

Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 7:48am On May 02, 2016
Gudmrning Fulaman, plz i will u show me how to create an

1. input box in java and

2. Declaring a java header (a link to d article might do)
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 8:01am On May 02, 2016
ANTONINEUTRON:
Gudmrning Fulaman, plz i will u show me how to create an


1. input box in java and


2. Declaring a java header (a link to d article might do)

Greetings little bro, can you please be more specific about input boxes are you talking about in a GUI?

What do you mean declaring a Java header. Please be more specific. Thanks!
Re: Learning To Program With Java by the Fulaman by Nobody: 8:59am On May 02, 2016
Fulaman198:


Greetings little bro, can you please be more specific about input boxes are you talking about in a GUI?

What do you mean declaring a Java header. Please be more specific. Thanks!


Hi smiley, good morning, I saw online that one should learn HTML and CSS before moving to java?
Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 9:33am On May 02, 2016
Fulaman198:


Greetings little bro, can you please be more specific about input boxes are you talking about in a GUI?

What do you mean declaring a Java header. Please be more specific. Thanks!


1.An Input box where users can insert/write down values, words e.t.c.


2. All those declarations done(import.Util, public class{}, string[args] e.t.c) i don't understand how they work, i will like to read an article on it. A link will do
Re: Learning To Program With Java by the Fulaman by Nobody: 12:39pm On May 02, 2016
DONE.

Re: Learning To Program With Java by the Fulaman by Nobody: 1:05pm On May 02, 2016
Fulaman198:


That's correct little bro just like C++ and C#, it's a C-based language.
i'm learning c++ on my own cheesy
when am done with it.. i'll go to python or java
Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 3:55pm On May 02, 2016
Diz is my answer...

Public class FulamanAssignment{
public static void main(string[]) {
string user = JOptionpane.ShowinputDialog(frame, "please enter a value"wink;

do{
string Converting_CM = JOptionpane.ShowinputDialog(frame, "Please enter a number you'd like to convert from CM to INCH"wink;
While(Converting_CM >= 0) {
float New_Inch_Value = Converting_CM * 0.4;
/* 1 divide 2.54 i.e value of cm to inch*/
System.Out.PrintIn(+Converting_CM+"Cm in INCH is"+New_Inch_Value+);
}
}While(user = 1);

do{
string converting_Metres = JOptionpane.ShowinputDialog(frame, "Please enter a number you'd like to convert from Metres to Feet"wink;
while(converting_Metres >= 0){
float Feet_Value = converting_Metres * 3.28;
System.Out.PrintIn(+converting_Metres+ "Metres in Feet is" +Feet_Value);
}
}While(user = 2)



...........T.B.C....

Check my next post.
Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 4:11pm On May 02, 2016
...Continue..?

do{
string Converting_Celsius = JOptionpane.ShowInputDialog(frame, "Please enter a number you'd like to convert from Celsius to Fahrenheit"wink;
while(Converting_Celsius >= 0){
float Fahrenheit_value = Converting_Celsius * 33.8;
/* 1 celsius = 33.8 fahrenheit*/
system.out.printIn(+Converting_Celsius+ " Degrees Celsius in Fahrenheit is Fahrenheit_value);
}
}while(user = 3)

do{
string Naira = JOptionpane.ShowInputDialog(Frame, "Enter the number you'd like to convert from Naira to Euro"wink;
While(Naira >= 0){
float Euro = Naira * 227.96;
system.Out.PrintIn(+Naira+ "Naira is Equivalent to" +Euro);
}
} while(user = 4)

do{
system.exit(0);
} while(user=5)

That is my code Sir!!!! grin
Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 4:14pm On May 02, 2016
crotonite:
DONE.
Can i see sme of ur screenshot??
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 4:46pm On May 02, 2016
ANTONINEUTRON:



1.An Input box where users can insert/write down values, words e.t.c.


2. All those declarations done(import.Util, public class{}, string[args] e.t.c) i don't understand how they work, i will like to read an article on it. A link will do

We will get to that soon but if you want to read ahead, I'll link an article later
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 4:51pm On May 02, 2016
Sugarhugs:



Hi smiley, good morning, I saw online that one should learn HTML and CSS before moving to java?

Hello, that's optional miss. If you want to get into web development then sure, however there is no particular order for learning anything.

Java is a true object-oriented programming language HTML is a markup language and doesn't really teach one the concepts of programming.

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (16) (Reply)

Java Vs PHP: Which Has The Brightest Future? / What Are The Best Laptops For Programmers And Hackers?! / Sultan Akintunde Set For Guinness World Record For Longest Software Coding Time

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 46
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.