联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-02-11 10:45

Homework 9

The goal of this homework is to practice template method pattern. In the sorting algorithm

that we implement using the abstract factory pattern, the source code of which is in

http://www.cse.msu.edu/~alexliu/courses/335Spring2019/lectures/ExampleSourceCode_C++

AbstractFactorySorting.zip, recall that we implemented two algorithms sortDecreasing and

sortIncreasing in the algorithm class BubbleSort. In this homework, you are asked to use the

template method pattern to refactor (i.e., redesign) this algorithm class. You also need to

draw the UML diagram. You need to design classes so that the following main function will

output the following. Your program must use this main function.

int main(int argc, char** argv) {

IntegerVectorSortable ivs;

ivs.insertInteger(5);

ivs.insertInteger(4);

ivs.insertInteger(6);

ivs.insertInteger(10);

cout<<"***************** Before Sorting Integers Decreasing"<<endl;

ivs.print();

cout<<"***************** After Sorting Integers Decreasing"<<endl;

BubbleSortDecreasing bsd;

bsd.sort(&ivs);

ivs.print();

cout<<"***************** After Sorting Integers Increasing"<<endl;

BubbleSortIncreasing bsi;

bsi.sort(&ivs);

ivs.print();

return 0;

}

Due: February 13th, 11:59PM, 2019.

Turn in one file via handin: the zip file of (1) your whole NetBean directory and (2) your UML

digram file named uml.pdf. The name of your zip file should be: LastName_FirstName.zip. For

example, if your name is John Smith, you should turn in one files: Smith_John.zip.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp