程序技术好文:第十一周上机作业

简介: 程序技术好文:第十一周上机作业

"

?123456789101112131415161718package test; public class mians { public static void main(String【】 args) { // TODO Auto-generated method stub Car r=new Car(""大众"",""红色"",20); r.setBrand(""宝马""); r.run(); Vehicle s=new Vehicle(); s.brand=""Honda""; s.coulor=""red""; s.speed=30; s.run(); s.loader=2; } }

?123456789101112131415161718192021222324252627282930313233343536package test; public class Car { String brand; String coulor; double speed; public Car(String brand, String coulor, double speed) { super(); this.brand = brand; this.coulor = coulor; this.speed = speed; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getCoulor() { return coulor; } public void setCoulor(String coulor) { this.coulor = coulor; } public double getSpeed() { return speed; } public void setSpeed(double speed) { this.speed = speed; } public void run(){ //代码效果参考:https://v.youku.com/v_show/id_XNjQwNTg3MTg2MA==.html

System.out.println(coulor+brand+""开到了""+speed); } }

?1234567package test; public class Vehicle extends happy{ int loader; }

?1234567891011121314package test; public class happy { String brand; String coulor; double speed; public void run(){ System.out.println(coulor+brand+""速度为""+speed); } }

2.

?123456789101112131415161718192021package hhhhkj; 2 3 public abstract class Shape { 4 protected double area; 5 protected double per; 6 protected String color; 7 8 public Shape() { 9 }1011 public Shape(String color) {12 this.color = color;13 }1415 public t void getArea();1617 public void getPer();1819 public void showAll();2021 }

?123456789101112131415161718192021222324252627282930package hhhhkj; 2 3 public class Rectangle extends Shape { 4 double //代码效果参考:https://v.youku.com/v_show/id_XNjQwNjU1NjIwOA==.html

width; 5 double height; 6 7 public Rectangle() { 8 } 910 public Rectangle(double width, double height, String color) {11 super();12 this.width = width;13 this.height = height;14 this.color = color;15 }1617 public void getArea() {18 area = width height;19 }2021 public void getPer() {22 per = (width + height) 2;23 }2425 public void showAll() {26 System.out.println(""矩形的面积为:"" + area + "",矩阵的周长为:"" + per + "",颜色为:"" + color);27 28 }

?1234567891011121314151617package hhhhkj; 2 3 public class ceshilei { 4 5 public static void main(String【】 args) { 6 // TODO Auto-generated method stub 7 Shape a = new Circle(4, ""紫色""); 8 Shape b = new Rectangle(1, 6, ""

"
image.png
相关文章
|
计算机视觉 C++
OpenCV-单峰三角阈值法Thresh_Unimodal
OpenCV-单峰三角阈值法Thresh_Unimodal
219 0
|
Docker 容器
Docker使用Dockerfile制作镜像
Docker使用Dockerfile制作镜像
109 0
|
弹性计算 Linux 网络安全
【ECS】通过API允许不同账号下的ECS实例内网通信
若您需要实现同一地域下不同账号的ECS实例内网通信,可以参考本文描述授权安全组间互访。
546 0
【ECS】通过API允许不同账号下的ECS实例内网通信
|
Apache 开发工具 数据安全/隐私保护
|
Scala Java
[Scala]Scala学习笔记五 Object
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SunnyYoona/article/details/76423770 1.
1183 0
|
关系型数据库 Oracle Linux
[20151103]ora-00918 error.txt
[20151103]ora-00918 error.txt --今天在调试优化时遇到上述问题,语句很复杂通过例子来解析. SCOTT@test> @ver1 PORT_STRING                    VERSION        BANNER...
1035 0
|
1天前
|
人工智能 运维 安全
|
3天前
|
SpringCloudAlibaba 负载均衡 Dubbo
微服务架构下Feign和Dubbo的性能大比拼,到底鹿死谁手?
本文对比分析了SpringCloudAlibaba框架下Feign与Dubbo的服务调用性能及差异。Feign基于HTTP协议,使用简单,适合轻量级微服务架构;Dubbo采用RPC通信,性能更优,支持丰富的服务治理功能。通过实际测试,Dubbo在调用性能、负载均衡和服务发现方面表现更出色。两者各有适用场景,可根据项目需求灵活选择。
371 123
微服务架构下Feign和Dubbo的性能大比拼,到底鹿死谁手?

热门文章

最新文章