Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CSE 230 505 object-oriented Computing I Spring 2017 Lab 9: Overview This lab coe

ID: 3820151 • Letter: C

Question

CSE 230 505 object-oriented Computing I Spring 2017 Lab 9: Overview This lab coertains a few independent exercises recursion, intended to give the general flavor of using to solve problems. Each of the exercises is more or independent, though they are to be completed in a single project. For each method write the indicated method(s) and print (oeily) the requested text to the console. Part One Setup Create a new project using the customary namingscheme. For this lab, you willonly need the class NetBears creates automatically. Part Two Lab Exercises Complete each of the following exercises Be sure to include comments describing what eachof your methods does, including a description of the method itself, along with any parameters and the returm value. Use descriptive comments and Javadoc comment style. You may not loops in this lab. Doing so teill reault in a zero for the eneroiae. Exercise 1 Write a method called countdovno which receives an integer and prints a countdown starting from the given value and ending with Lift Off". Use exactly the formatting in the example below. The entire countdown should be printed single line, with a new line appearing after the "Lift Off!T For example, countdownC3) should print the following: 3... 2... 1. Lift Off Call countdown G) from main, pasaking in the value 6, and then print an extra newline. Exercise 2 Write a method called nississippivrappero which receives integer, n 0 and returns a string oonsist- ng of the letter "M" followed by m instances of followed by "ppi Thus, nississippikirapper C20 should return "Mississippi'. Use a method called mississippiHelperO to actually perform the recursaou and generate the sequemce of 'iss es. Print the result of calling nisaissippivraperC5). followed by a blank line. Exercise 3 Write a method called nississippio which works like nississi ppivrappero but doesnot use a method handle the recursion. This method will only be called by other thing with n 0, but you may call itself however you wish. Once again, nississi should return "Miseissippi ppi(2) Print the result of calling nississippi (4). followed by a blank line.

Explanation / Answer

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Example1
{
public static void main (String[] args) throws java.lang.Exception
{
  // your code goes here
  countdown(6);
System.out.println(doublePlusOne(16));
  }
public static void countdown(int n){
  if(n>0){   
  System.out.print(n+"..."); //on smae line print()
  countdown(n-1);
  }else{
   System.out.println("Lift Off!");//print and nextlin-println()
  }
  
}
public static int doublePlusOne(int n){
if(n==1)
return 1;
else
return 2*doublePlusOne(n-1)+1;

}
}

2nd 3rd please post cleear image