diff --git a/.idea/misc.xml b/.idea/misc.xml index 0548357..e1f830b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 8c68c6b..5aebfd1 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,8 @@ - - + + \ No newline at end of file diff --git a/test6298.iml b/.idea/pan.iml similarity index 58% rename from test6298.iml rename to .idea/pan.iml index 8b2ade9..d6ebd48 100644 --- a/test6298.iml +++ b/.idea/pan.iml @@ -1,10 +1,8 @@ - + - - - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..93490c0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# pan + diff --git a/jinzhi/jinzhi.iml b/chen123/chen123.iml similarity index 84% rename from jinzhi/jinzhi.iml rename to chen123/chen123.iml index c90834f..37cc804 100644 --- a/jinzhi/jinzhi.iml +++ b/chen123/chen123.iml @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/chen123/src/Main.java b/chen123/src/Main.java new file mode 100644 index 0000000..3e59c38 --- /dev/null +++ b/chen123/src/Main.java @@ -0,0 +1,5 @@ +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/chen123/src/jisuan.java b/chen123/src/jisuan.java new file mode 100644 index 0000000..1107087 --- /dev/null +++ b/chen123/src/jisuan.java @@ -0,0 +1,211 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class jisuan{ + public static void main(String[] args) { + JS win=new JS(); + } +} +class JS extends JFrame implements ActionListener{ + private StringBuilder sBuilder = new StringBuilder(); + JTextArea text=new JTextArea(); + double a,b; + Double sum; + int i; + public JS() + { + setBounds(100,100,400,400); + setTitle("计算器"); + this.setLayout(new BorderLayout()); + JPanel p1=new JPanel(); + JPanel p2=new JPanel(); + text.setPreferredSize(new Dimension (370,60)); + p2.setLayout(new FlowLayout()); + p1.add(text); + this.add(p1,BorderLayout.NORTH); + + + p2.setLayout(new GridLayout(5,4)); + JButton button[]=new JButton[20]; + button[0]=new JButton("C"); + button[1]=new JButton(" "); + button[2]=new JButton("%"); + button[3]=new JButton("÷"); + button[4]=new JButton("7"); + button[5]=new JButton("8"); + button[6]=new JButton("9"); + button[7]=new JButton("x"); + button[8]=new JButton("4"); + button[9]=new JButton("5"); + button[10]=new JButton("6"); + button[11]=new JButton("—"); + button[12]=new JButton("1"); + button[13]=new JButton("2"); + button[14]=new JButton("3"); + button[15]=new JButton("+"); + button[16]=new JButton(""); + button[17]=new JButton("0"); + button[18]=new JButton("."); + button[19]=new JButton("="); + + for(int i=0;i 0) { - int remainder = decimalValue % base; // 取余数作为当前位的值 - result.insert(0, digits[remainder]); // 将当前位的值添加到结果的开头 - decimalValue /= base; // 十进制数除以目标进制,为下一次循环做准备 - } - - return result.toString(); // 返回转换后的结果字符串 - } - - // 主方法:执行进制转换 - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); // 创建Scanner对象用于读取用户输入 - - // 读取要转换的数、其原始进制和目标进制 - System.out.print("请输入要转换的数: "); - String number = scanner.nextLine(); - System.out.print("请输入该数的原始进制(2-16): "); - int inputBase = scanner.nextInt(); - - // 读取目标进制 - System.out.print("请输入目标进制(2-16): "); - int targetBase = scanner.nextInt(); - - // 验证输入的有效性 - if (inputBase < 2 || inputBase > 16 || targetBase < 2 || targetBase > 16) { - System.out.println("无效的进制。进制必须在2到16之间。"); - return; // 如果输入无效,则直接返回,不执行后续操作 - } - - try { - // 将输入的数转换为十进制数 - int decimalValue = toDecimal(number, inputBase); - - // 将十进制数转换为目标进制数 - String result = fromDecimal(decimalValue, targetBase); - - // 输出转换后的结果 - System.out.println(number + "初始是" + inputBase + "进制;" + "在" + targetBase + "进制下是"+ result); - } catch (IllegalArgumentException e) { - // 捕获并处理非法参数异常 - System.out.println("错误: " + e.getMessage()); - } - - scanner.close(); // 关闭Scanner对象,释放资源 - } -} diff --git a/out/production/chen123/JS.class b/out/production/chen123/JS.class new file mode 100644 index 0000000..abd5f7d Binary files /dev/null and b/out/production/chen123/JS.class differ diff --git a/out/production/chen123/Main.class b/out/production/chen123/Main.class new file mode 100644 index 0000000..baa3095 Binary files /dev/null and b/out/production/chen123/Main.class differ diff --git a/out/production/chen123/jisuan.class b/out/production/chen123/jisuan.class new file mode 100644 index 0000000..4153de1 Binary files /dev/null and b/out/production/chen123/jisuan.class differ diff --git a/out/production/jinzhi/JinZhi.class b/out/production/jinzhi/JinZhi.class deleted file mode 100644 index c328a5f..0000000 Binary files a/out/production/jinzhi/JinZhi.class and /dev/null differ