logo

The following Java program prompts the user and reads in a line

3 Pages489 Words326 Views
   

Added on  2019-09-16

The following Java program prompts the user and reads in a line

   Added on 2019-09-16

ShareRelated Documents
The following Java program prompts the user and reads in a line of text, then displays the text. The class name is A9. You should not change the class name./** * A simple program that prompts the user * for a line of text. */import java.util.Scanner;public class A9 { public static String getPhrase () { Scanner input = new Scanner(System.in); System.out.print ("Enter a phrase: "); String phrase = input.nextLine(); return phrase; } public static void reportPhrase (String phrase) { System.out.println (phrase); } public static void printHistogram (String phrase) { // Your code here } public static void main(String args[]) { String phrase; phrase = getPhrase (); reportPhrase (phrase);
The following Java program prompts the user and reads in a line_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
The Java Programming Document
|19
|2557
|43

Java Programming Assignment: Comma-Separated Integer Inputs and Exception Handling
|8
|937
|481

Fundamentals of Operating Systems and Java Programming
|14
|763
|260

Pizza Order System : Project
|11
|1011
|95

Memory Sequence Game - Java Program for Console Based Game
|8
|998
|259

Object-oriented Software Development
|9
|1222
|17