Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that reads in a line of text and then outputs that line of text

ID: 3539271 • Letter: W

Question

Write a program that reads in a line of text and then outputs that line of text first in all uppercase letters and then in all lowercase letters.


INPUT and PROMPTS. The program prompts for a line of text as follows: "Enter the text: " and then reads in an entire line of text as a String .

OUTPUT . There are four lines of output . The first line is "The text in all upper case is: ". The second line is the line that was read in, displayed in all uppercase. The third line is "The text in all lower case is: " and the fourth line is the original line that was read in, displayed in all lowercase.

CLASS NAMES. Your program class should be called ShoutAndWhisper.

_________________________________________________________________________________________________________

This is what I have:


public class ShoutAndWhisper
import java.util.Scanner;
{

Scanner feedback = Scanner(System.in)
public static void main (Strnig[] args)
{
System.out.println("Enter the text: ");
feedback.next();
System.out.println("The text in all upper case is: ");
System.out.println(feedback.toUpperCase);
System.out.println("The text in all lower case is: ");
System.out.println(feedback.toLowerCase);
}
}


_________________________________________________________________________________________________________


I am getting these hints:


:
     %u21D2     You almost certainly should be using: String
     %u21D2     You almost certainly should be using: keyboard
     %u21D2     You almost certainly should be using: new


WHAT IS THE CORRECT CODE?

Explanation / Answer

import java.util.Scanner; public class ShoutAndWhisper { public static void main (String[] args) { Scanner feedback = new Scanner(System.in); System.out.println("Enter the text: "); String input=feedback.nextLine(); System.out.println("The text in all upper case is: "); System.out.println(input.toUpperCase()); System.out.println("The text in all lower case is: "); System.out.println(input.toLowerCase()); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote