A、Laozi
B、Dao De Jing
C、Classic of the Way and Virtue
D、Daoism
A、Laozi
B、Dao De Jing
C、Classic of the Way and Virtue
D、Daoism
A.Laozi
B.Dao De Jing
C.Classic of the Way and Virtue
D.Daoism
水的状态 题目描述 用面向接口的思想编写程序,模拟水在不同温度下可能出现的状态。(温度按整数取值) 100度以上:气体 1-99度:液体 0度以下:固体 代码要求: 接口WaterState中有showState()方法用于显示水的状态。 每种状态用一个类表示,并实现接口WaterState 编写一个水的类,包含显示和设置状态的方法。 主类中根据输入的温度不同,显示水的不同状态。 例如:输入90.输出“液体” 输入输出如下(如果不能显示汉字,可以用拼音): 输入:90 输出:液体 输入:0 输出:固体 输入:100 输出:气体 (程序运行一次输入1个数字,运行截图中要含有以上三种输入) 参考以下程序: 小狗在不同环境条件下可能呈现不同的状态表现,要求用接口封装小狗的状态。 编写主类,在主类中测试小狗的各种状态。 interface DogState { public void showState(); } class SoftlyState implements DogState { public void showState() { System.out.println("ting zhu ren de ming ling"); } } class MeetEnemyState implements DogState { public void showState() { System.out.println("kuang jiao, bing chong shang qu heng yao di ren"); } //public void showState() } class MeetFriendState implements DogState { public void showState() { System.out.println("huang dong wei ba,biao shi huan ying"); }///重写public void showState()方法 } class MeetAnotherDog implements DogState { public void showState() { System.out.println("xi xi"); }//重写public void showState()方法 } class Dog { DogState state; public void show() { state.showState(); } public void setState(DogState s) { state = s; } } public class CheckDogState { public static void main(String args[]) { Dog yellowDog =new Dog(); System.out.print("gou zai zhu ren mian qian:"); yellowDog.setState(new SoftlyState()); yellowDog.show(); System.out.print("gou yu dao di ren:"); yellowDog.setState(new MeetEnemyState()); yellowDog.show(); System.out.print("gou yu dao peng you:"); yellowDog.setState(new MeetFriendState()); yellowDog.show(); System.out.print("gou yu dao tong ban:"); yellowDog.setState(new MeetAnotherDog()); yellowDog.show(); } }
Can Jim or Yan Jin spell "bike"? ______.
A.Jim
B.Yan Jin
C.Jim and Yan Jin
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!