ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:93.58KB ,
资源ID:17034631      下载积分:6 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-17034631.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Java与网络程序设计考核要求.docx)为本站会员(b****2)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

Java与网络程序设计考核要求.docx

1、Java与网络程序设计考核要求姓名: 学号: 班级:天津师范大学考核要求2011 2012 学年第一学期期末考核要求科目:Java与网络程序设计 学院: 计信学院专业:计算机科学与技术题号一二三四五总分分数 2011-2012(1)的“Java与网络程序设计”课程为专业选修课,鉴于课程特点,“Java与网络程序设计”课程采用开卷实践考核方式,选修此课程的同学应于第17教学周完成实践考核题目,并上交程序成品、完成答辩。实践考核题目独立完成Project1、Project2、Project3和Project4四个项目。Project 1(1)按照如下UML图要求实现GeometricObject类

2、和Circle类:(2)修改Circle类,使其实现Comparable接口并覆盖Object类的equals方法,其中实现Comparable接口的Circle类能根据radius数值比较大小,覆盖的equals方法能根据radius数值判定Circle对象是否相等;(3)编写测试类,创建半径为5和10的Circle对象,显示equals方法和compareTo方法调用结果。import java.util.Date;/编写测试类,创建半径为5和10的Circle对象,显示equals方法和compareTo方法调用结果。public class Test public static voi

3、d main(String args) Circle c1=new Circle(5); Circle c2=new Circle(10); System.out.println(c1.equals(c2); System.out.println(pareTo(c2); class GeometricObject private String color; private boolean filled; private Date dateCreated; GeometricObject() GeometricObject(String color,boolean filled) this.co

4、lor=color; this.filled=filled; public String getColor() return color; public void setColor(String color) this.color = color; public boolean isFilled() return filled; public void setFilled(boolean filled) this.filled = filled; public Date getDateCreated() return dateCreated; public String toString()

5、return color; /? public double getArea() return 0; / public double getPerimeter() return 0; / class Circle extends GeometricObject implements Comparable private double radius; Circle() Circle(double radius) this.radius=radius; Circle(double radius,String color,boolean filled) this.radius=radius; thi

6、s.setColor(color); this.setFilled(filled); public double getRadius() return radius; public void setRadius(double radius) this.radius = radius; public double getDiameter() return this.radius*2; /直径 /实现Comparable接口的Circle类能根据radius数值比较大小 public int compareTo(Object o) if(getRadius()(Circle)o).getRadiu

7、s() return 1; else if(getRadius()(Circle)o).getRadius() return -1; else return 0; /覆盖的equals方法能根据radius数值判定Circle对象是否相等; public boolean equals(Circle c) if(getRadius()=c.getRadius() return true; else return false; Project 2:编写程序显示一个饼图,使用饼图显示作业、平时测验、期中考试和期末考试占总成绩的百分比。假设作业占20%用红色显示,平时测验占10%用蓝色显示,期中考试占

8、30%用绿色表示,期末考试占40%用橙色表示。import javax.swing .*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Scanner;public class Test public static void main(String args) ZiFrame frame=new ZiFrame(); frame.setTitle(饼图); /面板标题 frame.setSize(300,200); /面板大小 f

9、rame.setResizable(false); /不能改变面板大小 frame.setLocationRelativeTo(null); /显示器上居中显示 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /关闭操作 frame.setVisible(true); class ZiFrame extends JFrame ZiFrame() setLayout(new BorderLayout(); add(new NewJPanel(),BorderLayout.CENTER); class NewJPanel extends

10、JPanel protected void paintComponent(Graphics g) super.paintComponent(g); int xCenter=getWidth()/2; int yCenter=getHeight()/2; int radius=(int)(Math.min(getWidth(), getHeight()*0.4); int x=xCenter-radius; int y=yCenter-radius; g.setColor(Color.red); g.fillArc(x, y, 2*radius, 2*radius, 0,72); g.setCo

11、lor(Color.blue); g.fillArc(x, y, 2*radius, 2*radius,72, 36); g.setColor(Color.green); g.fillArc(x, y, 2*radius, 2*radius, 98,108); g.setColor(Color.white); g.fillArc(x, y, 2*radius, 2*radius, 206,154); g.setColor(Color.black); g.drawString(Projects-20%, 3*radius,40); g.drawString(Quizzes-10%, 2*radi

12、us,10); g.drawString(Midterms-40%, 0,radius); g.drawString(Final-40%, 2*radius,140); Project 3: 编写一个程序,计算投资值在给定利率以及给定年数下的未来值。计算的公式如下所示:使用文本域显示利率、投资总额和年数。当用户点击Calculate按钮时,在文本域显示未来的总额。/* 编写一个程序,计算投资值在给定利率以及给定年数下的未来值。计算的公式如下所示:使用文本域显示利率、投资总额和年数。当用户点击Calculate按钮时,在文本域显示未来的总额。 */import java.awt.Dimensio

13、n;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JTextField;public class Test public static void main(String args) ZiFrame fram

14、e=new ZiFrame(); frame.setTitle(投资计算器); /面板标题 frame.setSize(300,200); /面板大小 frame.setResizable(false); /不能改变面板大小 frame.setLocationRelativeTo(null); /显示器上居中显示 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /关闭操作 frame.setVisible(true); /显示面板 class ZiFrame extends JFrame private JButton btn=new

15、 JButton(Calculate); private JTextField tfd1=new JTextField(8), tfd2=new JTextField(8), tfd3=new JTextField(8), tfd4=new JTextField(8); /private double investmentAmount,years,annualInterestRate; ZiFrame() setLayout(new GridLayout(5,2,5,5); add(new JLabel(InvestmentAmount:); add(tfd1); add(new JLabel

16、(Years:); add(tfd2); add(new JLabel(Annual Interest Rate:); add(tfd3); add(new JLabel(Future value:); add(tfd4); add(new JLabel(); add(btn); btn.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) tfd4.setText(+Double.parseDouble(tfd1.getText()* Math.pow(1+Double.parseD

17、ouble(tfd3.getText()/1200),Double.parseDouble(tfd2.getText()*12); ); Project 4:编写一个程序,模拟交通信号灯。程序让用户从红、黄、绿三色灯中选择一种。当选择一个单选按钮后,相应的灯被打开,每次只能亮一种灯。程序开始时所有的灯都不亮。import java.awt.BorderLayout;import java.awt.Color;import java.awt.Graphics;import java.awt.GridLayout;import java.awt.event.ActionEvent;import j

18、ava.awt.event.ActionListener;import javax.swing.ButtonGroup;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JRadioButton;public class Test public static void main(String args) RadioButtonDemo frame=new RadioButtonDemo(); frame.setTitle(信号灯); /面板标题 frame.setSize(300,200); /面板大小

19、 frame.setResizable(false); /不能改变面板大小 frame.setLocationRelativeTo(null); /显示器上居中显示 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /关闭操作 frame.setVisible(true); class RadioButtonDemo extends JFrame private JRadioButton jrbRed,jrbYellow,jrbGreen; RadioButtonDemo() BorderLayout blay=new BorderLa

20、yout(); setLayout(blay); JPanel jpRadioButtons=new JPanel(); final StartJPanel jpRadioLamps=new StartJPanel(); jpRadioButtons.setLayout(new GridLayout(1,3); jpRadioButtons.add(jrbRed=new JRadioButton(Red); jpRadioButtons.add(jrbYellow=new JRadioButton(Yellow); jpRadioButtons.add(jrbGreen=new JRadioB

21、utton(Green); add(jpRadioLamps,BorderLayout.CENTER); add(jpRadioButtons,BorderLayout.SOUTH); ButtonGroup group=new ButtonGroup(); group.add(jrbRed); group.add(jrbYellow); group.add(jrbGreen);/设置热键 jrbRed.setMnemonic(R); jrbYellow.setMnemonic(Y); jrbGreen.setMnemonic(G); jrbRed.addActionListener(new

22、ActionListener() public void actionPerformed(ActionEvent e) jpRadioLamps.i=1; repaint(); ); jrbYellow.addActionListener(new ActionListener() public void actionPerformed(ActionEvent e) jpRadioLamps.i=2; repaint(); ); jrbGreen.addActionListener(new ActionListener() public void actionPerformed(ActionEv

23、ent e) jpRadioLamps.i=3; repaint(); ); class StartJPanel extends JPanel public int i=0; protected void paintComponent(Graphics g) super.paintComponent(g); int xCenter=getWidth()/2; int yCenter=getHeight()/2; int radius=(int)(Math.min(getWidth(), getHeight()*0.4); int x=xCenter-radius; int y=yCenter-

24、radius; if(i=0) g.drawRect(xCenter, y,40, 120); g.drawOval(xCenter+2, y+2, 35, 35); g.drawOval(xCenter+2, y+42, 35, 35); g.drawOval(xCenter+2, y+82, 35, 35); if(i=1) g.drawRect(xCenter, y,40, 120); g.setColor(Color.red); g.fillOval(xCenter+2, y+2, 35, 35); g.setColor(Color.black); g.drawOval(xCenter

25、+2, y+42, 35, 35); g.drawOval(xCenter+2, y+82, 35, 35); if(i=2) g.drawRect(xCenter, y,40, 120); g.setColor(Color.yellow); g.fillOval(xCenter+2, y+42, 35, 35); g.setColor(Color.black); g.drawOval(xCenter+2, y+2, 35, 35); g.drawOval(xCenter+2, y+82, 35, 35); if(i=3) g.drawRect(xCenter, y,40, 120); g.s

26、etColor(Color.green); g.fillOval(xCenter+2, y+82, 35, 35); g.setColor(Color.black); g.drawOval(xCenter+2, y+42, 35, 35); g.drawOval(xCenter+2, y+2, 35, 35); 开发与部署环境要求JDK 1.7Eclipse Indigo上交内容及格式将Project1、Project2、Project3和Project4的整个项目文件夹压缩为.rar文件,压缩文件名分别为1.rar、 2.rar、3.rar和4.rar,如:学号为06509275的张三同学上交的四个文件应为06509275张三1.rar、06509275张三2.rar、06509275张三3.rar和06509275张三4.rar。评分标准每个项目占20分,答辩表现占20分,共计100分。项目要求能实现需求的全部功能,运行有效,无明显错误;界面友好、美观;代码架构清晰、条理清楚;有必要注释。答辩要求能独立部署并熟练演示提交的程序;正确回答相关问题。

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2