This file contains 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.util.Scanner; | |
public class ComputeAngles { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
// Prompt the user to enter three points | |
System.out.print("Enter three points: "); | |
double x1 = input.nextDouble(); | |
double y1 = input.nextDouble(); |
This file contains 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.util.Scanner; | |
public class Dec2Hex { | |
/** Main method */ | |
public static void main(String[] args) { | |
// Create a Scanner | |
Scanner input = new Scanner(System.in); | |
// Prompt the user to enter a decimal integer | |
System.out.print("Enter a decimal number: "); |
This file contains 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.util.Scanner; | |
public class GreatestCommonDivisorMethod { | |
/** Main method */ | |
public static void main(String[] args) { | |
// Create a Scanner | |
Scanner input = new Scanner(System.in); | |
// Prompt the user to enter two integers | |
System.out.print("Enter first integer: "); |
This file contains 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 AnalyzeNumbers { | |
public static void main(String[] args) { | |
java.util.Scanner input = new java.util.Scanner(System.in); | |
System.out.print("Enter the number of items: "); | |
int n = input.nextInt(); | |
double[] numbers = new double[n]; | |
double sum = 0; | |
System.out.print("Enter the numbers: "); | |
for (int i = 0; i < n; i++) { |
This file contains 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 CircleWithPrivateDataFields { | |
/** The radius of the circle */ | |
private double radius = 1; | |
/** The number of the objects created */ | |
private static int numberOfObjects = 0; | |
/** Construct a circle with radius 1 */ | |
public CircleWithPrivateDataFields() { | |
numberOfObjects++; |
This file contains 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 Bubble { | |
int x, y; | |
float r; | |
int incrX = (int) random(4,8); | |
int incrY = (int) random(2,8); | |
int red, green, blue, alpha; | |
public Bubble() { | |
x = (int)random(width); |
This file contains 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
add | |
<button id="aboutBtn">About</button> |
This file contains 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
download or clone https://github.com/johnwargo/apache-cordova-api-cookbook-code | |
cordova create ... | |
cordova platform add android | |
graft content from | |
~/Downloads/apache-cordova-api-cookbook-code-master/chapter14-media/Ex14.1 (your downloads, of course) | |
cordova plugin add cordova-plugin-media | |
cordova plugin add cordova-plugin-device |
This file contains 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 Circle extends Shape { | |
private float r; // r is the radius of the circle | |
public Circle(float a, float b, float c) { | |
super(); // this is effectively like new Shape() | |
x = a; | |
y = b; | |
r = c; | |
// accept Shape's default of filled=false |
This file contains 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 AppleTester { | |
public static void main(String[] args) { | |
Apple apple = new Apple(); | |
System.out.println(apple.toString()); | |
} | |
} | |
public class Apple extends Fruit { |