Modern Database Management 11th Edition by Jeffrey A Hoffer
Modern Database Management 11th Edition by Jeffrey A. Hoffer Use the UNION statement to provide a combined listing of care center names and their locations as well as laboratories and their location. The list should be sorted by location, in ascending order. (You should use aliases to rename the fields in this query.)
***Important: On pp 335, case exercise #2k. Please make sure to show both the SQL script and results on image files or PDFs..
Solution
public class TurtleExample {
// cut and paste into TurtleMove.java
public static void sierpinski(int n, int length, TurtleGraphics theTurtle){
if (n == 0) return;
for (int i = 0; i < 3; i++){
sierpinski(n-1,length/2, theTurtle);
theTurtle.forward(length);
theTurtle.right(120);
}
}
// cut and paste into TurtleMove.java
public static void tree(int r, TurtleGraphics theTurtle){
if (r<5){
theTurtle.forward(r);
theTurtle.backward( r);
} else {
theTurtle.forward( r/3);
theTurtle.left(30);
tree(r*2/3, theTurtle);
theTurtle.right(30);
theTurtle.backward( r/3);
theTurtle.forward(r/2);
theTurtle.right(25);
tree(r/2,theTurtle);
theTurtle.left(25);
theTurtle.backward(r/2);
theTurtle.forward( r*5/6);
theTurtle.right(25);
tree(r/2, theTurtle);
theTurtle.left(25);
theTurtle.backward(r*5/6);
}
}
// cut and paste into TurtleMove.java
public static void brocolli(int r, TurtleGraphics theTurtle){
// Leaf node just draw a stem
if (r<5){
theTurtle.forward(r);
theTurtle.backward( r);
} else {
// Make stem
theTurtle.forward( r/3);
// Make left branch
theTurtle.left(30);
brocolli(r*2/3, theTurtle);
// Make right branch
theTurtle.right(60);
brocolli(r*2/3, theTurtle);
// Return to center orientation
theTurtle.left(30);
// Return to base of stem
theTurtle.backward( r/3);
}
}
// cut and paste into TurtleMove.java
public static void koch(float r, float size, TurtleGraphics theTurtle) {
if (r <= 1) {
theTurtle.forward((int) (r*size));
theTurtle.left(60);
theTurtle.forward((int) (r*size));
theTurtle.right(120);
theTurtle.forward((int) (r*size));
theTurtle.left(60);
theTurtle.forward((int) (r*size));
} else {
koch(r-1, size/3, theTurtle);
theTurtle.left(60);
koch(r-1, size/3, theTurtle);
theTurtle.right(120);
koch(r-1, size/3, theTurtle);
theTurtle.left(60);
koch(r-1, size/3, theTurtle);
}
}
public static void main(String[] args) {
// Setup EZ graphics system.
TurtleGraphics aTurtle = new TurtleGraphics(1000,512);
TurtleGraphics bTurtle = new TurtleGraphics(1000,512);
aTurtle.penup();
aTurtle.moveTo(50, 500);
aTurtle.pendown();
koch(3, 300, aTurtle);
/*
aTurtle.setPenSize(2);
aTurtle.penup();
aTurtle.moveTo(500, 500);
aTurtle.left(90);
aTurtle.pendown();
brocolli(400,aTurtle);
*/



