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, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
Computers and Technology, 24.06.2019 15:30
How do i change the size of my bookmarks in my bookmarks bar in google chrome? ? plz hlp me
Answers: 2
Computers and Technology, 24.06.2019 21:50
The use of phrases, fragments, and punctuation can influence the mood of a passage; keeping this in mind, how would you describe the mood of the followingpassage? "fog on the essex marshes, fog on the kentish heights, fog creeping into the cabooses of collier-brigs; fog lying out on the yards, and hovering in the riggingof great ships; fog drooping on the gunwales of barges and small boats. fog in the eyes and throats of ancient greenwich pensioners, wheezing by thefiresides of their wards; fog in the stem and bowl of the afternoon pipe of the wrathful skipper; fog cruelly pinching the toes and fingers of his shivering little'prentice boy on deck." (5 points)
Answers: 2
Computers and Technology, 24.06.2019 22:30
Distinguish between a skill resume and a chronological resume and explain when it is best to use each format
Answers: 1
Learning Objectives:
• understand when to use the different
print statements
print statements
Mathematics, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
English, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
Business, 23.03.2021 20:20
Geography, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
English, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
Mathematics, 23.03.2021 20:20
Physics, 23.03.2021 20:20