Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,525 members, 7,954,984 topics. Date: Saturday, 21 September 2024 at 01:38 PM |
Nairaland Forum / Science/Technology / Programming / Learning To Program With Java by the Fulaman (43067 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) ... (9) (10) (11) (12) (13) (14) (15) (Reply) (Go Down)
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 8:59am On Jun 06, 2016 |
ANTONINEUTRON: Well I'm not going to give you a solution yet, but for starters there is no printIn method in the System class, it is println (or print line or print ln) it's a lowercase L instead of an I. |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:02am On Jun 06, 2016 |
korlahwarleh: It's correct (briefly skimmed through it, but looks great), nicely done, you kind of took it a step further and instead asked the user for the number of tests they would ideally like to work it. Good job for going the extra km. |
Re: Learning To Program With Java by the Fulaman by ANTONINEUTRON(m): 3:07pm On Jun 06, 2016 |
Fulaman198:Ok |
Re: Learning To Program With Java by the Fulaman by Booyakasha(f): 3:17pm On Jun 06, 2016 |
nice job fulaman.. i love what you're doing, you should definitely be rewarded, but this is not how to teach sorry.. |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 4:12pm On Jun 06, 2016 |
Booyakasha: Ok, how would you teach then? |
Re: Learning To Program With Java by the Fulaman by Booyakasha(f): 7:16pm On Jun 06, 2016 |
Fulaman198:lol, nevermind, i know it's not your fault, ŇL lacks code formatting functionality.. anyway, I'll love it if you become part of this great community i created.. |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:40pm On Jun 06, 2016 |
Booyakasha: Which community is that? |
Re: Learning To Program With Java by the Fulaman by Nobody: 8:22pm On Jun 06, 2016 |
Booyakasha: It is 1 Like |
Re: Learning To Program With Java by the Fulaman by Booyakasha(f): 9:13pm On Jun 06, 2016 |
Fulaman198: crotonite:I'll mention you guys in 30 minutes stay tuned.. 1 Like |
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 9:31pm On Jun 06, 2016 |
Booyakasha:Abeg, mention me too ooo |
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 7:33am On Jun 07, 2016 |
Fulaman198: I did something nearly similar to Korlahwole,s codes, the first day you posted the assignment, but, I was not sure if I it was correct, for, I reasoned what if the user of the programme entered numbers that are less than zero, say three times, when the programme can not iterate more than than the array size, in this case Scores.length? That means the scores entered will not be up to ten, if you minus the wrong scores entered. As a result of this problem I wasted time looking for a way to do it better. Is there a way someone can write the programme, to accommodate such or more wrong entries from the user? Because, I tried and was having a RuntimeException- array-out-of-index error. The initial code below: I had to modify the codes as it, it didn't work as expected, But this does. Sir Fulaman198 pachman make una help me touch light am import java.util.Scanner; public class Array{ public static void main(String[]args){ int i=0; int[]Scores; double average=0; int total=0; System.out.println("This program collect Scores of students in ten subjects and also display their average." Scores = new int[10]; Scanner stdio = new Scanner(System.in); for(i=0;i<Scores.length;i++){ System.out.println("Please enter Test Score" + i + ":" Scores[i] = stdio.nextInt(); if(Scores[i]<=-1 & Scores[i]>100){ System.out.println("Score is less than zero, or greater than 100, please, enter a valid score!" Scores[i]--; } Scores[i]++; total+=Scores[i]; } average=total/Scores.length; System.out.println("Your average is:" + " " + average); } } |
Re: Learning To Program With Java by the Fulaman by Nobody: 8:39pm On Jun 07, 2016 |
satmaniac: You tried very well.. Thumbs up but it would gv a logical error if the user inputs three values less than 3.. Look at inside the while statement that I would put into for loop import java.util.Scanner; public class Array{ public static void main(String[]args){ int i=0; int[]Scores; double average=0; int total=0; System.out.println("This program collect Scores of students in ten subjects and also display their average." Scores = new int[10]; Scanner stdio = new Scanner(System.in); for(i=0;i<Scores.length;i++){ System.out.println("Please enter Test Score" + i + ":" Scores[i] = stdio.nextInt(); //you should use || and not &&.. while (Scores[i]<=-1 || Scores[i]>100){ System.out.println("Score is less than zero, or greater than 100, please, enter a valid score!" Scores[i]=stdio.nextInt(); } total+=Scores[i]; } average=total/Scores.length; System.out.println("Your average is:" + " " + average); } } |
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:19pm On Jun 07, 2016 |
pachman: Looking at your while loop block, I have no doubt it will work. Initially, the lack of the count increment, almost got me confused, as that is what will render the condition in the while braces false at a point in the program, thereby terminating the iteration. I later realised that if the value you enter is not less than zero nor greater than 100, the condition in the while loop braces will rendered the input as false. Thank you very much pachman, you really save someone sanity. I have been on this for days now. Thank ya @ pachman(try change dat name to packwoman). Are you also a beginer like me? 1 Like |
Re: Learning To Program With Java by the Fulaman by Nobody: 9:49pm On Jun 07, 2016 |
satmaniac:Lol,am also a beginner,just started classes and objects but i would start following op,he explains well,i have even saved his page sef |
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 10:27pm On Jun 07, 2016 |
pachman: I tried modifying my code to reflect yours, but, the loop no want stop. It seem what I suspected initially was correct. Sharp guy! You don enter Classes ans Objects? Nawa 4 u o. |
Re: Learning To Program With Java by the Fulaman by Nobody: 10:41pm On Jun 07, 2016 |
satmaniac:Lol,i didnt start here,i started on my own but i would keep following |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 12:42am On Jun 08, 2016 |
satmaniac: You are right his code won't work because he used a while loop instead of an if conditional statement. @pachman, did you happen to test your code. If you change one thing, it would work fine. |
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:17am On Jun 08, 2016 |
Fulaman198: I did it! I can feel it! Yes! Yes! OMG! I will modify my comment cotaining the codes. Kai kai! Fulaman198 is a good teacher. |
Re: Learning To Program With Java by the Fulaman by Nobody: 11:22am On Jun 08, 2016 |
Fulaman198:What i want is for the user to keep inputting the value until the user inputs the right value,while (user enter wrong value){enter the value again until he enters it right} I havent tested the code though,but av used this method before |
Re: Learning To Program With Java by the Fulaman by Nobody: 7:33pm On Jun 08, 2016 |
Booyakasha: @fulaman198 i was reading a programming textbook and i came across something like this: if(0 >= val ){...} instead of if(v <= 0){...} is there any advantange to using their method of if test? |
Re: Learning To Program With Java by the Fulaman by Nobody: 9:33pm On Jun 08, 2016 |
crotonite:Both would work,it all depends on programming preference |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 11:43pm On Jun 08, 2016 |
crotonite: I prefer if (v <= 0){...} because it is better Programming vernacular (syntactically speaking) if that makes sense to you. Hardly do you ever see programmers use if ( 0 >= val ){...} It's always a test for of variable to rest of the expression. 1 Like |
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 9:47pm On Jun 09, 2016 |
Is this code correct? publick static void main(string[]args){ int user; user =18; if (user <= 18); System.out.println("user is 18 or younger" else { System.out.println("user is older than 18" } } if yes then why is eclipse telling me 'eles' has an exception? MODIFIED: SOLVED. |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:55pm On Jun 10, 2016 |
Guys one of my friends used Java as a means to parse some live data from the world bank site about forestation around the world. The data was parsed from a CSV file and put out in the form of an applet using the UnfoldingMaps API/library to illustrate the data in the csv file. I just wanted to show this to you to keep you motivated about some of the things you can do in Java. 3 Likes
|
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 10:57pm On Jun 11, 2016 |
Fulaman198:Thanks bro 1 Like |
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 11:04pm On Jun 11, 2016 |
Fulaman198: I have no idea what you are talking about, sounds like greek to me. Although from the picture, I can see that the guy did a great job, I mean the information he represented in image in the applets. Bro, as complete newbie wey we bee, correction go good for us, na dat one go take make our hand strong kakaraka for coding. Thanks for gingering us, it will soon lead to some goods and we appreciate your support. |
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 1:54am On Jun 12, 2016 |
am not following the lessons here though, but multi-dimensional array is giving me headache. |
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 2:30am On Jun 12, 2016 |
Collinz2: Yeah bro, I feel your pain. I remember when I was also learning arrays and arraylists. Na that multidimensional array wan kill me... But remember, when you're creating a multidimensional array, you're basically saying: Create -rows and -columns. Like this: int[][] x = new int[4] [3]; This statement will create an array of 4 rows and 3 columns. So if you want to like assign a value to the first row and third column, you say x[0] [3] = 25; This will assign the value 25 to the first row and third column. If you're also confused about rows and columns, check this out: I checked for the meaning of row in my dictionary and dis is what I got: A line of entries in a table, etc., going from left to right, as opposed to a column going from top to bottom So if I have some numbers like this, 0 1 2 3 4 5 6 7 8 9 What row and column is 7? Basically, we have just one row in this block. So to represent this in Java, we write num[0][8] which is equivalent to 7. I hope u understand sha. |
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 7:09am On Jun 12, 2016 |
Collinz2: I think we will do multi-dimensional arrays before discussing methods, classes, etc. 1 Like 1 Share |
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 9:20am On Jun 12, 2016 |
Fulaman198:Thats great. I kinda understand it but when i compile the code i got exception error so i skip it and when i get to exception i will return to it. One more thing, just like what pachman is asking. For instance using the indexOf to check for @ in an email, i wrote the code and add user input scanner and the if statement. If the user enter an email without the @ it wil return invalid email as i instructed java to do, so How do i tell java to tell the user to keep inputing the email until he got it correct. 1 Like |
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 1:50pm On Jun 12, 2016 |
Collinz2:You use a while loop |
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 5:53pm On Jun 12, 2016 |
hardebayho:i try manipulating the while loop even do while loop nothing happen, even when it work if i inser the right input it wil stil loop again. |
(1) (2) (3) ... (9) (10) (11) (12) (13) (14) (15) (Reply)
Sultan Akintunde Set For Guinness World Record For Longest Software Coding Time / What Are The Best Laptops For Programmers And Hackers?! / Basil Okpara Jr, Biography, Age, Nigerian Programmer Who Built 30 Mobile Games
(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. 106 |