- 14
- 0
- 约6.31千字
- 约 7页
- 2017-05-04 发布于四川
- 举报
Java实验汇报修正版
天津商业大学学生实验报告
共 NUMPAGES 7页,第 PAGE 7页 制表单位:设备处
开课实验室:现代信息交流中心403 开课时间: 2015年3月1日 实验报告:2015年4月8日
学院名称信息工程学院年级、专业、班信管1303班学号姓名张云森同组姓名无课程名称Java程序设计实验项目名称Java面向对象程序设计(1)指导教师尉斌实验类型验证 √ 综合 □ 设计 □ 创新 □成绩教师评语
教师签名:
年 月 日实验目的:熟悉类、属性、构造方法、普通方法、对象的使用方法。
二、实验内容:
(抄写课本296页8.2、8.7、8.8的题目至此。抄写英文即可)
8.2 (The stock class)Following the example of the Circle class in $8.2,design a class named Stock that contains:
A string data field named symbol for the stock’s symbol.
A string datd field named name for the stock’s name.
A double data field named previousClosingPrice that stores the stock price for the previous day.
A constructor that creates a stock with specified symbol and name.
A method named getChangePercent() that returns the percentage changed from previousClosingPrice to currentPrice.
Draw the UMLdiagram for the class.Implement the class.Write a test program that creates a Stock object with the stock symbol JAVA,the name Sun Microsystems Inc,and the previous closing price of 4.5.Set a new current price to 4.35 and display the price-change percentage.
8.7(The Account class)Design a class named Account that contains:
A private int data field named id for the account(default 0).
A private double
三、源代码清单:
1、源代码清单
方法一:package 实验2;
public class shiyan1 {
public static class A{
private String number1;
private double newPrice;
public static void main(String[]args){
A symbol= new A();
System.out.println(The stock number is :+symbol.number1);
A name=new A(中国银行);
System.out.println(The stock name is :+1);
A Price=new A(3900,4000);{
System.out.println(The stock PreviousPrice is :+Price.oldPrice);
System.out.println(The stock CurrentPrice is :+Price.newPrice);
System.out.println(The stock getChangePercent is :+Price.getChangePercent());
}
}
您可能关注的文档
- GSM11-14心得小结.docx
- GSM_R技术及应用发展.doc
- GSM_R的发展模型.doc
- GSM原理及其优化_韩斌杰.doc
- GRM21BR71H104KA01L中文资料.docx
- GRE阅读笔记NO4_3_Noted.doc
- GSM和GPRS的区别.doc
- GSK_25i数控铣床加工中心系统介绍.doc
- GSP兽药店执行标准.doc
- GSK980TD通讯软件说明书.doc
- 小区绿化施工协议书.docx
- 墙面施工协议书.docx
- 1 古诗二首(课件)--2025-2026学年统编版语文二年级下册.pptx
- (2026春新版)部编版八年级道德与法治下册《3.1《公民基本权利》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《4.3《依法履行义务》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.2《按劳分配为主体、多种分配方式并存》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.1《公有制为主体、多种所有制经济共同发展》PPT课件.pptx
- 初三教学管理交流发言稿.docx
- 小学生课外阅读总结.docx
- 餐饮门店夜经济运营的社会责任报告(夜间贡献)撰写流程试题库及答案.doc
最近下载
- ISO9001-2026质量管理体系标准版中英文及变化点解析.pdf VIP
- HGT 21629-1999 管架标准图(四).docx VIP
- 广州市民办学校申办审批表.doc VIP
- 无人机测绘技术与应用课件21--无人机驾驶员职业规划.ppt
- 2025年袋鼠数学LevelB试卷及答案.pdf VIP
- 《重症凝血病标准化评估中国专家共识(2025)》解读PPT课件.pptx VIP
- 《动物防疫法》培训解读课件.pptx VIP
- 无人机测绘技术与应用课件20--无人机飞行原理.ppt
- 先进控制技术及其应用.docx VIP
- 2025-2026学年济南版(2024)初中生物八年级上册《血液是物质运输的载体》教学设计.docx
原创力文档

文档评论(0)