forked from haonlywan/CodeHS-Java-APCSA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.7.9 QuoteMachine
More file actions
23 lines (20 loc) · 773 Bytes
/
2.7.9 QuoteMachine
File metadata and controls
23 lines (20 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class QuoteMachine
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
// Ask for a quote
// Ask for the author
System.out.println("Enter a quote:");
String userQuote = input.nextLine();
System.out.println("Enter the author of the quote:");
String authQuote = input.nextLine();
// Create a new String that has the quote in quotation marks
// Don't forget to escape the quotation marks
String usQuote = "\"" + userQuote + "\"";
// Print the quote, then the author on the next line
// But you can only use ONE print statement!
System.out.println(usQuote + "\n" + authQuote);
}
}