java
package test3; //0.03mm對折超過8848.13m
public class Duizhe {
????public static void main(String[] args) {
????????double houdu = 0.08;
????????int cishu = 0;
????????while (houdu<=8848130){
????????????houdu=houdu*2;
????????????cishu++;
????????}
????????System.out.println("需要對折:"+cishu+"次");
????}
}

package test3; //java作業(yè) c語言作業(yè)
public interface Demo{
????void javazy();
????void czy();
}
public class Jk implements Demo {
????@Override
????public void javazy(){
????????//TODO Auto-generated method stub
????????System.out.println("java作業(yè)完成");
}
@Override
public void czy(){
????????//TODO Auto-generated method stub
????????System.out.println("c語言作業(yè)完成");
}
public static void main(String[] args){
????????Jk jk = new Jk();
????????jk.javazy();
????????jk.czy();
????}
}

package test3; //定義集合儲存五個學(xué)生名字
import java.util.Scanner; //控制臺輸入名字
public class Jihe {? ?//判斷是否在集合內(nèi)
?public static void main(String[] args) {
? Scanner scanner = new Scanner(System.in);
? String arrayl[] = new String[5];
? for(int i = 0; i < arrayl.length; i++) {
? ?System.out.println("請輸入第"+(i +1)+"位學(xué)生的姓名");
? ?arrayl[i] = scanner.next();
? }
? System.out.println("輸入學(xué)生的姓名如下: ") ;
? for(String a : arrayl) {
? System.out.println(a);
? }
? System.out.println("請輸入要查詢的學(xué)生姓名:");
? String find = scanner.next();
? int position = -1;
? for(int i = 0;i < arrayl.length; i++) {
? ?if(find.equals(arrayl[i])) {
? ? position = i;
? ? System.out.println(find + "的索引位置是" + position);
? ?}
? }
? if(position == -1){
? ?System.out.println("未找到");
? }
?}
}

package test3; //計算1-100除了50之外的累計和
public class Leijia {
????public static int leijia(int y)
????{
????????int sum = 0;
????????for (int j=1;j<101;j++){
????????????if(j==50){
????????????????continue;
????????????}
????????????else{
????????????????sum+=j;
????????????}
????????}
????????return sum;
????}
????public static void main(String[] args) {
????????int y=0;
????????int sum=leijia(y);
????????System.out.println(sum);
????}
}

package test3; //根據(jù)身份證分辨男女
import java.util.Scanner;
public class Demo3 {
????public static void main(String[] args) {
???????? System.out.println("請輸入18位身份證號碼:");
???????? Scanner scanner? = new Scanner(System.in);
???????? String number = scanner.next();
???????? String sex;
???????? int n = number.charAt(16);
???????? int year,month,day;
???????????? if (n%2==0){
???????????? sex = "女";
???????????? }else{
????????????????sex = "男";
?????????????}
????????????System.out.println("性別為:"+sex);
????}
}

package test3;? //輸入字符串,判斷數(shù)字出現(xiàn)次數(shù)
import java.util.Scanner;
public class Zfc {
????public static void main(String[] args) {
???????? Scanner scanner = new Scanner(System.in);
???????? int b = 0;
???????? String a= scanner.next ();
???????? char[] ch = a.toCharArray();
???????? for(char c: ch ){
????????????if (c>48 && c<57){
????????????????b=b+1;
????????????}
????????????System.out.println(b);
????????}
????}
}

package test3; //數(shù)組存儲12個成績并算出平均數(shù)
public class Pingjun {
????public static void main(String[] args) {
???????? int[] a = {72,89,65,87,91,53,82,71,93,76,68};
???????? int sum = 0;
???????? for (int i = 0; i < a.length; i++){
????????????sum+=a[i];
????????}
???????? int x = 0;
???????? x = sum /a.length;
???????? System.out.println("平均數(shù):"+x);
????}
}

package test3;
public class Car {
???? private String brand;
???? private double longs;
???? private String color;
???? private double price;
???? public String getBrand() {
???????? return brand;
???? }
???? public void setBrand(String brand) {
???????? this.brand = brand;
???? }
???? public double getLongs() {
???????? return longs;
???? }
???? public void setLongs(double longs) {
???????? this.longs = longs;
???? }
???? public String getColor() {
???????? return color;
???? }
???? public void setColor(String color) {
???????? this.color = color;
???? }
???? public double getPrice() {
???????? return price;
???? }
???? public void setPrice(double price) {
???????? this.price = price;
???? }
???? public Car(String brand,double longs,String color,double price){
???? super();
???????? this.brand = brand;
???????? this.longs = longs;
???????? this.color = color;
???????? this.price = price;
???? }
???? public? Car() {
???? ???? super();
???? }
???? public void run() {
???? }
???? public static void main(String[] args) {
???????? Car car1 = new Car("捷達",5.3,"紅色",8.9);
???????? Car car2 = new Car("寶馬",5.8,"黑色",35.5);
???????? Car car3 = new Car("捷達",5.3,"紅色",11.5);
???????? Car car4 = new Car("捷達",5.3,"紅色",11.5);
???????? Car car5 = new Car("捷達",5.3,"紅色",11.5);
????}
}??