佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 795|回复: 0

java problem

[复制链接]
geralyn 该用户已被删除
发表于 5-2-2007 09:17 PM | 显示全部楼层 |阅读模式


import java.util.*;
class time
{
  public static void main(String [] args)
  {
   
    int hour, min, sec;
   
    Scanner sc = new Scanner(System.in);
   
    System.out.print("Enter hours: ");
    hour = sc.nextInt();
   
    System.out.print("Enter minutes: ");
    min = sc.nextInt();
   
    System.out.print("Enter seconds: ");
    sec = sc.nextInt();
   
    // compute the canonical time and display
   
    sec = (hour*3600)+(min*60)+sec;
    hour = (sec/3600)%60;
    min = ((sec*60)/3600)%60;
    sec = (sec%60);
   
    System.out.print(hour);
    System.out.print( ":" );
    System.out.print(min);
    System.out.print( ":" );
    System.out.print(sec);
   
   
   
    World world = new World();
    Turtle s = new Turtle(world);
    Turtle t = new Turtle(world);
    Turtle u = new Turtle(world);
    int hourAngle,minAngle, secAngle;
   
    // compute the three angle associated with the
    // second-, minute-, and hour- hand
   
    secAngle = sec*6;
    minAngle = (min*60+sec)/10;
    hourAngle = (hour*3600+min*60+sec)/120;
   
   
    System.out.println();
    System.out.print("Angle of the sec hand: ");
    System.out.println(secAngle);
    System.out.print("Angle of the minute hand: ");
    System.out.println(minAngle);
      
    System.out.print("Angle of the hour hand: ");
    System.out.println(hourAngle);
   
    // draw the clock face using Turtle t
   
    t.right(hourAngle);
    t.forward(100);
    s.right(minAngle);
    s.forward(120);   
    u.right(secAngle);
    u.forward(160);
   
   
   
  }
}  

Using turtle graphics and dr java,how can i let d clock drawn by the turtle start clicking?i need to proceed from above.anyone can help?im desperately need sumone to enlighten me.thank you.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 27-8-2025 03:30 AM , Processed in 0.135123 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表