print statements
Computers and Technology, 30.11.2021 01:00, reyrey216
Learning Objectives:
• understand when to use the different
print statements
• create a variable and assign it a value
• use Scanner to read in user input
• print the value of a variable using
printf
Output:
US state: Texas
Capital: Austin
The capital of Texas is Austin
Description:
Copy and paste the code below:
/
* Name:
* Assignment: A01
/
public class A01{
public static void main(String[] args){
// part1
System. out. print("x x x");
System. out. print("x o x");
System. out. print("x x x");
System. out. println();
// part2
}
}
Write your name in the comment on top. The red letters in the output are the user inputs.
This assignment consists of 2 parts.
First you demonstrate your understanding of the different print statements by modifying a
code segment. Then you read in two Strings and print a statement based on the user input.
Part1:
The code segment provided includes
three print statements that produce
the following output:
Change the code segment so that it
produces the following output:
Hint: you will need to change the number of
statements
Part2:
• Prompt the user to enter a state
• Read in the user response and assign
it to a String variable named state
Hint: before you can assign a value to the
variable state it needs to be declared
• Prompt the user to enter the name of
the capital
• Read in the user response and assign
it to a String variable named capital.
• Use printf and format specifiers to
print the following message:
The capital of state is capital
where you substitute state and capital with
the state and capital entered by the user.
Make your output look exactly like the output displayed above.
Make sure to read in the input next to the prompt but without touching it (use a blank to
separate the prompt from the user input). The output should use a single empty line to
separate the frog displayed in part1 from the output created in part2.
Answers: 2
Computers and Technology, 22.06.2019 10:30, darrengresham999
Choose the best explanation for the following statement communication is symbolic
Answers: 3
Computers and Technology, 22.06.2019 16:00, sdonachy7
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
Computers and Technology, 23.06.2019 21:30, mariah10455
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
Computers and Technology, 24.06.2019 19:00, cxttiemsp021
Luis is cloud-based( microsoft bot framework). true false
Answers: 1
Learning Objectives:
• understand when to use the different
print statements
print statements
Mathematics, 01.09.2019 21:30
History, 01.09.2019 21:30
History, 01.09.2019 21:30
Mathematics, 01.09.2019 21:30
English, 01.09.2019 21:30