首页 > > 详细

method pattern讲解、辅导C++程序设计、C++设计辅导、辅导FactorySorting 辅导R语言编程|辅导R语言程序

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"< ivs.print();
cout<<"***************** After Sorting Integers Decreasing"< BubbleSortDecreasing bsd;
bsd.sort(&ivs);
ivs.print();
cout<<"***************** After Sorting Integers Increasing"< 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.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!