Skip to main content

Posts

Showing posts from 2016

Algorithm Simulator for Selection Sort and Insertion Sort using Java

This is an Algorithm Simulator coded in Java as my Design Analysis and Algorithm Project (2nd Year). It simulates Selection Sort and Insertion sort using animations which are written from scratch using java threads. It also supports both Ascending and Descending sorting. This is the link to the GitHub Repo: https://github.com/dinuish94/AlgorithmSimulator.git

Student Information System - Java (SLIIT - ST2 PROJECT)

Student Information System (Github Project) This system is developed in Java and mySQL as a group project by me and 3 other members during a period of 1 month. The system allows the administrator to,  enroll students to the system  update enroll information  add/update course and degree program details  generate reports  create exams and edit relevant information  calculate gpa of the relevant exam  assign lecturers to courses  add lecturers/update details Lecturers to,  assign course grades  view their feedback  generate reports  view student / course / degree program details Students to,  view their profile  view their grading information  give feedback to lecturers   view lecturer / course / degree program details and other features. Below are some interfaces of the project. (Splash Screen) (Login) (Admin View) (Student Registration) (Update Student Record) (Add Exam) ` (Assign Gr

SIMPLE BLACKJACK GAME IN JAVA (CONSOLE)

import java.util.Scanner; class BlackJack{     public static void main(String[] args)      {         int player_random1 = 100;         int player_random2 = 100;         while(player_random1 >= 12 || player_random2 >= 12  || player_random1 < 3 || player_random2 <3)         {             player_random1 = (int)(Math.random()*100);             player_random2 = (int)(Math.random()*100);         }                  int player_total = player_random1 + player_random2;                  System.out.println("You get a "+player_random1+" and a "+player_random2);         System.out.println("Your total is "+player_total); if(player_total==21)         {             System.out.println("Blackjack! Player Wins!");    return;         } System.out.println();                  int dealer_random1 = 100;         int dealer_random2 = 100;                  while(dealer_random1 >= 12 || deale

HANGMAN USING JAVA (CONSOLE)

SOURCE CODE import java.util.Scanner; class Hangman {     public static void main(String[] args) {         String words_list = "cheese puppies hello tree mango pineapple flowers basket lamp ceiling";         String[] wordsAsArray = words_list.split(" ");         int index;                  //to pick a random integer which is less than the number of array elements and greater than or equal to 0         do{             index =(int) (Math.random() * 10);         }         while(index<0 || index>=wordsAsArray.length);                  //To pick the word that corresponds to the random index picked         String randomWord = wordsAsArray[index];                  //3 arrays declared         char missed[] = new char[randomWord.length()];//to record missed letters         char guessed[] = new char[randomWord.length()];//to record the currently guessed word         char correct[] = new char[randomWord.length()];//to record the correct l

TIC TAC TOE GAME IN JAVA (CONSOLE)

SOURCE CODE import java.util.Scanner; class TicTacToe {     public static void main(String[] args) {         char[][] main = new char[3][3];                  for(int i=0; i<3; i++){             for(int j=0; j<3; j++){                 main[i][j]=' ';             }         }                  for(int i=0; i<4; i++){             if(input(main, 'O')){                 return;             }             if(input(main, 'X')){                 return;             }         }         //1st user will get an additional chance         if(input(main, 'O')){             return;         }         System.out.println("The game is tie!");     }          //----------taking the input from 2 users     public static boolean input(char arr[][],char c){         Scanner input = new Scanner(System.in);         int row,column;                  System.out.print("'"+c+"' choose your location(row,column)

Decimal To Binary Converter Without Using Predefined Methods (Java)

This simple Java Application will convert the given decimal value to its Binary. Following code is to be executed after the user enters a value and presses 'Convert'. (Button Action) private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                                  int num = Integer.parseInt(jTextField1.getText());                  if(num>=0){            int binary[] = new int[50];            int index = 0;            do{                binary[index++]=num%2;                num = num/2;            }            while(num>0);                    StringBuilder builder = new StringBuilder();            for (int i=index-1; i>=0;i--) {              builder.append(binary[i]);//to concatenate the array in reverse            }            String text = builder.toString(); // convert to string            jLabel3.setText(text);        }   }