SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 3 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 16 Oct 2017 My Price 10.00

Java application that executes the following 5 recursive methods,

i need help for jgrasp to the program. see instructions below. please put comments

Java application that executes the following 5 recursive methods, each of which returns a value (do NOT use System.out.print() inside the method definitions), and prints that value in the main() method, where x is a positive integer on the commandline (1st argument), and s is a String on the commandline (2nd argument).Method 1: Return and print in main() x number of s (ssss...), in other words print the String s, x times. 

Method 2: Return and print in main() the first character in s, x number of times (ssss...), where "s" is the first letter in String "s".

Method 3: Return and print in main() each letter in s two times (s0s0s1s1s2s2s3s3...) where s0 is the first letter, s1 is the second letter, s2 is the third letter, etc.

Method 4: Return and print in main() each letter in s three times backwards (sn-1sn-1sn-1sn-2sn-2sn-2sn-3sn-3sn-3sn-4sn-4sn-4...) where sn-1 is the last letter, sn-2 is the second to last letter, sn-3 is the third to last letter, etc. 

Method 5: Return and print in main() a String which counts down by 1 for x, and deletes one letter for each recursion for s, until x becomes 1, or until s has only 1 letter (x s, x-1 s1 letter deleted, x-2 s2 letters deleted, x-3 s3 letters deleted...)

Use the commandline arguments to enter one positive integer (a number) as 1st argument, and a String (a word) as the 2nd argument. see this webpage for instructions on commandline arguments.

You need to convert the 1st commandline argument to an integer:

Integer number = Integer.parseInt(args[0]);

Note that "number" is the same as "x" in the above explanation.

You need to store the 2nd commandline argument in a String variable:

String word = args[1];

Note that "word" is the same as "s" in the above explanation.

You may find it useful to use more than one parameter for some of your methods.

At the beginning of the main method, check to make sure that the user entered the correct input. If exactly one (1) positive integer argument is not entered on the commandline, then display an error message and end the program.

You also need to have a try-catch statement just in case a non-integer is inputted as a commandline argument.

Make sure your code follows the ICs 211 Java Coding standard, in particular the Java documentation (Javadoc) comments that go above each method.

 

Output

  1. Example output for commandline arguments 5 natto
nattonattonattonattonatto
nnnnn
nnaattttoo
ooottttttaaannn
5 natto, 4 atto, 3 tto, 2 to, 1 o,
    
  1. Example output for commandline argument 10 ten
tentententententententententen
tttttttttt
tteenn
nnneeettt
10 ten, 9 en, 8 n, 
    
  1. Example output for commandline argument 10 abracadabra
abracadabraabracadabraabracadabraabracadabraabracadabraabracadabraabracadabraabracadabraabracadabraabracadabra
aaaaaaaaaa
aabbrraaccaaddaabbrraa
aaarrrbbbaaadddaaacccaaarrrbbbaaa
10 abracadabra, 9 bracadabra, 8 racadabra, 7 acadabra, 6 cadabra, 5 adabra, 4 dabra, 3 abra, 2 bra, 1 ra, 

Answers

(5)
Status NEW Posted 16 Oct 2017 07:10 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)