Write a complete java program called recursivetriangle

Assignment Help JAVA Programming
Reference no: EM131588570

I have created a regular RecursiveTriangle (method calling itself) to create a Triangle using the number of lines and String I enter.

I need to reverse the order of the Triangle (so for example if I enter 3 for the number of lines and A for the string the output would be

AAA
AA
A

USING RECURSIVE methods. Here is the question below.

Write a complete Java program called RecursiveTriangle according to the following guidelines.
Modify the example in Horstmann Section 5.9, pp. 228-230 so that the triangle displays "in reverse order" as in the example below, which allows the user to set the number of lines to print and the String used for printing the triangle.
Use a method to prompt the user for the number of lines (between 1 and 10) to print. This method should take no parameters and return an int value.
Use a method to prompt the user for the string to be used when printing the pattern. This method should take no parameters and return a String value.
Use a method called printTriangle that takes an int and a String as parameters (i.e., the return values from the two methods mentioned above) and has no return value. That method should use recursion to print the "reversed triangle" as in the following example.
EXAMPLE: The call to printTriangle(numLines, pattern) should print the following, assuming numLines has the value 4 and pattern has the value "[]".
[][][][]
[][][]
[][]
[]

Attachment:- RecursiveTriangle.zip

Reference no: EM131588570

Questions Cloud

Describe the potential impact of your proposed controls : Describe the potential impact of your proposed controls on the morale of the couple in charge of the day-to-day operations.
How can you determine the legitimacy of the transaction : How can you determine the legitimacy of the transaction given these facts so that payment can be issued
Create a sexual harassment policy : Create a diversity policy for your selected company to mitigate discrimination on the basis of race, color, religion, sex, national origin, sexual orientation.
Determine support reactions and forces in the springs : Determine support reactions and forces in the springs when the assembly is forced to close the gap g, as shown in the Figure.
Write a complete java program called recursivetriangle : Created a regular RecursiveTriangle (method calling itself) to create a Triangle using the number of lines and String I enter -
What is angel basic earnings per share : During 2016, Angel Corporation had 900,000 shares of common stock, What is Angel's diluted earnings per share for 2016, rounded to the nearest cent
Problem related to the fixed-end beam : A fixed-end beam is subjected to a concentrated load at the midspan P.= 200 Ib, as shown in Figure. The beam has a rectangular cross section with width =12 in.
Discuss the purpose of each states reform : Describe a minimum of three specific examples of similarities and differences in healthcare reform policies in the two states.
Write test code to create several pizzas : Write test code to create several pizzas and output their descriptions. For example, a large pizza with one cheese, one pepperoni and two ham toppings

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd