联系方式

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

您当前位置:首页 >> Java编程Java编程

日期:2018-11-02 10:31

Lab 10:  Practicing Recursive Functions


Learning Objectives:  The objective of this lab is to gain experience with writing recursive functions.


Assignment: Write in Java programming language for the following recursive functions (no credit for iterative implementations) and Write a main method to test the functions

a.Write a recursive function writeLine() that writes a character repeatedly to form a line of n characters. For example, writeLine('*',5) should produce the line *****.

b.Write a recursive function writeBlock() that uses the method writeLine() to write m lines of n characters each. For example, writeBlock('*',5,3) should produce the following output:

*****

*****

*****


c.Write a recursive function writeBackward() that write a given string of characters in reverse order.  For example, writeBackward(“abcde”, 5) should give the output: edcba


d.Write a recursive function displayArrayList(ArrayList<int> A, int first, int last) that receives an ArrayList A, first index, last index and displays the ArrayList in order


e.Write a recursive function int vowels(String s, int size) that receives a string and returns the number of vowels in the string


f.Write a recursive function void ReverseString (String s)  that receives a string and print the string backwards.  


Submission


Follow our class coding standard to complete this lab, compile and run it, check out for credit.


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

python代写
微信客服:codinghelp