Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,120 members, 7,818,359 topics. Date: Sunday, 05 May 2024 at 01:24 PM |
Nairaland Forum / Satmaniac's Profile / Satmaniac's Posts
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 12 pages)
Programming / 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. |
Programming / 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 |
Programming / 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); } } |
Programming / Re: Things I Wish I Knew Before Releasing My First App by satmaniac(m): 3:56pm On Jun 05, 2016 |
larisoft: You got mail. |
Programming / Re: Things I Wish I Knew Before Releasing My First App by satmaniac(m): 8:27am On Jun 05, 2016 |
larisoft: E be like say you know no say your name dey on your blog o. Abi you think say people no dey read your sense making article on your potentials filled blog? I go soon flash you Na joke o. However I got a coding problem and it seem this is the perfect opportunity to lay bare the problem to you, but I don't know what is wrong with nairaland PM, for I have tried PMing you and for some unknown reasons I couldn't get to type into the text field on the PM page. 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:10pm On Jun 01, 2016 |
ANTONINEUTRON see wetin u don cause? Now him wan push bone come give us. Fear don catch me already. Fulaman198: |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 2:17pm On May 31, 2016 |
ANTONINEUTRON: Why you come dey open teeth? Abi you wan show our tisha(Fulaman198) say you get strong teeth scatter bones and hard 'pomo'? Oga tisha, no look this guy big and strong teeth come give us hard pomo(assignment) o, as I no follow get that kind teeth o. if na lie check am see? na emmpty oo! |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 1:57pm On May 31, 2016 |
Fulaman198: Will appreciate it oo. As I am typing on my tecno h5 phone, my eyes glued to lesson 4 page I opened on the screen of my 15th century Nigerian laptop. Let me know if I am ready to join you guys in lesson 6, pls. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:03am On May 30, 2016 |
You made it looked so easy, but I am sure the assignment is definitely going to be as tough as poorly cook 'pomo', but I like that. And I will like to hear what you think about the corrected version of assignment I submitted. Do I need to go back to lesson 4? |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 12:02am On May 29, 2016 |
Fulaman198: No wahala bro, I and I guess others too know how busy you are. |
Phones / Re: Best Data Plan Comparison Between MTN Etisalat Airtel GLO by satmaniac(m): 9:29am On May 24, 2016 |
DjAndroid: |
Politics / Re: Goodluck Jonathan Visits Nigerians In Newark, New Jersey, Us(photos) by satmaniac(m): 8:54am On May 24, 2016 |
Abagworo: |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:58am On May 11, 2016 |
Sugarhugs: Blasphemy!!! How dare you call a serial 'impregnator' innocent? Is that how innocent you are ? |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:45am On May 11, 2016 |
Fulaman198: Aha got it....project tinz. Remember rest is also a weapon against sickness. 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 5:41am On May 10, 2016 |
ANTONINEUTRON: Good morning everybody Oya make una wake up, I see teacher dey come class. Shebi na 2day in dey teach us arrange....sorry...erm...wetin be the name self....hit head and stamp feet on the ground...Ok now I don get am. Array. So dis guy too don tey for the game. Thumb up bro. Come o! This one wey our teacher never show face so, hope say that fine lady never carry her feet match our teacher face o Bia, Sugarhugs, come explain yasef before we pronounce you guilty. You know say, the instruction was to put feet on his face, no go match our oga face o |
Politics / Re: DSS Embarrass Ezeife And Pat Utomi In Awka by satmaniac(m): 9:14am On May 09, 2016 |
freeborn76: Dr freeborn76 don find the problem o, make una kuku go find solution to una problem Ezeife talk something and una just believe say na wetin happen be that? Una need cure for this una hatred. 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:40am On May 09, 2016 |
And the assignment 2 Day 5, I hope I dey right: import java.util.Scanner; import java.lang.Math; public class Guess{ public static void main(String[]args){ int count = 0; int numberGuessed = 0; int randomNumber = (int)((Math.random() * 100) + 1); Scanner stdio = new Scanner(System.in); while(numberGuessed!=randomNumber){ System.out.println("Please guess a number between 1 and 100" numberGuessed = stdio.nextInt(); count++; } System.out.println("You win! After" + " " + count++ + " " + "times" ); } } |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:31am On May 09, 2016 |
Alternatively, using if-else-if-else flow control statement, assignment 1 Day 5 will look like this: import java.util.Scanner; public class HelloWorld{ public static void main(String[]args){ int selectedConversionUnit = 0; int tries = 0; double centemeter; double cmresult; double metres; double ftresult; double celsius; double clresult; double naira; double nrresult; Scanner stdio = new Scanner(System.in); while(selectedConversionUnit>=0){ System.out.println("please enter a value here:" selectedConversionUnit = stdio.nextInt(); tries++; if(selectedConversionUnit==1){ System.out.println("Enter your value in centemeter here:" centemeter = stdio.nextDouble(); cmresult = centemeter/2.54; System.out.println(centemeter+ " " + " equivalent in inch is " + " " + cmresult + "inches " } else if(selectedConversionUnit==2){ System.out.println("Enter your value in metres here:" metres = stdio.nextDouble(); ftresult =metres/3.28; System.out.println( metres + "equivalent in feet is: " + " " + ftresult + "feets" ); } else if(selectedConversionUnit==3){ System.out.println("Enter your value in Celsius here:" celsius = stdio.nextDouble(); clresult = 32+(9/5)*celsius; System.out.println(celsius + " " + " equivalent in fahreinheits is " + " " + clresult +" " + "fahreinheits." } else if(selectedConversionUnit==4){ System.out.println("Enter your value in Naira:" naira = stdio.nextDouble(); nrresult = naira/227.96; System.out.println(naira + " " + "equivalent in euro is " + " " + nrresult + " " + "euros" }else if(selectedConversionUnit==5){ System.exit(0); } } } } Sorry o! I don develop some kind of bias towards if-else-if-else control statement, so, include am |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:26am On May 09, 2016 |
Fulaman198: I am sorry @crotonite, for I am the one holding us back. I finished the corrections based on the advice of oga Fulaman198, since yesterday. I will hasten to post them one after the other, in a separate post, so we could move ahead. Oga, Fulaman198, here is assignment 1 Day 5: import java.util.Scanner; public class Convert{ public static void main(String[]args){ int count=0; int selectedConversionUnit = 0 ; double centimeter; double celsius; double naira; double meter; Scanner stdio = new Scanner(System.in); while(selectedConversionUnit>=0) { System.out.println("Please enter a digit here:" selectedConversionUnit = stdio.nextInt(); count++; switch(selectedConversionUnit){ case 1: System.out.println("Please enter a value in centimeter here:" centimeter = stdio.nextDouble(); System.out.println(centimeter + " " + "Equivalent in inches is:" + " " + centimeter/2.54 + "inches" break; case 2: System.out.println("Please enter a value in meter here:" meter = stdio.nextDouble(); System.out.println(meter + " " + "Equivalent in feets is:" + " " + meter/3.28 + "feets" break; case 3: System.out.println("Please enter a value in Celsius here:" celsius = stdio.nextDouble(); System.out.println(celsius + "C" + " " + "Equivalent in fahreinheits is:" + " " + 32+(9/5)*celsius + "fahreinheits" break; case 4: System.out.println("Please enter a value in Naira here:" naira = stdio.nextDouble(); System.out.println( naira + "Naira" + " " + "Equivalent in Euros is:" + " " + naira/227.96 + "euros" break; case 5: System.exit(0); break; default: } } } } 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 11:08am On May 07, 2016 |
Fulaman198, sir, how can I implement a code that will tell me the number of times the user guessed before getting it right? I tried using count++ and I know it is wrong, otherwise, my code seems to run well for me here. I tested it by reducing the range from 1-5 instead of the one given and it work well. I will appreciate if you point out anything that is missing or not right in the codes. Thanks. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 10:56am On May 07, 2016 |
[center]Assignment 2 Day 5[/center] import java.util.Scanner; import java.lang.Math; public class Guess{ public static void main(String[]args){ int count = 0; int enter; int rndm = (int)((Math.random() * 100) + 1); Scanner stdio = new Scanner(System.in); while(count<=100){ System.out.println("Please guess a number between 1 and 100" enter = stdio.nextInt(); count++; if(enter==rndm){ System.out.println("You win! You got it after" + " " + count++ + " " + "attempts" }else{ System.out.println("Wrong guess" } } } } |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 10:46am On May 07, 2016 |
Here is the Assignment 1 using Switch control statement: import java.util.Scanner; public class Convert{ public static void main(String[]args){ int count=0; int enter ; double centimeter; double celsius; double naira; double meter; Scanner stdio = new Scanner(System.in); while(count<=4) { System.out.println("Please enter a digit here:" enter = stdio.nextInt(); count++; switch(enter){ case 1: System.out.println("Please enter a value in centimeter here:" centimeter = stdio.nextDouble(); System.out.println(centimeter + " " + "Equivalent in inches is:" + " " + centimeter/2.54 + "inches" break; case 2: System.out.println("Please enter a value in meter here:" meter = stdio.nextDouble(); System.out.println(meter + " " + "Equivalent in feets is:" + " " + meter/3.28 + "feets" break; case 3: System.out.println("Please enter a value in Celsius here:" celsius = stdio.nextDouble(); System.out.println(celsius + "C" + " " + "Equivalent in fahreinheits is:" + " " + 32+(9/5)*celsius + "fahreinheits" break; case 4: System.out.println("Please enter a value in Naira here:" naira = stdio.nextDouble(); System.out.println( naira + "Naira" + " " + "Equivalent in Euros is:" + " " + naira/227.96 + "euros" break; case 5: System.exit(0); break; default: } } } } |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:11am On May 06, 2016 |
Fulaman198: I corrected it and it is now working perfectly, I am going to post it and I hope this time, it is going to earn me pass mark So, it is now official that I have been demoted to class....erm...Day 4. I been dey think say nobody smart pass me, but now I know a lot of people are. crotonite, well done o! I go soon sabi pass you Rush back to SS4....erm...class4....sorry, I mean assignment4, before senior crotonite comot im koboko Abeg Sugarhugs will you do us a favour and cover your feet in those pair of black ninja socks? Make our teacher no go use feet do topic for Day7 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:29am On May 05, 2016 |
Fulaman198: Thanks a lot for the advice. About not incrementing tries, I did increment tries in the first assignment. Perhaps the spacing of the codes is too compact that you missed it, it is on the third statement inside the while block. Also, I tried using switch control statement and I have errrors on my compiler, whenever I compiled it, hence, I decided to use if-else-if control statement and it compiled and run without error. However, I will still try using the switch control statement and when it compile well, I will post it here too. On the second assignment, I compiled it too and it did not show me any error, but since I run the programme, I was not able to guess the correct answer, that is the value entered has not match the randomly generated number till now. So,it seem the problem I may be having is not with the syntax, maybe, logical problem. I will not pretend and act as if I understand what you said about not wanting to initialise my count to 0. If you don't mind could you throw more light on it? I mean why would I initialise tries to 0 in assignment 1 and can not do the same in assignment 2? About posting my assignment on a separate comment, this is a mistake I will never repeat again. Thanks. [size=10]MODIFIED[/size I checked the code I posted here on nairaland and I discovered that there are a lot of mistake mistake in it, especially, the concatenation. So, the compiler will definitely call out the errors. So, here is the code as it is on my notepad++ text editor: import java.util.Scanner; public class HelloWorld{ public static void main(String[]args){ int enter; int tries = 0; double centemeter; double cmresult; double metres; double ftresult; double celsius; double clresult; double naira; double nrresult; Scanner stdio = new Scanner(System.in); while(tries<=5){ System.out.println("please enter a value here:" enter = stdio.nextInt(); tries++; if(enter==1){ System.out.println("Enter your value in centemeter here:" centemeter = stdio.nextDouble(); cmresult = centemeter/2.54; System.out.println(centemeter+ " " + " equivalent in inch is " + " " + cmresult + "inches " } else if(enter==2){ System.out.println("Enter your value in metres here:" metres = stdio.nextDouble(); ftresult =metres/3.28; System.out.println( metres + "equivalent in feet is: " + " " + ftresult + "feets" ); } else if(enter==3){ System.out.println("Enter your value in Celsius here:" celsius = stdio.nextDouble(); clresult = 32+(9/5)*celsius; System.out.println(celsius + " " + " equivalent in fahreinheits is " + " " + clresult +" " + "fahreinheits." } else if(enter==4){ System.out.println("Enter your value in Naira:" naira = stdio.nextDouble(); nrresult = naira/227.96; System.out.println(naira + " " + "equivalent in euro is " + " " + nrresult + " " + "euros" }else if(enter>=5){ } } } } |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 3:46pm On May 04, 2016 |
Fulaman198: First assignment Day 5 import java.util.Scanner; public class Converter{ public static void main(String[]args){ int enter; int tries = 0; double centemeter; double cmresult; double metres; double ftresult; double celsius; double clresult; double naira; double nrresult; Scanner stdio = new Scanner(System.in); while(tries<=5){ System.out.println("please enter a value here:" enter = stdio.nextInt(); tries++; if(enter==1){ System.out.println("Enter your value in centemeter here:" centemeter = stdio.nextDouble(); cmresult = centemeter/2.54; System.out.println(centemeter+ " " " equivalent in inch is " + " " + cmresult + "inches " } else if(enter==2){ System.out.println("Enter your value in metres here:" metres = stdio.nextDouble(); ftresult =metres/3.28; System.out.println( metres + "equivalent in feet is: " + " " + ftresult + "feets" ); } else if(enter==3){ System.out.println("Enter your value in Celsius her:" celsius = stdio.nextDouble(); clresult = 32+(9/5)*celsius; System.out.println(celsius + " equivalent in fahreinheits is "clresult +" " + "fahreinheits." } else if(enter==4){ System.out.println("Enter your value in Naira:" naira = stdio.nextDouble(); nrresult = naira/227.96; System.out.println(naira + "equivalent in euro is "nrresult + " " + "euros" }else if(enter>=5){ } } } } Solution to Assignment 2 Day 5 import java.util.Scanner; import java.lang.Math; public class Guess{ public static void main(String[]args){ int count = 0; double rndm = (int)((Math.random() * 100) + 1); Scanner stdio = new Scanner(System.in); while(count<=100){ System.out.println("Please guess a numbber between 1 and 100" count = stdio.nextInt(); count++; if(count==rndm){ System.out.println("You wint it took you" + count++ + "times to get it right" }else{ } } } } Advice, tips, and everything that can improve my codes will be appreciated, thanks Fulaman198. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 12:58am On Apr 29, 2016 |
Fulaman198: We re grateful sir. We are gradually progressing in this journey |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 2:06am On Apr 20, 2016 |
Fulaman198: It's all right, I understand how busy you are I mean I.can see that your last comment was posted at 11:01pm and before that you posted 8:45pm. I know a lot of thread that lack of time killed, but, you still manage to take us this far, we know we are approaching page 5 now and still have a long way to go. I want you to know that we know how difficult a journey it is and we are with you to the end. May God bless and balance you. Thank you once again, Fulaman198. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 1:42pm On Apr 17, 2016 |
My second assignment our teacher Fulaman198 please check it up. import java.util.Scanner; class FleetWeight { public static void main(String[]args) { double weight; Scanner stdio = new Scanner(System.in); System.out.println("Please enter your vehicle weight in lbs." weight = stdio.nextDouble(); if(weight<=6000l) { System.out.println("Your vehicle is class 1 GVWR or VIUS light duty." if(weight>=6001 && weight<=10000) { System.out.println("Your vehicle is class2 GVWR or VIUS Light Duty." } }else if(weight>=10001 && weight<=14000 ) { System.out.println("Your Vehicle is class3 GVWR or VIUS Medium Duty." } else if(weight>=14001 && weight<=16000) { System.out.println("Your vehicle is class4 GVWR or VIUS Medium Duty" } else if(weight>=16001 && weight<=19500) { System.out.println("Your vehicle is class5 GVWR Medium Duty" } else if(weight>=19501 && weight<=26000) { System.out.println("your vehicle is class6 GVWR Medium Duty" } else if(weight>=26001 && weight<=33000) { System.out.println("Your Vehicle is class7 GVWR or VIUS Heavy Duty" } else if(weight>=33001) { System.out.println("Your vehicle is class8 GVWR && VIUS heavy duty" } } } I am sorry for inconviniencing you, I hope to receive some tips advice and corrections that could improve the code. Thanking you in advance. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:03am On Apr 17, 2016 |
Fulaman198: I did some googling and discovered that the if-else and else-if control statement can be used for range of values as well as single values. For example, 1-99.99,100-199.99 and so on. On the other hand, according to the tutorial I have gotten from the result of the search I did, the SWITCH control statement can only be use for a definite values, hence can't be use for range of values. Now I am thinking of how to control the flow of execution using the switch in number range of such a large range. Imagine me using switch statement for a range as large as 6001-10000lbs, when it can't not be used for range of values. How possible is that? Anyway, you gave us option of using either Switch or if-if-else-else-if, with you preferring us using the switch. So, I will turn my assignment in using the if-if-else-else-if statement and hope you show us a way to use the switch statement on very large range of values. This is my dilemma. import java.util.Scanner; class SwitchScore { public static void main(String[]args) { int scores; Scanner stdio = new Scanner(System.in); System.out.println("Please, enter your score here" scores = stdio.nextInt(); switch(scores) { case 70: case 71: case 72: case 73: case 74: case 75: case 79: case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: case 100: System.out.println("You got an A" break; case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: System.out.println("You got a B" break; case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: System.out.println("You got C" break; default: System.out.println("We don't give lower than C grade" break; } } } |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 12:43pm On Apr 15, 2016 |
asalimpo: Just like the vigilante in the seasonal film "Arrow" you always come to the rescue. Thanks Oga asalimpo. |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 12:41pm On Apr 15, 2016 |
Fulaman198: This one strong o! See as I just dey sweat on top the assignment and still I am not making any headway. I have been having this illegal-start-of-an-expression error on my compiler. Hmm could it be that our teacher is trying to drive home some points about the difference in using the switch and the if-else-ifelse? Who don succeed make e come give me expo na. Or are we allowed to used google to helep solve this issue, our teacher Fulaman198? 1 Like |
Programming / Re: Learning To Program With Java by the Fulaman by satmaniac(m): 10:51am On Apr 15, 2016 |
Fulaman198: Care to explain the line of code in blue, up above? |
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 12 pages)
(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. 149 |