public class Demo01{
public static void main(String[] args){
System.out.println((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5));
}
}
public class Demo02{
public static void main(String[] args){
System.out.println(4 * (1.0 - 1.0 / 3 + 1.0 / 5 - 1.0 / 7 + 1.0 / 9 - 1.0 / 11));
System.out.println(4 * (1.0 - 1.0 / 3 + 1.0 / 5 - 1.0 / 7 + 1.0 / 9 - 1.0 / 11 + 1.0 / 13));
}
}
public class Demo03{
public static void main(String[] args){
System.out.println("周长=" + 2 * 5.5 * 3.14);
System.out.println("面积=" + 5.5 * 5.5 * 3.14);
}
}
public class Demo04{
public static void main(String[] args){
System.out.println(14 / 1.6 / (45 * 60 + 30) * 3600 + "英里/小时");
}
}
public class Demo05{
public static void main(String[] args){
System.out.println(24 * 1.6 / (1 * 3600 + 40 * 60 + 35) * 3600 +"公里/小时");
}
}
public class Demo06 {
public static void main(String[] args){
System.out.println("x=" + (44.5 * 0.55 - 50.2 * 5.9) / (3.4 * 0.55 - 50.2 * 2.1));
System.out.println("y=" + (3.4 * 5.9 - 2.1 * 44.5) / (3.4 * 0.55 - 50.2 * 2.1));
}
}
public class Demo07{
public static void main(String[] args){
long millis = System.currentTimeMillis();
long seconds = millis / 1000;
long minutes = seconds / 60;
long hours = minutes / 60;
long currentHours = hours % 24;
long currentMinutes = minutes % 60;
long currentSeconds = seconds % 60;
System.out.println(currentHours + ":" + currentMinutes + ":" + currentSeconds);
}
}
import java.util.Scanner;
public class Demo08{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("输入一个十进制数:");
double money = input.nextDouble();
double penny = money * 100;
double dollar = penny / 100;
penny = penny % 100;
double quarter = penny / 25;
penny = penny % 25;
double dime = penny / 10;
penny = penny % 10;
double nickle = penny / 5;
penny = penny % 5;
int sum = (int)(dollar + quarter + dime + nickle + penny);
System.out.println("The number of the coin = " + sum);
}
}
import java.util.Scanner;
public class Demo09{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter a degree in Celsius:");
double cel = input.nextDouble();
double fah = cel * 9 / 5 + 32;
System.out.println(cel + "Celsius is" + fah + "Fahrenheit");
}
}
import java.util.Scanner;
public class Demo10{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter the radius and length of a cylinder:");
double radius = input.nextDouble();
double length = input.nextDouble();
double area = radius * radius * (Math.PI);
double volume = area * length;
System.out.println("The area is " + area);
System.out.println("The volume is " + volume);
}
}
import java.util.Scanner;
public class Demo11{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter a number between 0 and 1000:");
int num