Write a main method that reads in a single string

Assignment Help JAVA Programming
Reference no: EM13886170

PART A: TEXT TRIANGLE

Write a method that uses recursion to print an input string in the shape of a triangle, where the legs of the triangle are the first and last letters of the string and the base is the complete string; the contents are made up of the letters in between.

For example, given the string "abcdefghij", the corresponding text triangle looks like this:

    aj
   abij
  abchij
 abcdghij
abcdefghij

If there are an odd number of letters in the string, the first line will only have one character (use the first letter); "abcdefghi" generates:
     a
    abi
   abchi
  abcdghi
 abcdefghi

You should write a method called trianglePrint (Strings) that uses recursion to print s as a text triangle. Note that this method does not have enough parameters to do the job, it will need to call another method to solve the problem recursively.

Since your answer is recursive, there should be no loops anywhere in your program. You may want to write more than one recursive method (the triangle printer, and a helper method).

Write a main method that reads in a single string and calls trianglePrint with that string.

Hand in your Java source code, and the output generated (text triangles) for the following two strings (without the quotes): "disestablishmentarianism" and "+- ! '# =-= #* ! -+" (note the five spaces in the second one).

PART B: ORDER UP, THE LAST TIME

Once you've done part A, do it again, except replace the Ar rayLi st with your own linked list implementation. Do it any way you like, as long as the data gets stored in a linked list and stays there (that is, you're not allowed to copy it to or from an array or array list, for sorting or any other purposes).

Reference no: EM13886170

Questions Cloud

What would be the average velocity : A parabolic profile is desired in 20-C air as it passes between two parallel plates that are 80 mm apart in a university laboratory. If the Reynolds number Vh=n ¼ 1500, how long would the channel need to be to observe a fully developed flow, i.e.,..
Is the laminar flow assumption reasonable : A parabolic velocity profile is desired at the end of a 10-m-long, 8-mm-diameter tube attached to a tank filled with 20-C water. An experiment is run during which 60 L is collected in 90 min. Is the laminar flow assumption reasonable? If so, would..
Write program in java that solves system of linear equations : Write a program in java that solves system of linear equations. Users should be able to input the number of variables.
Explain access control methods and attacks : Explain access control methods and attacks
Write a main method that reads in a single string : Write a main method that reads in a single string and calls trianglePrint with that string. Write a method that uses recursion to print an input string in the shape of a triangle
Is the flow laminar or turbulent as it leaves the opening : The Red Cedar River flows placidly through MSU's campus at a depth of 80 cm. A leaf is observed to travel about 1 m in 4 s. Decide if the flow is laminar or turbulent. Make any assumptions needed.
Material or immaterial to the financial statements : The fraud was not detected by the external auditors.
The size ofthe character array holding your filename : How to express for code "THE SIZE OF THE CHARACTER ARRAY HOLDING YOUR FILENAME >=1024 (or use strings), we need to use long file names when grading your code."
Write one page about e-id verification topic : Write one page about E-Id verification topic - IEEE Spectrum IEEE Communications Magazine IEEE Network Magazine IEEE Personal Communications Magazine Communications of the ACM Sources.

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