Question: public class A 0 1 { public static void main ( String [ ] args ) { / / part 1 System.out.print ( x

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:
x x xx o xx x x
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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!