�潘亢锉砬榘�>�潘亢锉砬榘�EIF版

2017-04-26 00:00:00  阅读 18 次 评论 0 条
    评分:3    更新时间:2017-04-26    大小:1.26 MB    平台:Win8,Win7,WinXP,Win2003,Win2000    语言:简体中文    授权:免费

软件介绍

  �潘亢锉砬榘�/strong>是一只喜欢作弄人,恶作剧的猴子的形象,平时一幅很贱的表情,喜欢嘲笑,讽刺,调侃他人。动作夸张,有点犯贱,是个比较有神经,有“笑”果的小猴子。

软件综述

``EIF -- Definition of classsoftware` class software {

-- Attributes name: string; version: string; description: string; author: string; language: string; license: string; rating: integer; reviews: sequence [integer];

-- Constructors create {name: string; version: string; description: string; author: string; language: string; license: string; rating: integer} : void;

-- Operations add_review {review: integer} : void; get_average_rating : integer; is_popular : boolean;

-- Getters and setters set_name {new_name: string} : void; set_version {new_version: string} : void; set_description {new_description: string} : void; set_author {new_author: string} : void; set_language {new_language: string} : void; set_license {new_license: string} : void; set_rating {new_rating: integer} : void; get_name : string; get_version : string; get_description : string; get_author : string; get_language : string; get_license : string; get_rating : integer; };

-- Definition of class software_review class software_review {

-- Attributes software: software; review: integer;

-- Constructors create {software: software; review: integer} : void;

-- Operations is_positive : boolean;

-- Getters and setters set_software {new_software: software} : void; set_review {new_review: integer} : void; get_software : software; get_review : integer; };

-- Implementation of class software implementation software {

-- Constructors create {name: string; version: string; description: string; author: string; language: string; license: string; rating: integer} : void do name := name; version := version; description := description; author := author; language := language; license := license; rating := rating; reviews := []; end;

-- Operations add_review {review: integer} : void do reviews.push(review); end;

get_average_rating : integer do if reviews.count = 0 then return 0; end;

average := 0;
for review in reviews do
  average += review;
end;

return average / reviews.count;

end;

is_popular : boolean do return get_average_rating() > 3; end;

-- Getters and setters set_name {new_name: string} : void do name := new_name; end;

set_version {new_version: string} : void do version := new_version; end;

set_description {new_description: string} : void do description := new_description; end;

set_author {new_author: string} : void do author := new_author; end;

set_language {new_language: string} : void do language := new_language; end;

set_license {new_license: string} : void do license := new_license; end;

set_rating {new_rating: integer} : void do rating := new_rating; end;

get_name : string do return name; end;

get_version : string do return version; end;

get_description : string do return description; end;

get_author : string do return author; end;

get_language : string do return language; end;

get_license : string do return license; end;

get_rating : integer do return rating; end; };

-- Implementation of class software_review implementation software_review {

-- Constructors create {software: software; review: integer} : void do software := software; review := review; end;

-- Operations is_positive : boolean do return review > 0; end;

-- Getters and setters set_software {new_software: software} : void do software := new_software; end;

set_review {new_review: integer} : void do review := new_review; end;

get_software : software do return software; end;

get_review : integer do return review; end; };

-- Example usage of class software and software_review create software {name: "MyApp", version: "1.0", description: "My awesome application.", author: "John Doe", language: "C++", license: "MIT", rating: 4} as my_app;

create software_review {software: my_app, review: 5} as review1; create software_review {software: my_app, review: 4} as review2; create software_review {software: my_app, review: 3} as review3;

my_app.add_review(review1.review); my_app.add_review(review2.review); my_app.add_review(review3.review);

my_app.get_average_rating(); -- Output: 4

if my_app.is_popular() then print("MyApp is popular."); else print("MyApp is not popular."); end; -- Output: MyApp is popular. ```

软件下载

评论已关闭!