上一页 1 2 3 4 5 6 7 8 ··· 28 下一页
摘要: #include<iostream> using namespace std; class TravelStrategy{ public: virtual void travel()=0; }; class AirplaneStrategy:public TravelStrategy{ public 阅读全文
posted @ 2022-12-23 20:39 今天又双叒叕在敲代码 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 旅游的出行方式有乘坐飞机旅行、乘火车旅行和自行车游,不同的旅游方式有不同的实现过程,客户可以根据自己的需要选择一种合适的旅行方式。 //Person.java package test23; public class Person { //聚合策略类对象 private TravelStrategy 阅读全文
posted @ 2022-12-23 20:38 今天又双叒叕在敲代码 阅读(25) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string> using namespace std; class Account; class AccountState{ public: Account *acc; double balance; string stateName; pu 阅读全文
posted @ 2022-12-23 20:37 今天又双叒叕在敲代码 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 用Java代码模拟实现课堂上的“银行账户”的实例,要求编写客户端测试代码模拟用户存款和取款,注意账户对象状态和行为的变化。 //Account.java package test22; public class Account { private AccountState state; privat 阅读全文
posted @ 2022-12-23 20:36 今天又双叒叕在敲代码 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<map> #include<ctime> #include<sstream> using namespace std; class AbstractChatroom; //抽象同事类 class Member { protected : Abs 阅读全文
posted @ 2022-12-23 20:35 今天又双叒叕在敲代码 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 在“虚拟聊天室”实例中增加一个新的具体聊天室类和一个新的具体会员类,要求如下: 1. 新的具体聊天室中发送的图片大小不得超过20M。 2. 新的具体聊天室中发送的文字长度不得超过100个字符。 3. 新的具体会员类可以发送图片信息和文本信息。 4. 新的具体会员类在发送文本信息时,可以在信息后加上时 阅读全文
posted @ 2022-11-20 08:18 今天又双叒叕在敲代码 阅读(32) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<list> #include<string> using namespace std; class Observer{ protected: string name; public: virtual void buy()=0; virtual 阅读全文
posted @ 2022-11-13 15:21 今天又双叒叕在敲代码 阅读(21) 评论(1) 推荐(1) 编辑
摘要: 当股票的价格上涨或下降5%时,会通知持有该股票的股民,当股民听到价格上涨的消息时会买股票,当价格下降时会大哭一场。 //Observer.java package test21; public interface Observer { public void buy(); public void c 阅读全文
posted @ 2022-11-10 10:53 今天又双叒叕在敲代码 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string> #include<vector> using namespace std; //备忘录 class Memento { private: string account; string password; string telNo 阅读全文
posted @ 2022-11-07 19:51 今天又双叒叕在敲代码 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 改进课堂上的“用户信息操作撤销”实例,使得系统可以实现多次撤销(可以使用HashMap、ArrayList等集合数据结构实现)。 //Caretaker.java package test20; public class Caretaker { private Memento[] array = n 阅读全文
posted @ 2022-11-05 23:28 今天又双叒叕在敲代码 阅读(21) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 28 下一页