Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CS210 Assignment #1
- //Adam Szablya
- public class Chapter1Ex11 {
- public static void triangle()
- {
- /*
- for(int d = 3; d!=0;--d)
- {
- for(int ds=3; ds>d; ds++)
- {
- System.out.print(" ");
- }}
- System.out.println("/");
- for(int s = 0; s<3;++s)
- {
- for(int i=0; i<s; i++){
- System.out.print(" ");
- }
- System.out.println("\\ ");
- }*/
- String forward = "/";
- String backward = "\\";
- String space = " ";
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < 3; i++) {
- for (int j = 3 - i; j > 0; j--) {
- sb.append(space);
- }
- sb.append(forward);
- for (int j = 0; j < i * 2; j++) {
- sb.append(space);
- }
- sb.append(backward);
- sb.append("\n");
- }
- System.out.println(sb.toString());
- }
- public static void BodyOne()
- {
- System.out.println("+------+ +------+");
- for(int r =0; r<3;++r){
- for(int f=0; f<2;f++)
- {
- if(r == 1 && f == 0)
- {
- System.out.println("+------+ +------+");
- System.out.println("|United| |United|");
- }
- if(f== 1 && r == 1)
- {
- System.out.println("|States| |States|");
- System.out.println("+------+ +------+");
- }
- else
- System.out.println("| | | |");
- }
- }
- System.out.println("+------+ +------+");
- }
- public static void main(String[] args) {
- triangle();
- BodyOne();
- triangle();
- for(int re = 0; re < 1; re++){
- System.out.print(" ");
- for(int repe = 0;repe<=re; repe++){
- triangle();
- BodyOne();
- triangle();
- //System.out.print(" ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement