This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; | |
close all; | |
% Create some random data | |
s = [2 2]; | |
x = randn(334,1); | |
y1 = normrnd(s(1).*x,1); | |
y2 = normrnd(s(2).*x,1); | |
data = [y1 y2]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chapter3; | |
public class TryThis3_2 { | |
public static void main(String args[]) | |
throws java.io.IOException{ | |
char choice,ignore; | |
do { | |
System.out.println("1.if 2.switch 3.for 4.while 5.do-while\nchooose one"); | |
choice = (char)System.in.read(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Queue{ | |
char q[ ]; | |
int putloc, getloc; | |
Queue(int size){ | |
q = new char[size]; | |
putloc = getloc = 0; | |
} | |
void put(char ch) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SelfTest13 { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
int [] array = {2,7,4,32,67,12,1,48,26}; | |
int max = array[0]; | |
int min = array[0]; | |
for(int v:array) { //for-each for loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TryThis6_3Quicksort { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
char a[] = {'d','x','a','r','p','j','i'}; | |
int i; | |
System.out.println("Original array: "); | |
for(i=0; i<a.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stack1{ | |
private char q[]; | |
private int tos; | |
int length; | |
Stack1(int size){ | |
q = new char [size]; | |
tos = 0; | |
length = size; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum TrafficLightColor{ | |
RED, GREEN, YELLOW; | |
} | |
class TrafficLightSimulator implements Runnable{ | |
private TrafficLightColor tlc; // holds the traffic light color | |
private boolean stop = false; // set to true to stop the simulation | |
private boolean changed = false; // true when the light has changed | |
TrafficLightSimulator(TrafficLightColor init) { | |
tlc = init; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GenQDemo { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Integer iStore[] = new Integer[10]; | |
GenQueue<Integer> q = new GenQueue<Integer>(iStore); | |
Integer iVal; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.FlowLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JTextField; | |
import javax.swing.SwingUtilities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.FlowLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JTextField; | |
import javax.swing.SwingUtilities; |
OlderNewer