The following Java program prompts the user and reads in a line
3 Pages489 Words326 Views
Added on 2019-09-16
BookmarkShareRelated 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);
Found this document preview useful?
Related Documents
The Java Programming Documentlg...
|19
|2557
|43
Java Programming Assignment: Comma-Separated Integer Inputs and Exception Handlinglg...
|8
|937
|481
Fundamentals of Operating Systems and Java Programminglg...
|14
|763
|260
Pizza Order System : Projectlg...
|11
|1011
|95
Memory Sequence Game - Java Program for Console Based Gamelg...