Java 1020
来源:互联网 发布:unity3d粒子系统喷泉 编辑:程序博客网 时间:2024/05/20 21:49
package com.pm;/** * 游泳池费用计算,面向对象; * @author 周博 */import java.util.Scanner;public class Round {public static void main(String[] args) {Scanner sc = new Scanner(System.in);System.out.printf("请输入半径:");double a = sc.nextDouble();Roundnoe y = new Roundnoe(a);System.out.println("过道的费用:" + y.road());System.out.println("围墙的费用:" + y.wall());}}
package com.pm;public class Roundnoe{private double r;public Roundnoe(double r) {this.r = r;}/** * 路 */public double road(){double aprice = 10 * (Math.PI * (this.r + 3) * (this.r + 3) - Math.PI* this.r * this.r);return aprice;}/** * 围墙 */public double wall(){double bprice = (Math.PI * 2 * (this.r + 3)) * 8;return bprice;}}<pre name="code" class="java">package com.pm;/** * 钟 * @author 周博 */public class Test03 {public static void main(String[] args) throws Exception {Clock c = new Clock();while (true) {System.out.println(c.showTime());c.go();Thread.sleep(1000);}}}
package com.pm;import java.util.Calendar;public class Clock {private int hour;private int min;private int second;public Clock(){Calendar Cal = Calendar.getInstance();hour = Cal.get(11);min = Cal.get(12);second = Cal.get(13);}public void go() {second++;if (second == 60) {min++;if (min == 60) {hour++;if (hour == 24) {hour = 0;}}}}public String showTime() {String time = "";if (hour < 10) {time += "0";}time += hour + ":";if (min < 10) {time += "0";}time += min + ":";if (second < 10) {time += "0";}time += second;return time;}}
Java类的学习总结:(思维导图)
0 0
- Java 1020
- java
- JAVA
- JAVA
- JAVA
- java
- Java
- Java
- JAVA:
- java
- java
- java
- java
- Java
- java
- java
- java
- JAVA?
- java路径处理(jar包中的路径处理)
- Cracking the coding interview--Q1.6
- javascript基础1语法
- SCP命令
- 跟我一起写 Makefile(精华帖合辑)之——提高篇
- Java 1020
- java如何提取字符串中不连续数字进行操作
- hdu 5033 Building 2014 ACM/ICPC Asia Regional Beijing Online
- C#-循环滚动字幕,timer,从左至右,从右至左,暂停---ShinePans
- 关于网络字节序和主机字节序
- 关于产品经理,看一遍不够,转载过来天天看。
- 菜鸟学编程之三:三种最基本排序算法的实现(冒泡排序、选择排序、直接插入排序)
- assert.h原理以及自己的实现
- c#自己实现线程池功能(二)