Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ee80473

Browse files
author
Jay Morales
committed
Add P1.9
1 parent 863a605 commit ee80473

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package progsolutions.ch01.p09;
2+
3+
import static java.lang.System.out;
4+
5+
/**
6+
* P0109.java
7+
*
8+
* @author Jay Morales
9+
*/
10+
class P0109 {
11+
/**
12+
* main.
13+
*
14+
* @param args args
15+
*/
16+
public static void main(String[] args) {
17+
out.println(" +");
18+
out.println(" + +");
19+
out.println(" + +");
20+
out.println("+-+-+-+");
21+
out.println("| .-. |");
22+
out.println("| | | |");
23+
out.println("+-+-+-+");
24+
}
25+
}

‎src/progsolutions/ch01/p09/README.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[Back](../README.md)
2+
3+
## P1.9
4+
5+
Write a program that prints a house that looks exactly like the following:
6+
7+
```bash
8+
+
9+
+ +
10+
+ +
11+
+-----+
12+
| .-. |
13+
| | | |
14+
+-+-+-+
15+
```
16+
17+
---
18+
19+
Solution:
20+
21+
```java
22+
import static java.lang.System.out;
23+
24+
class P0109
25+
{
26+
public static void main(String[] args)
27+
{
28+
out.println(" +");
29+
out.println(" + +");
30+
out.println(" + +");
31+
out.println("+-+-+-+");
32+
out.println("| .-. |");
33+
out.println("| | | |");
34+
out.println("+-+-+-+");
35+
}
36+
}
37+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /