Instructions A Set up the compiler on your workstation B Wri

Instructions:

A. Set up the compiler on your workstation.

B. Write, compile, and run a Java program that:

(1) uses a single line comment to document your source code with your name and

section number. This should be the veryfirst line of your program,

(2) uses a printin statement to print your name and section number as the first line of

your output,

(3) prompts the user to type 5 characters such as a 5 digit number,

(4) calls a PARAMETERLESS void, recursive function named \"reverse\" to print the

character/number backwards.

C. Diagram (i.e. illustrate with a picture) your program completely.

Solution

Answer B

import java.io.*;
class Reverse{
public static void main(String args[])
{
StringBuffer sb1= new StringBuffer();
Console con = System.console();
System.out.println(\"Enter 5 letters or numbers\");
sb1.append(con.readLine());
sb1.reverse();
System.out.println(sb1);
}}

Instructions: A. Set up the compiler on your workstation. B. Write, compile, and run a Java program that: (1) uses a single line comment to document your source

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site