Friday 15 September 2017

You are Welcome to the Study HUB








// A simple java code demonstrating a grading system package grading_system_solution; import java.util.Scanner; public class Grading_System_solution { public static void main(String[] args) { Scanner inputs= new Scanner(System.in); String lecturer_name; double classmark,testmark,midsemmark,exammark; int lecturer_password=6765; System.out.println("\t\t\t\t\n\nKOFORIDUA TECHNICAL UNIVERSITY"); System.out.println("\t\t\t\t\n\nTHE STUDENT RESULT UPLOAD PORTAL"); System.out.println("\t\t\t\t\n\n WELCOME"); // lets authenticate the lecturer System.out.println("please enter your username and password"); System.out.println("\nplease enter username"); lecturer_name=inputs.next(); System.out.println("Password"); lecturer_password=inputs.nextInt(); // lets initialise the lecturers password to be 6765 System.out.println("Authentication in progress...it won't take long"); if(lecturer_password==6765){ Thread wow= new Thread(); try { for(int counter=0;counter<=9;counter++){ counter++; if(counter==0){ wow.sleep(1000); System.out.println("LOADING."); System.out.print("."); }else if(counter==1){ wow.sleep(950); System.out.print("."); }else if(counter==2){ wow.sleep(900); System.out.print("."); }else if(counter==3){ wow.sleep(700); System.out.print("...."); } else if(counter==4){ wow.sleep(800); System.out.print("....."); }else if(counter==5){ wow.sleep(1000); System.out.print("......."); }else if(counter==6){ wow.sleep(500); System.out.print("........"); }else if(counter==7){ wow.sleep(200); System.out.print("..."); }else if(counter==8){ wow.sleep(100); System.out.print("...."); }else{ wow.sleep(1500); System.out.print("."); System.out.println("\n\nauthentication completed"); System.out.println("please enter student class mark"); classmark=inputs.nextDouble(); if(classmark<0 classmark="">10){ System.out.println("invalid entery"); }else{ System.out.println("proceed to enter student class Test Mark"); testmark=inputs.nextDouble(); if(testmark<0 testmark="">10){ System.out.println("invalid entery"); }else{ System.out.println("proceed to enter student mid semester Mark"); midsemmark=inputs.nextDouble(); if(midsemmark<0 midsemmark="">20){ System.out.println("invalid entry"); } else{ System.out.println("proceed to enter student end of semester Mark"); exammark=inputs.nextDouble(); if(exammark<0 exammark="">60){ System.out.println("invalid entry"); }else{ System.out.println("wait a while....data process in progress"); wow.sleep(2000); // lets creat a header System.out.println("\tClass_Mark(10%)\tTest_Mark(10%)\t Mid_Semester(20%)\tEnd_of_Semester(60%)\tGrade"); //lets work now work on the percentage of the entered marks double a,b,c,d; // a= class mark percentage a=(classmark); //b= class test percentage b=(testmark); //c= mid semester mark percentage c=(midsemmark); //d= end of semester mark percentage d=(exammark); //let declare a variable to store the total mark percentages double store=((a+b+c+d)); System.out.println("\n\n\t\t"+a+"\t\t"+b+"\t\t"+c+"\t\t"+d); // lets declear characters to assign grade char A,B,C,D,F; if(store>=85 && !(store>100)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'A'+"+"); }else if(store>=80 && !(store>84)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'A'); }else if(store>=75 && !(store>79)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'B'+"+"); }else if(store>=70 && !(store>74)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'B'+"+"); }else if(store>=65 && !(store>69)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'C'+"+"); }else if(store>=60 && !(store>64)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'C'); }else if(store>=55 && !(store>59)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'D'+"+"); }else if(store>=50 && !(store>54)){ System.out.println('D'); }else if(store>=0 && !(store>49)){ System.out.print("\t\t\t\t\t\t\t\t\t\t\t"+'F'); }else{ System.out.println("\n\ninvalid entry"); } System.out.println("\n\n\n\n\n"); } } } } } } } catch (Exception e) { System.out.println("LOADING FAIL"); } } } }


// simple program using thread.sleep do demonstrate installation..... //# programming is fun //brought to you by bruce.... package threades; import javax.swing.*; import java.awt.GridLayout; public class sleep { public static void main(String[] args) { int q=0; System.out.println("INSTALLING SOFTWARE"); callcode(); } Thread bruce= new Thread(); static void callcode() { try { for(int q=0; q<=9; q++) { Thread.sleep(1000); System.out.print("."); if(q==0) { Thread.sleep(1000); System.out.println("10%"); }else if(q==1) { Thread.sleep(10000); System.out.print("20%"); }else if(q==2) { Thread.sleep(15000); System.out.print("30%"); }else if(q==3) { Thread.sleep(17000); System.out.print("40%"); }else if(q==4) {Thread.sleep(10000); System.out.print("50%"); }else if(q==5) { Thread.sleep(10000); System.out.print("60%"); }else if(q==6) { Thread.sleep(20000); System.out.print("70%"); }else if(q==7) { Thread.sleep(10000); System.out.print("80%"); }else if(q==8) { Thread.sleep(10000); System.out.print("90%"); }else { System.out.print("100%"); System.out.println("\tInstallation finished....click on finish"); JPanel p= new JPanel(); JFrame f=new JFrame(); GridLayout g1= new GridLayout(); f.setLayout(g1); f.setContentPane(p); JButton b= new JButton("finish"); p.add(b); f.setVisible(true); f.pack(); } } } catch (Exception e) { System.out.println("installation failed"); } } }

// ASIMPLE PROGRAM IN JAVA TO VERIFY FOR AN ODD OR AN EVEN NUMBER INPUT AS WELL AS A NEGATIVE OR POSITIVE NUMBER package classexercise; import java.util.Scanner; public class Classexercise { public static void main(String[] args) { Scanner wow= new Scanner(System.in); System.out.println("please enter a number"); double number=wow.nextInt(); if(Math.ceil(number/2)==(number/2)){ System.out.println("you have entered an even number"); } else{ System.out.println("you have entered an odd number"); } System.out.println("please enter second number"); int senumber=wow.nextInt(); if(senumber<0 a="" div="" else="" entered="" have="" nagative="" number="" positive="" system.out.println="" you="">

// A SAMPLE CODE IN JAVA FOR A GRADING SYSTEM 

package javaapplication3; import java.util.Scanner; /** * * @author GAME */ public class JavaApplication3 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner wow= new Scanner(System.in); System.out.println("WELCOME TO THE STUDENT RESULT UPLOAD PORTAL"); System.out.println("******************************************"); System.out.println("welcome to the result portal"); System.out.println("plaese enter your name"); String name= wow.next(); System.out.println("your name is \t"+name); System.out.println("please enter your mark"); int mark=wow.nextInt(); System.out.println("your entered mark is\t"+mark); if(mark>=85 && !(mark>100)){ System.out.println("A+"); } else if(mark>=80 && !(mark>84)){ System.out.println("A"); } else if(mark>=75 && !(mark>79)){ System.out.println("B+"); }else if(mark>=70 && !(mark>74)){ System.out.println("B"); }else if(mark>=65 && !(mark>69)){ System.out.println("C+"); }else if(mark>=60 && !(mark>64)){ System.out.println("C"); }else if(mark>=55 && !(mark>59)){ System.out.println("D+"); } else if(mark>=50 && !(mark>59)){ System.out.println("D"); } else if(mark>=0 && !(mark>49)){ System.out.println("F"); }else{ System.out.println("invalid entry"); } } }


package javaapplication1; import java.util.Scanner; public class JavaApplication1 { public static void main(String[] args) { /* a simple program to calculate the area and the hypothesys of a rectangle based on user inputs*/ Scanner bruce= new Scanner(System.in); System.out.println("\t\tWELCOME TO THE HYPOTHESYS CALCULATOR"); System.out.println("\t************************************"); // accepting input from user System.out.println("plase kindly enter your name"); String username_input=bruce.next(); // accepting adjecent value from user System.out.println("please enter value for adjacent"); double adjacent_input=bruce.nextInt(); // accepting opposite value from user System.out.println("please enter value for opposite"); double opposite_input=bruce.nextInt(); // writing a code to calculate hypothenus System.out.println(" the calculated hypotenus is\t\n"+ Math.hypot(adjacent_input, opposite_input)+"cm^2"); // a simple code to run result to the nearest whole number System.out.println("to the nearest whole number\t"+Math.round(Math.hypot(adjacent_input, opposite_input)) +"cm"); //writing a programe to calculate the area of a rectangle double areacal=0.5*(adjacent_input*opposite_input); System.out.println("Hello MR/MRS\t"+username_input+"\twith reference " + "to your input ..your calculated hypothesis is\t"+areacal+"cm^2"); } }


package gettinginputfromuser; import java.util.Scanner; public class Gettinginputfromuser { public static void main(String[] args) { Scanner wow= new Scanner(System.in); int a,b; System.out.println("please enter your adjecent value"); a=wow.nextInt(); System.out.println("please enter your oposite value"); b=wow.nextInt(); int a1=a*a;int b1=b*b;int c=a1+b1; double storeanswer=Math.sqrt(c); System.out.println("per your entered values.." + ".the calculated hypothesis is\t\n\n"+storeanswer+"cm"+" \n\nand it's aproximately " + " rounded value to one whole number is\t\n\n" + Math.rint(storeanswer)+"cm"+ " \n\nand the calculated area of " + "the triangle is\t\n\n"+ 0.5*(a*b)+"cm^2"+"\n"); } }

public class bruce_algorithm_solution { public static void main(String [] args) { int bruce[]= {2,3,4,5,6,7,8,9}; int selorm=bruce[0]++; for(int justice=0; justice<=bruce.length; justice++) { selorm+=justice; if(selorm==bruce[6]) { System.out.println(selorm); } } // thank you...by bruce..,.......... } }





Please drop any question in the comment box
   source code                                                            



                 
Click here