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

  Write a java program and pseudocode to read a number

Write a java program and pseudocode to read a number up to 15 digits long or a date (dd/mm/yyyy). The program should distinguish numbers from input date, and prints them in alphabetic spelling form

  Punished for minor infractions given their mental illness

What if you a Disciplinary Hearing Officer in a unit with mentally ill inmates? How would you sanction offenders for infractions without punishing them for their illnesses? Do you think they should be punished for minor infractions given their mental..

  Write class encapsulating the concept of weather forecast

Write a class encapsulating the concept of the weather forecast, assuming that it has the given attributes: the temperature and the sky conditions, which could be sunny, snowy, cloudy, or rainy.

  Complier error and run time error

Q1. What do you understand by complier error and run time error? Explain by example.

  Write a program that takes 10 values representin

Using a loop, write a program that takes 10 values representin exam grades (between 0 and 100) from the keyboard and outputs the minimum value, maximum value, and average value of all the values entered. Your program should not accept less than 0 ..

  Modify the java application using java netbeans ide

Modify the Java application using Java NetBeans IDE to meet these additional and changed business requirements

  Write a program that collects three strings

Write a program that collects three Strings from the user. Display the three strings in alphabetical order regardless of the order in which they were input.

  Rock-paper-scissors :- java problem

Design decision marks are based on how you implemented our programs/classes.

  Develp a simple model of an object-oriented system

you are going to develp a simple model of an object-oriented system. this model should be able to provide all the working examples of inheritance, encapsulation, and polymorphism through the use of class,. methods, and objects

  Create a program that automatically generates words

Create a program that automatically generates words from letters Solution

  Write a scanner that translates logical expressions

Write a scanner that translates logical expressions. There are many different notations for logical expressions.

  Java programming arrays

Write a Java application program that takes in user input from keyboard and calculate semester grade based on the scores. In this assignment, you are going to rewrite the program, instead of taking keyboard input, you will use dialog box to prompt..

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