₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,102 members, 8,420,350 topics. Date: Thursday, 04 June 2026 at 05:13 PM

Toggle theme

(java Only) A Programming Challange. - Programming (2) - Nairaland

Nairaland ForumScience/TechnologyProgramming(java Only) A Programming Challange. (2699 Views)

1 2 Reply (Go Down)

Re: (java Only) A Programming Challange. by sparko1(m): 9:46am On Oct 22, 2013
CHARLYX9: You just gat me cracking up which good programmer r u insinuating on that are on nairaland if not only 'hello world' whch they managed to know whatelse.lol
How many have of them has their own made apps/websites if not all those wapkanians you see all over the net disturbing i have an app and a websites even the so called moderators of programming section:javanian,javadoctor has nothing to show off.
#useless country
For one you need life purpose, and why do you think they need to defend themselve by jumping at the post, i for one just started java about two weeks ago and i can tell you with what i now know i can try this out and why are so keen in proving there are no good programmer on nairaland? Just for the record i have seen what stuf these guys are made of and most of them have a different field of study. So please try using your head and hand when typing.
Re: (java Only) A Programming Challange. by omoelu1(m):
This is my solution, I dont know if it solves the question but am sure its corrects and runs properly.
PS: Forgive me cos i didnt comment d code:


import java.util.Scanner;
public class Result {
int passes = 0;
int fail = 0;
int counter = 1;

public void displayMessage( ) {
System.out.println("Welcome to the Result overview"wink;
}

public void enterGrades(){
while(counter <= 10){
System.out.println("Enter result: " ) ;
Scanner input = new Scanner(System.in. ) ;
int result = input.nextInt( ) ;
counter ++;
if(result == 1 ) {
passes = passes+1;
}
else if(result == 2 ) {
fail = fail + 1;
}


}
System.out.println(passes + " passed, while " + fail + " failed" );
if(passes > 8 ) {
System.out.println("Bonus to instructor" ) ;
}
}
}
Re: (java Only) A Programming Challange. by dsypha(op): 6:14am On Oct 31, 2013
pls a moderator help me close this thread!!!
Re: (java Only) A Programming Challange. by Daarsenic: 3:41pm On Oct 31, 2013
/*AIM:
1. Input each test result (I.e , a 1 or a 2).
Display the message "Enter result" on the
screen each time the program requests
another test result.
2. Count the number of each test types.
3. Display a summary of the test results,
indicating the number of students who
passed and the number who failed.
4. If more than eight students passed the
exam, print the message "Bonus to
instructor".

METHOD:
java.scanner : to get user input
looping: for loop
conditioning: if statement
method(s): main and grading method

*/
package grader;
import java.util.Scanner;

public class Grader {

public static void Grading(int p,int f,int t){
Scanner get_input = new Scanner(System.in);
int counter = t;
int pass = p;
int fail = f;
int grade;
for (int i=1 ; i <=counter; i++){
System.out.println("Student "+i+" Enter grade(pass =1 or fail=2) = "wink;
grade =get_input.nextInt();
if(grade == 1 ){
pass += 1;
}else if(grade == 2 ){
fail += 1;
}
}
System.out.println();
System.out.println("SUMMARY"wink;
System.out.println("TOTAL NUMBER OF PASS(ES) = "+pass);
System.out.println("TOTAL NUMBER OF FAIL(S) = "+fail);
System.out.println();
if(pass > cool{
System.out.println("REMARK: "+"BONUS TO INSTRUCTOR"wink;
}
}

public static void main(String[] args) {
int no_of_pass = 0;
int no_of_fail = 0;
int total_no_student = 10;
Scanner get_from_user = new Scanner(System.in);
int test = 0;

Grading(no_of_pass,no_of_fail,total_no_student);

}

}
Re: (java Only) A Programming Challange. by Daarsenic: 3:43pm On Oct 31, 2013
Daarsenic: /*AIM:
1. Input each test result (I.e , a 1 or a 2).
Display the message "Enter result" on the
screen each time the program requests
another test result.
2. Count the number of each test types.
3. Display a summary of the test results,
indicating the number of students who
passed and the number who failed.
4. If more than eight students passed the
exam, print the message "Bonus to
instructor".

METHOD:
java.scanner : to get user input
looping: for loop
conditioning: if statement
method(s): main and grading method

*/
package grader;
import java.util.Scanner;

public class Grader {

public static void Grading(int p,int f,int t){
Scanner get_input = new Scanner(System.in);
int counter = t;
int pass = p;
int fail = f;
int grade;
for (int i=1 ; i <=counter; i++){
System.out.println("Student "+i+" Enter grade(pass =1 or fail=2) = "wink;
grade =get_input.nextInt();
if(grade == 1 ){
pass += 1;
}else if(grade == 2 ){
fail += 1;
}
}
System.out.println();
System.out.println("SUMMARY"wink;
System.out.println("TOTAL NUMBER OF PASS(ES) = "+pass);
System.out.println("TOTAL NUMBER OF FAIL(S) = "+fail);
System.out.println();
if(pass > cool{
System.out.println("REMARK: "+"BONUS TO INSTRUCTOR"wink;
}
}

public static void main(String[] args) {
int no_of_pass = 0;
int no_of_fail = 0;
int total_no_student = 10;
Scanner get_from_user = new Scanner(System.in);
int test = 0;

Grading(no_of_pass,no_of_fail,total_no_student);

}

}
Run Correctly
1 2 Reply

How To Choose A Programming LanguageWhat U Need To Know Before Learn A Programming Language234

Node.js Vs PhpA Beginner’s Guide To Web DevelopmentHow can a user recover BKF file?