程序设计综合训练.docVIP

  • 25
  • 0
  • 约5.75千字
  • 约 9页
  • 2018-02-04 发布于重庆
  • 举报
程序设计综合训练

1、题目:编写程序,定义类Vehicles,其中: 域:name(品牌)、color(颜色)、weight(重量)、plate(车牌号码); 一个构造方法,对四个域进行初始化; 一个返回所有属性信息的方法getDetails(); 对name属性的get和set方法; 该类在包vehicle中。 1)源程序 package vehicle; public class Vehicles { String name; String color; double weight; String plate; public Vehicles(String name,String color,double weight,String plate){ this.name=name; this.color=color; this.weight=weight; this.plate=plate; } public String getDetails(){ return name+,+color+,+weight+,+plate; } public String getName(){ return name; } public String setName(){ return name; } public static void main(Strin

文档评论(0)

1亿VIP精品文档

相关文档