Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,432 members, 7,781,263 topics. Date: Friday, 29 March 2024 at 11:26 AM

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

Nairaland Forum / Science/Technology / Programming / Learning To Program With Java by the Fulaman (40999 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) ... (10) (11) (12) (13) (14) (15) (16) (Reply) (Go Down)

Re: Learning To Program With Java by the Fulaman by Nobody: 8:45pm On Jun 12, 2016
Collinz2:
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.
What u should do is while(user input something wrong){ Ask user to input the value again,i=input.nextInt(); }

1 Like

Re: Learning To Program With Java by the Fulaman by Collinz2(m): 9:06pm On Jun 12, 2016
pachman:
What u should do is while(user input something wrong){ Ask user to input the value again,i=input.nextInt(); }
ok i'll try it out.
Re: Learning To Program With Java by the Fulaman by Nobody: 9:26am On Jun 13, 2016
Collinz2:
ok i'll try it out.
Did it work
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:00am On Jun 15, 2016
pachman:
Did it work


When I tried using while last time it didn't work, but after some modification this works exactly as I want it to.


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."wink;
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 + ":"wink;
Scores[i] = stdio.nextInt();
while(Scores[i]<=-1 || Scores[i]>100){
System.out.println("Score is less than zero, or greater than 100, please, enter a valid score!"wink;

Scores[i] = stdio.nextInt();

}
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: 10:27am On Jun 15, 2016
@Satmaniac,it works better dis way,we are really learning
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 11:13am On Jun 15, 2016
pachman:
@Satmaniac,it works better dis way,we are really learning


We have a good teacher in fulaman, basically, I will shout it from the roof top that we are in good hands.That is why, I always pray for his success in whatever he is doing, including teaching us.

You need to see my face whenever I am manipulating codes, pure joy and happiness unquantifiable. I have never taking anything intoxicating, but whenever I am doing our assignment people kind of think that I am intoxicated, because I am always happy, especially when I get the program to work the way I expect it to.

1 Like

Re: Learning To Program With Java by the Fulaman by satmaniac(m): 11:30am On Jun 15, 2016
Fulaman198:
Hello ladies and gentlemen, before I post the assignment, I wanted to know how many of you are using an IDE (e.g. Netbeans, Eclipse, IntelliJ, etc.) I wanted to demonstrate a fun but small GUI project for you guys to keep you all motivated to learn Java that I would have you guys do. But in order to do so, you guys need an IDE.

I personally recommend Netbeans: https://netbeans.org/features/java/index.html

But I don't care if you use Eclipse or IntelliJ

Eclipse - http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/keplersr1
IntelliJ - https://www.jetbrains.com/idea/#chooseYourEdition


I have downloaded the netbeans IDE. Hi all! if you don download your own, raise up your hand.
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 5:06pm On Jun 15, 2016
satmaniac:



I have downloaded the netbeans IDE. Hi all! if you don download your own, raise up your hand.
it seems netbeans has high priority over eclipse. The tut i learning from uses netbeans which has some features eclipse dont have.
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 9:33pm On Jun 16, 2016
Hello ladies and gentlemen, I wanted to take the time to apologise once again for my absence and know that I have not forgotten about any one of you. I have been so busy recently with all the stuff I'm working on and I just wanted to come in and check to make sure that people are still keeping active within the thread. I will try and grade some assignments this weekend. The reason I requested that you guys download an IDE is because pretty soon we will be venturing in on some graphical UI stuff with JavaFX. I recommend Netbeans because Netbeans is an IDE that comes integrated with JavaFX. Eclipse requires that you install some additional add-ons in order for it to work / function properly. In any case, I'll see you all soon. Have a wonderful evening/night!
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:51am On Jun 17, 2016
Collinz2:
it seems netbeans has high priority over eclipse. The tut i learning from uses netbeans which has some features eclipse dont have.

You don download am?
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 9:55am On Jun 17, 2016
Fulaman198:
Hello ladies and gentlemen, I wanted to take the time to apologise once again for my absence and know that I have not forgotten about any one of you. I have been so busy recently with all the stuff I'm working on and I just wanted to come in and check to make sure that people are still keeping active within the thread. I will try and grade some assignments this weekend. The reason I requested that you guys download an IDE is because pretty soon we will be venturing in on some graphical UI stuff with JavaFX. I recommend Netbeans because Netbeans is an IDE that comes integrated with JavaFX. Eclipse requires that you install some additional add-ons in order for it to work / function properly. In any case, I'll see you all soon. Have a wonderful evening/night!

Welcome back bro!
Re: Learning To Program With Java by the Fulaman by Tosinosu2011: 10:31am On Jun 17, 2016
package FareAndBalanced;

//Solution to 2009 World Finals Problem E: Fare and Balanced

import java.util.*;
import java.io.*;

public class fare {

final public static int NOPATH = 1000000000;

public static int[] minDist;
public static int[] maxDist;
public static int n;
public static edge[] roads;

public static int[] minDFromEnd;
public static int[] maxDFromEnd;

public static ArrayList[] graph;
public static ArrayList[] revGraph;

public static void main(String[] args) throws Exception {

BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer(stdin.readLine());
n = Integer.parseInt(tok.nextToken());
int e = Integer.parseInt(tok.nextToken());
int loop = 1;

// Process each case.
while (n != 0) {

roads = new edge[e];

// Read in graph.
graph = new ArrayList[n];
for (int i=0; i<n; i++)
graph[i] = new ArrayList<edge>();

// We also need edges stored in "reverse" order.
revGraph = new ArrayList[n];
for (int i=0; i<n; i++)
revGraph[i] = new ArrayList<edge>();

for (int i=0; i<e; i++) {
tok = new StringTokenizer(stdin.readLine());
int v1 = Integer.parseInt(tok.nextToken()) - 1;
int v2 = Integer.parseInt(tok.nextToken()) - 1;
int c = Integer.parseInt(tok.nextToken());
roads[i] = new edge(v1, v2, c, i+1);
graph[roads[i].v1].add(roads[i]);
revGraph[roads[i].v2].add(roads[i]);
}

minDist = new int[n];
maxDist = new int[n];
minDFromEnd = new int[n];
maxDFromEnd = new int[n];

boolean res = solve();

// Can't do it.
if (!res)
System.out.println("Case "+loop+": No solution"wink;

// Usual case.
else {

// Calculate number of roads to toll.
int numToll = 0;
for (edge x: roads)
if (x.toll > 0)
numToll++;

// Output each road with a toll.
StringBuffer sb = new StringBuffer();
sb.append("Case "+loop+": "+numToll+" "+maxDist[n-1]+"\n"wink;
for (edge x: roads)
if (x.toll > 0)
sb.append(x.ID+" "+ x.toll+"\n"wink;
System.out.print(sb);
}

// Get next case.
loop++;
tok = new StringTokenizer(stdin.readLine());
n = Integer.parseInt(tok.nextToken());
e = Integer.parseInt(tok.nextToken());
}
}

public static boolean solve() throws Exception {

// Pre-compute shortest and longest distances, from both residential area and downtown.
solveMinD(minDist, true);
solveMaxD(maxDist, true);
solveMinD(minDFromEnd, false);
solveMaxD(maxDFromEnd, false);

// Go through each road.
for (int i=0; i<roads.length; i++) {

int a = roads[i].v1;
int b = roads[i].v2;
if (minDist[a] == maxDist[a] && minDist[b] != maxDist[b] && maxDist[n-1] - maxDist[a] != roads[i].c + maxDFromEnd[b])
roads[i].toll = maxDist[n-1] - maxDist[a] - (roads[i].c + maxDFromEnd[b]);

// Means it's impossible since we could have a toll before and one after.
if (minDist[a] != maxDist[a] && minDFromEnd[a] != maxDFromEnd[a])
return false;
}

// We made it!
return true;
}

// Solves for all min distances. If flag = true, source = residential, otherwise source = downtown.
public static void solveMinD(int[] myMinDist, boolean flag) {
Arrays.fill(myMinDist, NOPATH);
int source = flag ? 0 : n-1;
int dest = flag ? n-1 : 0;
myMinDist[source] = 0;
recMinD(myMinDist, dest, flag);
}

// Recursively finds the shortest distance from source to v. If flag = true, source = residential, otherwise downtown.
public static int recMinD(int[] myMinDist, int v, boolean flag) {

// We solved it already.
if (myMinDist[v] != NOPATH) return myMinDist[v];

// Tells us which graph to use.
ArrayList[] g = flag ? revGraph : graph;
int res = NOPATH;

// Try all edges leaving v in the direction we seek.
for (int i=0; i<g[v].size(); i++) {
edge e = ((ArrayList<edge>winkg[v]).get(i);
int tmp = flag ? e.c + recMinD(myMinDist, e.v1, flag) : e.c + recMinD(myMinDist, e.v2, flag);
res = Math.min(res, tmp);
}

// Store result and return.
myMinDist[v] = res;
return res;
}

// Solves for all max distances. If flag = true, source = residential, otherwise source = downtown.
public static void solveMaxD(int[] myMaxDist, boolean flag) {
Arrays.fill(myMaxDist, -1);
int source = flag ? 0 : n-1;
int dest = flag ? n-1 : 0;
myMaxDist[source] = 0;
recMaxD(myMaxDist, dest, flag);
}

// Recursively finds the longest distance from source to v. If flag = true, source = residential, otherwise downtown.
public static int recMaxD(int[] myMaxDist, int v, boolean flag) {

// We did this already.
if (myMaxDist[v] != -1) return myMaxDist[v];

// Tells us which graph to use.
ArrayList[] g = flag ? revGraph : graph;
int res = 0;

// Try all edges from v in direction we want.
for (int i=0; i<g[v].size(); i++) {
edge e = ((ArrayList<edge>winkg[v]).get(i);
int tmp = flag ? e.c + recMaxD(myMaxDist, e.v1, flag) : e.c + recMaxD(myMaxDist, e.v2, flag);
res = Math.max(res, tmp);
}

// Store answer and return.
myMaxDist[v] = res;
return res;
}

}

class edge {

public int v1;
public int v2;
public int c;
public int ID;
public int toll;

public edge(int myv1, int myv2, int myc, int myID) {
v1 = myv1;
v2 = myv2;
c = myc;
ID = myID;
toll = 0;
}
}




Please Mr Fulaman Can you explain the Code above to me. It was an assignment in school that i did not understand.
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 10:46am On Jun 17, 2016
satmaniac:

You don download am?
nope but i will.
Re: Learning To Program With Java by the Fulaman by hardebayho(m): 3:52pm On Jun 17, 2016
Collinz2:
nope but i will.

Wanna find out which one is the best IDE? Download intellij, then you'll know what's called best
Re: Learning To Program With Java by the Fulaman by Collinz2(m): 4:54pm On Jun 18, 2016
hardebayho:


Wanna find out which one is the best IDE? Download intellij, then you'll know what's called best
alright.
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 11:17pm On Jun 18, 2016
Tosinosu2011:
package FareAndBalanced;

//Solution to 2009 World Finals Problem E: Fare and Balanced

import java.util.*;
import java.io.*;

public class fare {

final public static int NOPATH = 1000000000;

public static int[] minDist;
public static int[] maxDist;
public static int n;
public static edge[] roads;

public static int[] minDFromEnd;
public static int[] maxDFromEnd;

public static ArrayList[] graph;
public static ArrayList[] revGraph;

public static void main(String[] args) throws Exception {

BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer(stdin.readLine());
n = Integer.parseInt(tok.nextToken());
int e = Integer.parseInt(tok.nextToken());
int loop = 1;

// Process each case.
while (n != 0) {

roads = new edge[e];

// Read in graph.
graph = new ArrayList[n];
for (int i=0; i<n; i++)
graph[i] = new ArrayList<edge>();

// We also need edges stored in "reverse" order.
revGraph = new ArrayList[n];
for (int i=0; i<n; i++)
revGraph[i] = new ArrayList<edge>();

for (int i=0; i<e; i++) {
tok = new StringTokenizer(stdin.readLine());
int v1 = Integer.parseInt(tok.nextToken()) - 1;
int v2 = Integer.parseInt(tok.nextToken()) - 1;
int c = Integer.parseInt(tok.nextToken());
roads[i] = new edge(v1, v2, c, i+1);
graph[roads[i].v1].add(roads[i]);
revGraph[roads[i].v2].add(roads[i]);
}

minDist = new int[n];
maxDist = new int[n];
minDFromEnd = new int[n];
maxDFromEnd = new int[n];

boolean res = solve();

// Can't do it.
if (!res)
System.out.println("Case "+loop+": No solution"wink;

// Usual case.
else {

// Calculate number of roads to toll.
int numToll = 0;
for (edge x: roads)
if (x.toll > 0)
numToll++;

// Output each road with a toll.
StringBuffer sb = new StringBuffer();
sb.append("Case "+loop+": "+numToll+" "+maxDist[n-1]+"\n"wink;
for (edge x: roads)
if (x.toll > 0)
sb.append(x.ID+" "+ x.toll+"\n"wink;
System.out.print(sb);
}

// Get next case.
loop++;
tok = new StringTokenizer(stdin.readLine());
n = Integer.parseInt(tok.nextToken());
e = Integer.parseInt(tok.nextToken());
}
}

public static boolean solve() throws Exception {

// Pre-compute shortest and longest distances, from both residential area and downtown.
solveMinD(minDist, true);
solveMaxD(maxDist, true);
solveMinD(minDFromEnd, false);
solveMaxD(maxDFromEnd, false);

// Go through each road.
for (int i=0; i<roads.length; i++) {

int a = roads[i].v1;
int b = roads[i].v2;
if (minDist[a] == maxDist[a] && minDist[b] != maxDist[b] && maxDist[n-1] - maxDist[a] != roads[i].c + maxDFromEnd[b])
roads[i].toll = maxDist[n-1] - maxDist[a] - (roads[i].c + maxDFromEnd[b]);

// Means it's impossible since we could have a toll before and one after.
if (minDist[a] != maxDist[a] && minDFromEnd[a] != maxDFromEnd[a])
return false;
}

// We made it!
return true;
}

// Solves for all min distances. If flag = true, source = residential, otherwise source = downtown.
public static void solveMinD(int[] myMinDist, boolean flag) {
Arrays.fill(myMinDist, NOPATH);
int source = flag ? 0 : n-1;
int dest = flag ? n-1 : 0;
myMinDist[source] = 0;
recMinD(myMinDist, dest, flag);
}

// Recursively finds the shortest distance from source to v. If flag = true, source = residential, otherwise downtown.
public static int recMinD(int[] myMinDist, int v, boolean flag) {

// We solved it already.
if (myMinDist[v] != NOPATH) return myMinDist[v];

// Tells us which graph to use.
ArrayList[] g = flag ? revGraph : graph;
int res = NOPATH;

// Try all edges leaving v in the direction we seek.
for (int i=0; i<g[v].size(); i++) {
edge e = ((ArrayList<edge>winkg[v]).get(i);
int tmp = flag ? e.c + recMinD(myMinDist, e.v1, flag) : e.c + recMinD(myMinDist, e.v2, flag);
res = Math.min(res, tmp);
}

// Store result and return.
myMinDist[v] = res;
return res;
}

// Solves for all max distances. If flag = true, source = residential, otherwise source = downtown.
public static void solveMaxD(int[] myMaxDist, boolean flag) {
Arrays.fill(myMaxDist, -1);
int source = flag ? 0 : n-1;
int dest = flag ? n-1 : 0;
myMaxDist[source] = 0;
recMaxD(myMaxDist, dest, flag);
}

// Recursively finds the longest distance from source to v. If flag = true, source = residential, otherwise downtown.
public static int recMaxD(int[] myMaxDist, int v, boolean flag) {

// We did this already.
if (myMaxDist[v] != -1) return myMaxDist[v];

// Tells us which graph to use.
ArrayList[] g = flag ? revGraph : graph;
int res = 0;

// Try all edges from v in direction we want.
for (int i=0; i<g[v].size(); i++) {
edge e = ((ArrayList<edge>winkg[v]).get(i);
int tmp = flag ? e.c + recMaxD(myMaxDist, e.v1, flag) : e.c + recMaxD(myMaxDist, e.v2, flag);
res = Math.max(res, tmp);
}

// Store answer and return.
myMaxDist[v] = res;
return res;
}

}

class edge {

public int v1;
public int v2;
public int c;
public int ID;
public int toll;

public edge(int myv1, int myv2, int myc, int myID) {
v1 = myv1;
v2 = myv2;
c = myc;
ID = myID;
toll = 0;
}
}




Please Mr Fulaman Can you explain the Code above to me. It was an assignment in school that i did not understand.

This looks like a Data Structures & Algorithms class, what is it that you don't understand about it?
Re: Learning To Program With Java by the Fulaman by padiky: 11:20pm On Jun 18, 2016
Anyone who is a good developer in Java or C# that leaves in the Ikeja area should ccontact 08072064014
Re: Learning To Program With Java by the Fulaman by Nobody: 11:28pm On Jun 18, 2016
Fulaman198:


This looks like a Data Structures & Algorithms class, what is it that you don't understand about it?
See code sir shocked !!!

1 Like

Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 11:29pm On Jun 18, 2016
crotonite:
See code sir shocked !!!

LOL

1 Like

Re: Learning To Program With Java by the Fulaman by Mckayce(m): 5:47pm On Jun 19, 2016
FULAMAN bro i love the way you keep teaching here...
i have been following this thread anonymously .... but seem not to understand anything .......
pls can i get an ebook or anywhere i can learn all what u hv been teaching pls.... i need your reply.. THANKS
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 6:38pm On Jun 19, 2016
Mckayce:
FULAMAN bro i love the way you keep teaching here...
i have been following this thread anonymously .... but seem not to understand anything .......
pls can i get an ebook or anywhere i can learn all what u hv been teaching pls.... i need your reply.. THANKS

Oracle's main website has pdfs that you can download that supplement what I have been teaching here.

https://docs.oracle.com/javase/tutorial/

Thanks!
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 6:40pm On Jun 19, 2016
satmaniac:



When I tried using while last time it didn't work, but after some modification this works exactly as I want it to.


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."wink;
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 + ":"wink;
Scores[i] = stdio.nextInt();
while(Scores[i]<=-1 || Scores[i]>100){
System.out.println("Score is less than zero, or greater than 100, please, enter a valid score!"wink;

Scores[i] = stdio.nextInt();

}
Scores[i]++;
total+=Scores[i];

}
average=total/Scores.length;
System.out.println("Your average is:" + " " + average);












}


}

I have some problems with your code those mainly with the while statement being thrown in there. Instead of your for loop, you could say

while the scores in the array are not less than 0 or scores are not greater than 100 then do the following commands.

Then you can also say if the score in a particular array position is less than 0 or greater than 100, then display a message to the user alerting them that the score must be greater than or equal to 0 or less than 100.

To simplify things in this assignment, I think you guys should use either a do-while loop or while loop and stay away from the for loop. You could use a for loop but it over-complicates things at this level of programming (plus in my opinion it's not efficient).

Within that while loop, what you want to do is have an if statement that tests whether testscore is less than 0 or greater than 100, then alert the user of improper data entry.

I'll post my own solution by Tuesday if I don't get a response from you guys. Thanks!
Re: Learning To Program With Java by the Fulaman by Mckayce(m): 8:44pm On Jun 19, 2016
Fulaman198:


Oracle's main website has pdfs that you can download that supplement what I have been teaching here.

https://docs.oracle.com/javase/tutorial/

Thanks!

Thanks bro.... please can you tell me others.... Thanks in advance
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 11:31pm On Jun 19, 2016
Mckayce:


Thanks bro.... please can you tell me others.... Thanks in advance

Well there are 2 textbooks that I used when I was in school one of them is

Intro to Java Programming by Liang - I don't know what edition it is on now, but you can look online and possibly get the eBook.

Another one that I like is Head First Java. I hope that it works out for you. Let me know how it goes. Thanks!

1 Like

Re: Learning To Program With Java by the Fulaman by Mckayce(m): 10:01pm On Jun 20, 2016
Fulaman198:


Well there are 2 textbooks that I used when I was in school one of them is

Intro to Java Programming by Liang - I don't know what edition it is on now, but you can look online and possibly get the eBook.

Another one that I like is Head First Java. I hope that it works out for you. Let me know how it goes. Thanks!

Thanks bro i will search for the book online
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 11:00am On Jun 21, 2016
Fulaman198:


I have some problems with your code those mainly with the while statement being thrown in there. Instead of your for loop, you could say

while the scores in the array are not less than 0 or scores are not greater than 100 then do the following commands.

Then you can also say if the score in a particular array position is less than 0 or greater than 100, then display a message to the user alerting them that the score must be greater than or equal to 0 or less than 100.

To simplify things in this assignment, I think you guys should use either a do-while loop or while loop and stay away from the for loop. You could use a for loop but it over-complicates things at this level of programming (plus in my opinion it's not efficient).

Within that while loop, what you want to do is have an if statement that tests whether testscore is less than 0 or greater than 100, then alert the user of improper data entry.

I'll post my own solution by Tuesday if I don't get a response from you guys. Thanks!

Here:


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."wink;
Scores = new int[10];

Scanner stdio = new Scanner(System.in);



while(scores[i]!<0 || scores[i]!>100){

System.out.println("Please enter Test Score" + i + ":"wink;
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!"wink;

Scores[i] = stdio.nextInt();

}
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 Fulaman198(m): 8:02pm On Jun 21, 2016
satmaniac:


Here:


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."wink;
Scores = new int[10];

Scanner stdio = new Scanner(System.in);



while(scores[i]!<0 || scores[i]!>100){

System.out.println("Please enter Test Score" + i + ":"wink;
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!"wink;

Scores[i] = stdio.nextInt();

}
Scores[i]++;
total+=Scores[i];

}
average=total/Scores.length;
System.out.println("Your average is:" + " " + average);












}


}

Just one question, do you test your programme before handing it in? I think from now on I'll be asking for screenshots as well to confirm that you have it working just to make sure you guys know how to compile your own programmes. I saw Antonineutron using printin instead of println which would give one a compilation error.
Re: Learning To Program With Java by the Fulaman by wisemania(m): 12:00am On Jun 22, 2016
Fulaman198:


Just one question, do you test your programme before handing it in? I think from now on I'll be asking for screenshots as well to confirm that you have it working just to make sure you guys know how to compile your own programmes. I saw Antonineutron using printin instead of println which would give one a compilation error.
Sir, I just sent you a pm, please reply with estimates.Thanks.
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 8:51pm On Jun 23, 2016
Fulaman198:


Just one question, do you test your programme before handing it in? I think from now on I'll be asking for screenshots as well to confirm that you have it working just to make sure you guys know how to compile your own programmes. I saw Antonineutron using printin instead of println which would give one a compilation error.


I didn't, but when I tested it yesterday, I have this wrong start of expression error. I think i have an idea where the problem is. the code will be modified in my last code.

MODIFIED:

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author ABDULL
*/

import java.util.Scanner;

public class Array {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

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."wink;
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 + ":"wink;
Scores[i] = stdio.nextInt();
if(Scores[i]<0 || Scores[i]>100){
System.out.println("Score is less than zero, or greater than 100, please, enter a valid score!"wink;

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 Collinz2(m): 10:35pm On Jun 23, 2016
How long does it take one to learn java basics or any programming language basics to be able to write his own program.
Re: Learning To Program With Java by the Fulaman by Fulaman198(m): 4:28pm On Jun 24, 2016
Collinz2:
How long does it take one to learn java basics or any programming language basics to be able to write his own program.

If you take a Java class at a school I'd say 3 - 6 months, though that number varies.
Re: Learning To Program With Java by the Fulaman by satmaniac(m): 7:03pm On Jun 24, 2016
Fulaman198:


If you take a Java class at a school I'd say 3 - 6 months, though that number varies.

My teacher, I submitted a corrected version of my code. You can check it in my last post.


Correction, advice, tips are needed.

(1) (2) (3) ... (10) (11) (12) (13) (14) (15) (16) (Reply)

Facebook Is Suing Me For This / How Much Will It Cost Me To Design a mobile APP In Nigeria / Java Vs PHP: Which Has The Brightest Future?

(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. 90
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.