Professional Documents
Culture Documents
Output: The Object's Position After 10.0 Seconds Is - 490.50000000000006 M
Output: The Object's Position After 10.0 Seconds Is - 490.50000000000006 M
Output: The Object's Position After 10.0 Seconds Is - 490.50000000000006 M
OUTPUT:
package FoodCorporation;
import java.util.*;
{
double tpay;
double[] hours={0,35,47,73};
double[] bpay={0,7.50,8.20,10.00};
//Employee1
else
System.out.println();
//Employee2
else
System.out.println();
//Employee3
else
System.out.println();
}
OUTPUT:
package Marathon;
class Marathon {
int indexOfFastest = 0;
int counter = 1;
int time = 0;
time = times[counter];
fastestTime = time;
indexOfFastest = counter;
counter += 1;
}
return indexOfFastest;
int indexOfSecondFastest = 0;
int counter = 1;
int time = 0;
if(counter == indexOfFastest)
counter += 1;
continue;
time = times[counter];
secondFastestTime = time;
indexOfSecondFastest = counter;
counter += 1;
}
return indexOfSecondFastest;
String[] names = {
"Aaron", "Kate"};
int[] times = {
341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412, 393, 299,
System.out.println("The fastest person was " + names[indexOfFastest] + " with a time of " +
times[indexOfFastest] + " minutes.");
System.out.println("The second fastest person was " + names[indexOfSecondFastest] + " with a time of "
+ times[indexOfSecondFastest] + " minutes.");
OUTPUT:
The second fastest person was Kate with a time of 265 minutes.
package library;
OUTPUT:
Book.java
Title (should be The Da Vinci Code): The Da Vinci Code
Rented? (should be false): false
Rented? (should be true): true
Rented? (should be false): false
Library.java
Library hours:
Libraries are open daily from 9am to 5pm.
Library addresses:
10 Main St.
228 Liberty St.
Borrowing The Lord of the Rings:
You successfully borrowed The Lord of the Rings
Sorry, this book is already borrowed.
Sorry, this book is not in our catalog.
Books available in the first library:
The Da Vinci Code
Le Petit Prince
A Tale of Two Cities
Books available in the second library:
No book in catalog
Returning The Lord of the Rings:
You successfully returned The Lord of the Rings
Books available in the first library:
The Da Vinci Code
Le Petit Prince
A Tale of Two Cities
The Lord of the Rings
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* Initialize a new box with its center located at (startX,
startY), filled
* with startColor.
*/
public BouncingBox(int startX, int startY, Color startColor) {
x = startX;
y = startY;
color = startColor;
}
import java.awt.Graphics;
BouncingBox box;
java.util.ArrayList<BouncingBox> listOfBoxes;
public DrawGraphics() {
box = listOfBoxes.get(0);
box.setMovementVector(0, 1);
listOfBoxes.get(1).setMovementVector(1, 0);
listOfBoxes.get(2).setMovementVector(1, 1);
/** Draw the contents of the window on surface. Called 20 times per second. */
curBox.draw(surface);
OUTPUT: