重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
(int)(Math.random()*3,产生0-3之间的随机整数,即1和2,然后判断为1时,输出一个车牌号;为2时,输出另外一个车牌号,OK。
亭湖ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联建站的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}
部队的车牌号好像有特殊的,比如WJ01什么的,这个正则不包括
public static void main(String[] args) {
String str= "";
int n=0;
int c=0;
for (int i = 0; i 7; i++) {
if(flag()){
c++;
str+=c4? charA():charB();
continue;
}
n++;
str+=n5? charB():charA();
}
System.out.println(str);
}
private static boolean flag(){
int i=(int) (Math.random()*1000);
return i%2==0;
}
private static String charA(){
return ""+(char)(Math.random()*26+'A');
}
private static String charB(){
return ""+(int)(Math.random()*10);
}
package demo;
import java.util.Scanner;
public class CarCard {
//浙A 杭州,浙B 宁波,浙C 温州,浙D 绍兴,浙E 湖州,浙F 嘉兴,浙G 金华,浙H 衢州,浙J 台州,浙K 丽水,浙L 舟山
//网上搜的,应该是对的,这个东西应该管你要
public static void main(String[] args) {
System.out.println("请输入车牌号");
Scanner sc = new Scanner(System.in);
String carno = sc.next();
String t = carno.substring(0,2);
checkAddressByCarCard(t);
}
private static void checkAddressByCarCard(String no){
String a[]={"浙A","浙B","浙C","浙D","浙E","浙F","浙G","浙H","浙J","浙K","浙L"};
String b[]={"杭州","宁波","温州","绍兴","湖州","嘉兴","金华","衢州","台州","丽水","舟山"};
int index = 0;
for(int i = 0;i11;i++){
if(no.equalsIgnoreCase(a[i])){
index=i;
System.out.println("车辆所在地为:"+b[i]);
}
}
}
}
//不严谨,但是基本功能实现了