zoukankan      html  css  js  c++  java
  • 作业6--超级无敌终结(冲刺二)

    核心类
     1 package com.example.ddd;
     2 
     3 public class Core {
     4     int a;
     5     int b;
     6     int c;
     7     int d;
     8     public Core(int a,int b,int c,int d)
     9     {
    10         this.a=a;
    11         this.b=b;
    12         this.c=c;
    13         this.d=d;
    14     }
    15     public int calc()
    16     {
    17         if(c==0)
    18         {
    19             return a+b;
    20         }
    21         else if(c==1)
    22         {
    23             return a-b;
    24         }
    25         else if(c==2)
    26         {
    27             return a*b;
    28         }
    29         else if(c==3)
    30         {
    31             if(b==0)
    32             {
    33                 b++;
    34             }
    35             return a/b;
    36         }
    37         else
    38         {
    39             return jiecheng(d);
    40         }
    41     }
    42     public String toString()
    43     {
    44         String A=new String();
    45         String B=new String();
    46         if(a<0)
    47         {
    48             A="("+a+")";
    49         }
    50         else
    51         {
    52             A=a+"";
    53         }
    54         if(b<0)
    55         {
    56             B="("+b+")";
    57         }
    58         else
    59         {
    60             B=b+"";
    61         }
    62         if(c==0)
    63         {
    64             return A+"+"+B;
    65         }
    66         else if(c==1)
    67         {
    68             return A+"-"+B;
    69         }
    70         else if(c==2)
    71         {
    72             return A+"*"+B;
    73         }
    74         else if(c==3)
    75         {
    76             return A+"/"+B;
    77         }
    78         else
    79         {
    80             return d+"!";
    81         }
    82     }
    83 
    84     public int jiecheng(int x)
    85     {
    86         if(x==0 || x==1)
    87         {
    88             return 1;
    89         }
    90         else
    91         {
    92             return x*jiecheng(x-1);
    93         }
    94     }
    95 }
    计算类
      1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      2     xmlns:tools="http://schemas.android.com/tools"
      3     android:id="@+id/container"
      4     android:layout_width="match_parent"
      5     android:layout_height="match_parent"
      6     android:orientation="vertical"
      7     android:background="@drawable/ss2" >
      8 
      9     <LinearLayout
     10         android:layout_width="match_parent"
     11         android:layout_height="wrap_content"
     12         android:gravity="center" >
     13 
     14         <TextView
     15             android:id="@+id/textView1"
     16             android:layout_width="wrap_content"
     17             android:layout_height="wrap_content"
     18             android:text="欢迎您,尊敬的用户"
     19             android:textSize="20sp" />
     20 
     21     </LinearLayout>
     22 
     23     <LinearLayout
     24         android:layout_width="match_parent"
     25         android:layout_height="wrap_content"
     26         android:gravity="center" >
     27 
     28         <TextView
     29             android:id="@+id/textView2"
     30             android:layout_width="wrap_content"
     31             android:layout_height="wrap_content"
     32             android:text="请输入题数:"
     33             android:textSize="20sp" />
     34 
     35         <EditText
     36             android:id="@+id/editText1"
     37             android:hint="不超过5题"
     38             android:layout_width="100dp"
     39             android:layout_height="wrap_content"
     40             android:textSize="15sp"
     41              >
     42 
     43             <requestFocus />
     44         </EditText>
     45 
     46         <Button
     47             android:id="@+id/button1"
     48             android:layout_width="wrap_content"
     49             android:layout_height="34dp"
     50             android:text="开始答题"
     51             android:textSize="15sp"
     52             android:textColor="#ee7755" />
     53 
     54     </LinearLayout>
     55 
     56     <LinearLayout
     57         android:layout_width="match_parent"
     58         android:layout_height="wrap_content" >
     59 
     60         <TextView
     61             android:id="@+id/textView3"
     62             android:layout_width="wrap_content"
     63             android:layout_height="wrap_content"
     64             android:text="第一题:"
     65             android:textSize="20sp" />
     66 
     67         <TextView
     68             android:id="@+id/textView4"
     69             android:layout_width="110dp"
     70             android:layout_height="wrap_content"
     71             android:textSize="20sp" />
     72 
     73         <TextView
     74             android:id="@+id/textView5"
     75             android:layout_width="wrap_content"
     76             android:layout_height="wrap_content"
     77             android:text=" = "
     78             android:textSize="25sp" />
     79 
     80         <EditText
     81             android:id="@+id/editText2"
     82             android:layout_width="70dp"
     83             android:layout_height="wrap_content"
     84             android:textSize="15sp" />
     85 
     86     </LinearLayout>
     87     
     88     <LinearLayout
     89         android:layout_width="match_parent"
     90         android:layout_height="wrap_content" >
     91 
     92         <TextView
     93             android:id="@+id/textView25"
     94             android:layout_width="wrap_content"
     95             android:layout_height="wrap_content"
     96             android:text="第二题:"
     97             android:textSize="20sp" />
     98 
     99         <TextView
    100             android:id="@+id/textView6"
    101             android:layout_width="110dp"
    102             android:layout_height="wrap_content"
    103             android:textSize="20sp" />
    104 
    105         <TextView
    106             android:id="@+id/textView7"
    107             android:layout_width="wrap_content"
    108             android:layout_height="wrap_content"
    109             android:text=" = "
    110             android:textSize="25sp" />
    111 
    112         <EditText
    113             android:id="@+id/editText3"
    114             android:layout_width="70dp"
    115             android:layout_height="wrap_content"
    116             android:textSize="15sp" />
    117 
    118     </LinearLayout>
    119     
    120     <LinearLayout
    121         android:layout_width="match_parent"
    122         android:layout_height="wrap_content" >
    123 
    124         <TextView
    125             android:id="@+id/textView8"
    126             android:layout_width="wrap_content"
    127             android:layout_height="wrap_content"
    128             android:text="第三题:"
    129             android:textSize="20sp" />
    130 
    131         <TextView
    132             android:id="@+id/textView9"
    133             android:layout_width="110dp"
    134             android:layout_height="wrap_content"
    135             android:textSize="20sp" />
    136 
    137         <TextView
    138             android:id="@+id/textView10"
    139             android:layout_width="wrap_content"
    140             android:layout_height="wrap_content"
    141             android:text=" = "
    142             android:textSize="25sp" />
    143 
    144         <EditText
    145             android:id="@+id/editText4"
    146             android:layout_width="70dp"
    147             android:layout_height="wrap_content"
    148             android:textSize="15sp" />
    149 
    150     </LinearLayout>
    151     
    152     <LinearLayout
    153         android:layout_width="match_parent"
    154         android:layout_height="wrap_content" >
    155 
    156         <TextView
    157             android:id="@+id/textView11"
    158             android:layout_width="wrap_content"
    159             android:layout_height="wrap_content"
    160             android:text="第四题:"
    161             android:textSize="20sp" />
    162 
    163         <TextView
    164             android:id="@+id/textView12"
    165             android:layout_width="110dp"
    166             android:layout_height="wrap_content"
    167             android:textSize="20sp" />
    168 
    169         <TextView
    170             android:id="@+id/textView13"
    171             android:layout_width="wrap_content"
    172             android:layout_height="wrap_content"
    173             android:text=" = "
    174             android:textSize="25sp" />
    175 
    176         <EditText
    177             android:id="@+id/editText5"
    178             android:layout_width="70dp"
    179             android:layout_height="wrap_content"
    180             android:textSize="15sp" />
    181 
    182     </LinearLayout>
    183     
    184     <LinearLayout
    185         android:layout_width="match_parent"
    186         android:layout_height="wrap_content" >
    187 
    188         <TextView
    189             android:id="@+id/textView14"
    190             android:layout_width="wrap_content"
    191             android:layout_height="wrap_content"
    192             android:text="第五题:"
    193             android:textSize="20sp" />
    194 
    195         <TextView
    196             android:id="@+id/textView15"
    197             android:layout_width="110dp"
    198             android:layout_height="wrap_content"
    199             android:textSize="20sp" />
    200 
    201         <TextView
    202             android:id="@+id/textView16"
    203             android:layout_width="wrap_content"
    204             android:layout_height="wrap_content"
    205             android:text=" = "
    206             android:textSize="25sp" />
    207 
    208         <EditText
    209             android:id="@+id/editText6"
    210             android:layout_width="70dp"
    211             android:layout_height="wrap_content"
    212             android:textSize="15sp" />
    213 
    214     </LinearLayout>
    215 
    216     <LinearLayout
    217         android:layout_width="match_parent"
    218         android:layout_height="wrap_content"
    219         android:gravity="right" >
    220 
    221         <Button
    222             android:id="@+id/button2"
    223             android:layout_width="wrap_content"
    224             android:layout_height="34dp"
    225             android:text="提交"
    226             android:textSize="15sp" />
    227 
    228     </LinearLayout>
    229 
    230     <LinearLayout
    231         android:layout_width="match_parent"
    232         android:layout_height="wrap_content" >
    233 
    234         <TextView
    235             android:id="@+id/textView17"
    236             android:layout_width="wrap_content"
    237             android:layout_height="wrap_content"
    238             android:text="你答对了:"
    239             android:textSize="20sp" />
    240 
    241         <TextView
    242             android:id="@+id/textView18"
    243             android:layout_width="100dp"
    244             android:layout_height="wrap_content"
    245             android:textSize="20sp" />
    246 
    247     </LinearLayout>
    248     
    249      <LinearLayout
    250         android:layout_width="match_parent"
    251         android:layout_height="wrap_content" >
    252 
    253         <TextView
    254             android:id="@+id/textView19"
    255             android:layout_width="wrap_content"
    256             android:layout_height="wrap_content"
    257             android:text="你答错了:"
    258             android:textSize="20sp" />
    259 
    260         <TextView
    261             android:id="@+id/textView20"
    262             android:layout_width="100dp"
    263             android:layout_height="wrap_content"
    264             android:textSize="20sp" />
    265 
    266     </LinearLayout>
    267     
    268      <LinearLayout
    269         android:layout_width="match_parent"
    270         android:layout_height="wrap_content" >
    271 
    272         <TextView
    273             android:id="@+id/textView21"
    274             android:layout_width="wrap_content"
    275             android:layout_height="wrap_content"
    276             android:text="用时:"
    277             android:textSize="20sp" />
    278 
    279         <TextView
    280             android:id="@+id/textView22"
    281             android:layout_width="100dp"
    282             android:layout_height="wrap_content"
    283             android:textSize="20sp" />
    284 
    285     </LinearLayout>
    286     
    287      <LinearLayout
    288         android:layout_width="match_parent"
    289         android:layout_height="wrap_content" >
    290 
    291         <TextView
    292             android:id="@+id/textView23"
    293             android:layout_width="wrap_content"
    294             android:layout_height="wrap_content"
    295             android:text="参考答案:"
    296             android:textSize="20sp" />
    297 
    298         <TextView
    299             android:id="@+id/textView24"
    300             android:layout_width="wrap_content"
    301             android:layout_height="wrap_content"
    302             android:textSize="20sp" />
    303 
    304     </LinearLayout>
    305 
    306      <Button
    307          android:id="@+id/button3"
    308          android:layout_width="wrap_content"
    309          android:layout_height="34dp"
    310          android:text="重置"
    311          android:textSize="15sp"
    312          android:layout_gravity="right" />
    313 
    314      <LinearLayout
    315          android:layout_width="wrap_content"
    316          android:layout_height="wrap_content" >
    317 
    318          <TextView
    319              android:id="@+id/textView26"
    320              android:layout_width="wrap_content"
    321              android:layout_height="wrap_content"
    322              android:text="选择皮肤:"
    323              android:textSize="20sp" />
    324 
    325          <Spinner
    326              android:id="@+id/spinner1"
    327              android:layout_width="200dp"
    328              android:layout_height="34dp"
    329              android:layout_weight="1"
    330              android:prompt="@string/aaa1"
    331              android:spinnerMode="dialog" />
    332 
    333      </LinearLayout>
    334 
    335 </LinearLayout>
    界面
    1 <?xml version="1.0" encoding="utf-8"?>
    2 <resources>
    3 
    4     <string name="app_name">DDD</string>
    5     <string name="hello_world">Hello world!</string>
    6     <string name="action_settings">Settings</string>
    7     <string name="aaa1">选择皮肤</string>
    8 
    9 </resources>
    strings.xml

     

    在许组长的带领下,实现了换肤功能,非常不易啊。

    附上几张小组学习照片。

    认真研究代码中

    河蟹的讨论

    其他组的组员竟然在学习操作系统!

    遇到难题时的迷茫

    虽然身在不同阵营,还是分享情报的好间谍~

  • 相关阅读:
    梦断代码读书笔记2
    梦断代码读书笔记1
    几篇有用的博客链接
    关于我的Androidstudio的再生
    项目下app目录的具体说明
    关于Android studio的项目界面各部分的认识
    1088 最长回文子串 分类: 51nod 2015-07-20 22:09 8人阅读 评
    1083 矩阵取数问题 分类: 51nod 2015-07-20 22:05 9人阅读 评
    1087 1 10 100 1000 分类: 51nod 2015-07-18 21:59 6人
    51nod 1091 线段的重叠 分类: 51nod 2015-07-18 21:49 7人阅读
  • 原文地址:https://www.cnblogs.com/zhanshenlianmeng/p/4544672.html
Copyright © 2011-2022 走看看