Labs
- Write a program that prompts the user for a list of five integers. Place each of the numbers in a separate variable, then:
- Print each of the numbers separated by a space.
- Print each of the numbers separated by a tab.
- Print each of the numbers separated by a newline.
(Solution: FiveIntegers.java)
- Write a program that prompts the user for a String department code, a floating-point salary, and an integer employee id. Put each of the items in a separate variable, then:
- Print each of the items and a string literal label separated by a space.
- Print each of the items and a string literal label separated by a tab.
- Print each of the items and a string literal label separated by a newline.
(Solution: ThreeVariables.java)
- Write a program that prints out your initials as a large banner, with each large letter made up of the same letter. Don't prompt the user to enter initials, just hard code your initials. Here's what we mean for the output:
GGGGG EEEEEEE BBBBBB
G E B B
G E B B
G GGG EEEEE BBBBBB
G G E B B
G G E B B
GGGGG EEEEEEE BBBBBB
(Solution: BigLetters.java)
- Write a program that uses your initials to draw a picture of a house. Print the roof in the method
static void printRoof()and the floor in the methodstatic void printFloor(). (Make sure to call the two methods frommain).
EEEE
BBBBBBBB E E
B BE E
B BE
B B
B B
G GGGG GGGG G
G G G EEEEE G G G
G GGGG E E GGGG G
G E EE G
G E E G
GGGGGGGGGGGGGGGGGGGGGGG