java实验7.1(CollegeCourse.java)

Write a program called CollegeCourse that computes the cost of taking a college course. Include a constructor that requires a course ID number. Add a subclass Lab to compute a lab fee for a course that uses a lab. Write a program UseCourse to use the classes. Save the progras as CollegeCourse, Lab, and UseCourse. Put them all in a package called edu.ynu.lab7. Hints: how to compile and run your programs in the DOS environment, if using Jcreator you don't have to worry about this (suppose you put all your work under c:\java\lab7) Compile the classes by using the command: javac -d c:\java\lab7\*.java Run the example by going to c:\java\lab7 and typing: java ynu/edu/lab7/UseCourse For example, the output could be: The cost of your course is $180.0 there is a $25.00 lab fee. The cost of your course is $205.0 Program 2 Create an abstract Auto class with fields for the car make and price. Include get and set methods for these fields; the setPrice() method is abstract. Create two suclasses for individual automobile makers (for example, Ford and Chevy) and include appropriate setPrice() methods in each subclass. Finally, write a program that uses the Auto class and subclasses to display information about different cars. The java programs should be named like: Auto.java Ford.java Chevy.java UseAuto.java Sample Output: A new Ford costs $20000.0 A new Chevy costs $22000.0



































- 1
- 2
- 粉丝: 2210
- 资源: 26

我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- Unity 拍照上传服务器 生成二维码c#脚本资源
- SCADA 物联网平台实时曲线监控报表的配置说明、代码分析等
- 甲子光年智库-2021年中国AI芯片发展简报及典型厂商案例
- Android 毕业设计高仿抖音(视频类App)(内附源码)
- TensorView for MATLAB:使用欧拉角解码可视化张量
- 电动助力车欧标 EN15194:2017中文版
- nacos 适配 oracle 11g版本 ,附带oracle 脚本,亲测可用
- Android 系统 Linux系统 内核kernel启动流程 init 进程介绍
- STM32开发工具-Keil5的芯片开发包.pack文件,含F1和F4系列
- gcc7.5源码安装包及对应4个依赖源码包



- 1
- 2
前往页