₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,611 members, 8,422,821 topics. Date: Monday, 08 June 2026 at 08:58 PM

Toggle theme

Satmaniac's Posts

Nairaland ForumSatmaniac's ProfileSatmaniac's Posts

1 2 3 4 5 6 7 8 9 10 (of 12 pages)

ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 2:06am On Apr 20, 2016
Fulaman198:
I will update this thread with a tutorial on iteration hopefully Friday or Saturday and have your assignments that you guys have submitted hopefully by Thursday. Iteration will cover for loops, do-while loops, and while loops. If you want, you can read ahead now before I do the tutorial and give you guys more practise assignments. Best of luck!
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.
ProgrammingRe: 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."wink;
weight = stdio.nextDouble();

if(weight<=6000l)
{
System.out.println("Your vehicle is class 1 GVWR or VIUS light duty."wink;
if(weight>=6001 && weight<=10000)
{
System.out.println("Your vehicle is class2 GVWR or VIUS Light Duty."wink;
}

}else if(weight>=10001 && weight<=14000 )
{
System.out.println("Your Vehicle is class3 GVWR or VIUS Medium Duty."wink;
}

else if(weight>=14001 && weight<=16000)
{
System.out.println("Your vehicle is class4 GVWR or VIUS Medium Duty"wink;

}

else if(weight>=16001 && weight<=19500)
{
System.out.println("Your vehicle is class5 GVWR Medium Duty"wink;
}

else if(weight>=19501 && weight<=26000)
{

System.out.println("your vehicle is class6 GVWR Medium Duty"wink;
}


else if(weight>=26001 && weight<=33000)
{

System.out.println("Your Vehicle is class7 GVWR or VIUS Heavy Duty"wink;
}

else if(weight>=33001)
{
System.out.println("Your vehicle is class8 GVWR && VIUS heavy duty"wink;
}



}
}


I am sorry for inconviniencing you, I hope to receive some tips advice and corrections that could improve the code. Thanking you in advance.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m):
Fulaman198:
This assignment must be tough for you guys. No one has turned it in yet.
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"wink;

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"wink;
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"wink;
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"wink;
break;

default: System.out.println("We don't give lower than C grade"wink;
break;
}



}


}
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 12:43pm On Apr 15, 2016
asalimpo:
if the op doesnt mind or his student ...

That statement creates a package - a group of related classes grouped together as a unit.
the package can be imported for use in other programs , facilitating code-reuse and avoiding name collision conflicts.
e.g if you have a class with the same name as a native class, you can differentiate yours and avoid confusing the compiler by placing yours in a package.

When compiled, a folder is created in the order of the package name. subfolders appear according to their
dot separation in the package name.
e.g
for the class SwitchUsage
in package
com.fullermannairalandtutorial
the following folder structure will be created com/fullermannairalandtutorials
with the class SwitchUsage in the last folder , fullermannairalandtutorials .


to use this class in other programs, you use the import statement.

like this:
import com.fullermantutorials.SwitchUsage -

if you are importing more classes but dont want to specify every class by name u , use the wildcard character:
e.g
you'll often see codes like this:
import java.util.*
That statement imports all the classes in the java.util package.

by convention , package names are specified in lowercase letters.
classes, in uppercase.
You can't create a package that begins with java - that name is reserved to avoid confusion and clashes with the pre-built java packages.
Just like the vigilante in the seasonal film "Arrow" you always come to the rescue. Thanks Oga asalimpo.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 12:41pm On Apr 15, 2016
Fulaman198:
Day 4 Assignment:

Read the following documentation in order to supplement what you have learned today from this tutorial:

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

Your assignments are as follows:

1. Write a Programme that takes the grade programme that was posted earlier today and transform it using the Switch statement. The resulting output should be the same as with the if, else if and else statements

2. Write a programme that asks the user to enter the weight of a vehicle in kg. 2.2 lbs = 1 kg in case you don't know. Based on the table below, write your programme. You can use either a Switch statement or an if statement. That's up to you, but personally for this problem I would use a Switch statement.
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?
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 10:51am On Apr 15, 2016
Fulaman198:
Alternatively, there is another way to write this programme. The alternative method to writing it is with a switch statement. The switch statement is another way to test conditional statements. The Switch statement works with byte, short, char and int primitive types. it also works with enum types which we will get to later, the String class and other classes capable of wrapping primitive types.

Let's say for instance that I would like to check the number of the month and correlate it to the proper month, how would I do that with a Switch statement? Very simply put like so:


package com.fulamannairalandtutorials;
import java.util.Scanner; //import a scanner object

public class SwitchUsage {
public static void main(String[] args) {
Scanner stdio = new Scanner(System.in );
int theMonth;

System.out.println("Please enter a numerical value for month" );
theMonth = stdio.nextInt();

switch(theMonth) {
case 1: System.out.println("The Month is January." );
break;

case 2: System.out.println("The Month is February." );
break;

case 3: System.out.println("The Month is March." );
break;

case 4: System.out.println("The Month is April." );
break;

case 5: System.out.println("The Month is May." );
break;

case 6: System.out.println("The Month is June." );
break;

case 7: System.out.println("The Month is July." );
break;

case 8: System.out.println("The Month is August." );
break;

case 9: System.out.println("The Month is Septembre." );
break;

case 10: System.out.println("The Month is Octobre." );
break;

case 11: System.out.println("The Month is Novembre." );
break;

case 12: System.out.println("The Month is Decembre." );
break;

default: System.out.println("You did not enter a valid number" );
break;
}

}
}
Care to explain the line of code in blue, up above?
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 7:39am On Apr 15, 2016
Fulaman198:
I made an edit to the original post, this post now has operators and their respective functions and what they do. Enjoy and good night!
Goodnight, and have a wonderful night. This switch and and if-else-if-else statements is quite a powerful stuff. I will have to read day4 tutorial again to make sure I have a good understanding of the topic at hand.

Thank you for taking time out of your busy schedule to see your students.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 5:22pm On Apr 14, 2016
Fulaman198:
Yes, I'll update this thread again soon. Don't worry.
It is nice hearing from you again. *Heave a sigh of relief* Keeps ears to the ground.
ComputersRe: How Do I Connect One Printer To Different Computers? by satmaniac(m): 12:05pm On Apr 14, 2016
[quote author=Fulaman198 post=44688293][/quote]Salam, in an sami dama dinga tunawa da dalibanka na JAVA. A wuni lafiya.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 3:50am On Apr 14, 2016
Fulaman198, I hope all is well at your end. It's just that this silence is so uncomfortable. We hope to hearing from you sir.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 3:08pm On Apr 12, 2016
asalimpo:
gosh.. see how happy these students are ..
Bubbling with joy to learn..
What is the op feeding them? weed and coffee? java beans and cannabis?
wink
Hahahaha.......so you funny like dis? Ewa Java ati igbo Oshogbo.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 9:00am On Apr 12, 2016
seunny4lif:
grin
Amen but dat thing dey confusing grin grin
Not with the way oga fulaman198 is putting us through. Have faith and remember that you could be able to spot the error in my code and it means you are learning well.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 8:48am On Apr 12, 2016
seunny4lif:
grin grin I dey battle OOP now
I know you will defeat OOP.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 8:44am On Apr 12, 2016
seunny4lif:
grin You are welcome Meself na beginner I be grin
I know but you don epp na.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 2:08am On Apr 12, 2016
satmaniac:
I got some books on JAVA last three weeks and I have been reading about JAVA as well as practicing it. I once take my problem to larisoft's thread where he talked about how to hire a good programmer. So, yes this is my first time programming. Why do you ask?
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 2:06am On Apr 12, 2016
Fulaman198:
Is this your first time programming in Java? Just asking before I go to sleep.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 1:57am On Apr 12, 2016
I can not quantify the happiness that swell in my heart right now. Finally, I am in luv, I never knew what it means to be in luv, until I met.... JAVA. Thanks for coming into my life JAVA. I will forever love you, oh my dear JAVA.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 1:52am On Apr 12, 2016
seunny4lif:
smiley
You try but writing programming in hand
It's a none going area
import java.until.Scanner
Now I know better, Thanks at seun4lif.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 1:00am On Apr 12, 2016
Fulaman198:
LOL sure no problem, you didn't do a bad job. You just made some syntactical errors that are easily addressed. As aforementioned, your logic is correct.
Yeah I have seen them and corrected all and the program compile fine. For the sake of forgetfulness, I will mark all the areas the errors are found in my code, so that I will be able to familiarise myself with such errors. Thank you for encouraging me.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 12:34am On Apr 12, 2016
Fulaman198:
I think you know why your programme won't compile. Just curious do you have a compiler to test the code? It looks like it was written by hand without actually going through the compilation process. There are lots of bugs caused by syntax errors. Your logic is correct, but the code needs some minor corrections. Sorry, I'm a stern and tough grader.
It is true I was using my techno H5 with a partially broken screen, at that time. It is difficult to type out the characters on the screen, at times I need to turn the phone in order to change the screen orientation, so as to get to type some characters. My system is up now, I will compile after the correction, then I will report back here sir. Permission to fall out sir.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m):
Fulaman198:
Today was a rather short lesson on input and output and further information on the JVM. In the next tutorial, We are going to be learning about Conditional Statements (if - else if - else) and switch and we will be writing a programme that involves the utilisation of conditional statements.

As for your assignment, I would like for you to write a programme that prompts a student user for their name, and 4 test scores. With the information gained from the 4 test scores, I would like for you to calculate the median (average) of the 4 test scores and output it back to the user alongside their name.

Example: "Onyewu, your average test score is 84.8" for the output. Please use type double for the test scores and not int. Thank you!
impport java.util.Scanner //wrong spelling of import.

public class TestScores

{

public static void main(String[]args)

{
String name;
double engScr,mathScr,phyScr,chemScr;
double average ; // I really don't know why, I just assign a value of 0.0 to it. Probably, seen somewhere.
Scanner stdio = new Scanner(System.in)
;
System.out.println("Enter your name pls"wink;
name = stdio.nextLine();
System.out.println("Pls, enter your English test
score"wink;
// The out println statement should be on one single line.
engScr = stdio.nextDouble();

System.out.println("Pls, enter your Math test Score"wink;
mathScr = stdio.nextDouble();

System.out.println("Pls, enter your Physics
score"wink;
//Should all be in one single line.
phyScore = stdio.nextDouble(); // phyScore did not match the declared phyScr

System.out.println("Pls, Enter your Chemistry
score"wink;
// Have to be on single line.
chemScore = stdio.nextDouble(); //chemScore did not match the declared chemScr

average = (engScr + mathScr + phyScr chemScr)/4 // Forget to end it with a semicolon(wink


System.out.println("Welcome" + name + "Your
average score is" + average);
// Should be on single line and no semicolon(wink





}
}

Looking forward to corrections from all.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 5:26pm On Apr 11, 2016
Fulaman198:
It's correct although you used different values than what was assigned. Good job though regardless.
I was just excited at the way you are literally putting java concept into our skulls that I couldn't see the variable values given by you. Anyway, It's been taken care of.
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m):
public class MultiAdd
{

int num1 = 80;

int num2 = 1010;

public static void main(String[]args)

{

addigit = num1 + num2;

multdigit = num1 * num2;

System.out.println(addigit);

System.out.println(multdigit);







}

}

Modified
Nairaland GeneralRe: Special Codes To Format Text On Nairaland by satmaniac(m): 10:40pm On Apr 10, 2016
FARM LAND
ProgrammingRe: Learning To Program With Java by the Fulaman by satmaniac(m): 4:42pm On Apr 08, 2016
How did you make this so simple? God thank you for showing me this thread. Thank you fulaman!
ProgrammingRe: How To Hire Good Programmers In Nigeria (an Experience Based Article) by satmaniac(m): 5:18pm On Apr 03, 2016
asalimpo:
because there is no package "java.util.math"

there is also no package named "java.lang.math"
what you have is a class "Math" in package "java.lang" . its full canonical name is "java.lang.Math"
Oh... got it man. Thanks!
ProgrammingRe: How To Hire Good Programmers In Nigeria (an Experience Based Article) by satmaniac(m): 3:18pm On Apr 03, 2016
Grateful for your contributions, it worked after implementing what you recommended. However, I will want to know why it didn't work even after using "import java.util.math". I mean why would "import java.lang.math" work and "java util.math" refused to work?
@asalimpo I will make sure I do that as it will save me needless headache.
ProgrammingRe: How To Hire Good Programmers In Nigeria (an Experience Based Article) by satmaniac(m): 1:43am On Apr 01, 2016
dhtml18:
and also save him from committing suicide. . .
Hehehehe.......Suicide indeed. The thing frustrate sotay I come dey reason am say na one old witch dey responsible oh. This my African mindset sef.
ProgrammingRe: How To Hire Good Programmers In Nigeria (an Experience Based Article) by satmaniac(m): 12:47am On Apr 01, 2016
@asalimpo, dhtml18, and larisoft, I am very grateful of your kindness and generosity and I am also sorry for posting it here instead of creating a thread. Make una no vex, una know say for programming una be elders and me be una last born. Una kukuma know say last born tend to misbehave sometime, so, make una no binu oh.

Judging by your responses, I have no single doubt that I am in good and capable hands. Thanks, once again, elder broses.

Now, let me go try it out, I will report what transpire ASAP.
ProgrammingRe: How To Hire Good Programmers In Nigeria (an Experience Based Article) by satmaniac(m): 2:08am On Mar 31, 2016
larisoft:
I will really appreciate the input of senior developers on this forumn on their hiring experiences in Nigeria, as well as steps in this article they do not agree with.
Hello larisoft, your post is one of the few posts I enjoy reading on Nairaland, especially, here in the programming section. Although, this piece may not be of use to me, as I am just starting out as a beginner in programming, That will not deny me the privilege of accessing your assistance and that of other programming gurus here. In my quest to learn programming, I picked Java and I have been quietly studying some books as well as watching some videos I got from the internet and off course, I put what I learnt into practice. As you know, a beginner like me will encounter some hitches or challenges in the form of errors in my written codes, I am currently having issues with my java class methods.

The problem is that I have been trying to no avail, to make my java class method work. For example, the math class like Math.random(); or Math,sqrt(); refuses to work and have been displaying this error: "Can not find symbol System,out.println(Math.random(number)); Symbol: random(int) Location: class Math " I really need to know why it is displaying this error. Below is the entire code:


public class Math
{
public static void main(String[]args)
{
int x = 100;

System.out.println(Math.random(x));

//System.out.println(Math.sqrt(x));
}
}

This error is driving me nuts, save my sanity........

Ccc larisoft, dhtml18, seunthomas, Danielthegeek, asalimpo and others.

1 2 3 4 5 6 7 8 9 10 (of 12 pages)