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.util.*; | |
| public class Distance | |
| { | |
| public static void main(String[] args) | |
| { | |
| int x1, y1; | |
| int x2, y2; | |
| int inside, distance; | |
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.util.*; | |
| public class Usernames { | |
| public static void main(String[] args) { | |
| String first, last, username; | |
| int randomNum; | |
| // Scan in first and last name |
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.util.Scanner; | |
| import java.text.*; | |
| public class Sphere | |
| { | |
| public static void main(String[] args) | |
| { | |
| double pi = Math.PI; | |
| double radius, volume, surfaceArea; |
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.util.Scanner; | |
| import java.text.*; | |
| public class Tax { | |
| public static void main(String[] args) | |
| { | |
| // Declare variables | |
| int allowedDeduction = 10000, deduction = 2000; | |
| int grossIncome, dependents; |
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.util.Scanner; | |
| import java.text.*; | |
| public class Payroll{ | |
| public static void main(String []args){ | |
| double hourPay, hourWorked; | |
| double overtime, total; | |
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 Sum { | |
| public static void main(String[] args) { | |
| int i = 0, sum = 0; | |
| // Loop adds numbers 1 = 100 | |
| while(i < 100){ | |
| i++; | |
| sum += 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
| public class Root { | |
| public static void main(String[] args) | |
| { | |
| int base = 25; | |
| while(base > 0){ | |
| System.out.println("Square root of " + base + "\t= " + Math.sqrt(base)); | |
| base -= 5; |
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.util.Scanner; | |
| public class Factorial { | |
| public static void main(String[] args) { | |
| int total = 1; | |
| int i, num; | |
| Scanner scan = new Scanner(System.in); | |
| num = scan.nextInt(); |
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.util.Scanner; | |
| public class Prime{ | |
| public static void main(String []args){ | |
| int total = 0; | |
| int num,num2, i; | |
| Scanner scan = new Scanner(System.in); | |
| num = scan.nextInt(); |
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.util.*; | |
| public class Lucky{ | |
| public static void main(String []args){ | |
| int money, userMoney; //userMoney is the amount user started with. Money is the total after the rolls | |
| int die1, die2, sum; | |
| int i = 1, roll = 0; // i is the counter, roll will hold the value of the counter when needed | |
| Scanner scan = new Scanner(System.in); |