Skip to main content

Posts

Showing posts with the label Code

What are some essential tools for PHP developers ? choose one of these 10 PHP tools

 Ten amazing coding tools worthy of your attention for PHP developers When we often have to deal with boring and repetitive tasks such as manual code testing and deployment, we often feel frustrated, but we have always tried to be efficient. And this article will introduce you to 10 PHP development tools, they can just help you meet that requirement, so you can have more time to focus on building better web pages.

Implement a simple calculator (detailed comments on JAVA code)

 import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.text.NumberFormat;//Keep decimals public class SimpleCalculation extends JFrame{     Frame frame = new JFrame();     Frame MistakeWindons = new JFrame();     private JButton SumBtn = new JButton("SUM");     private JButton SubBtn = new JButton("SUB");     private JButton MulBtn = new JButton("MUL");     private JButton DivBtn = new JButton("DIV");     private JButton Reset = new JButton("Reset");     private JTextField FristCount = new JTextField(5);     private JTextField SecondCount = new JTextField(5);     private JTextField Result = new JTextField(10);     private Label Design = new Label("Design by CodingPush");     private Font Ft = new Font("Helvetica", Font.BOLD, 18);//Set font     public SimpleCalculation() {         frame.setResizable(false);//Set...

Disk scheduling algorithm java code

 The first step is to create a CSCAN class public class CSCAN {     public int m=0; //used to store the initial position of the head      public boolean Run=true;      public int sum=0;      public void Check(int a[],int n,int position){          int temp;          for (int i = n; i> 0; i--)          {    // Bubble Sort               for (int j = 0; j <i; j++){     if (a[j]> a[j + 1]) {// Compare the sizes in order          temp = a[j]; // put the big number in front          a[j] = a[j + 1];          a[j + 1] = temp;     }               }          }          while (Run)          {     ...

How to write a program for calendar in Java

calendar for a given month of a given year, or of the current month and year. import java.util.*; import java.text.*; /** Print a month page. * Only works for the Western calendar. */ public class CalendarPage { /** The names of the months */ String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; /** The days in each month. */ public final static int dom[] = { 31, 28, 31, 30, /* jan feb mar apr */ 31, 30, 31, 31, /* may jun jul aug */ 30, 31, 30, 31 /* sep oct nov dec */ }; /** Compute which days to put where, in the Cal panel */ public void print(int mm, int yy) { /** The number of days to leave blank at the start of this month */ int leadGap = 0; System.out.print(months[mm]); // print month and year System.out.print(" "); System.out.print(y...

Creating A Simple Text Formatter Program in Java

import java.io.*; import java.util.*; /** * Fmt -format text (like Berkeley Unix fmt). */ public class Fmt { /** The maximum column width */ public static final int COLWIDTH=72; /** The file that we read and format */ BufferedReader in; /** If files present, format each, else format the standard input. */ public static void main(String[] av) throws IOException { if (av.length == 0) new Fmt(System.in).format( ); else for (int i=0; i<av.length; i++) new Fmt(av[i]).format( ); } /** Construct a Formatter given a filename */ public Fmt(String fname) throws IOException { in = new BufferedReader(new FileReader(fname)); } /** Construct a Formatter given an open Stream */ public Fmt(InputStream file) throws IOException { in = new BufferedReader(new InputStreamReader(file)); } /** Format the File contained in a constructed Fmt object */ public void format( ) throws IOException { String w,f; int col = 0; while ((w = in.readLine( )) != null) { if (w.length( ) == ...