473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Help With loops, nested loops and constant

I am working on trying to do a image but I am having a hard time figuring out the right steps. plus I wanted to check how to change the overall size do I just add public static final int SIZE = 4;

Expand|Select|Wrap|Line Numbers
  1. public class SpaceTest {
  2.         public static void main(String[] args) {
  3.         rod();
  4.         top();
  5.         line();
  6.         bottom();
  7.         rod();
  8.         middle();
  9.         top();
  10.         line();
  11.         }
  12.           //Draw Rod
  13.           public static void rod() {
  14.           System.out.println(" ");
  15.           for (int a = 1; a <= 4; a++) {
  16.         System.out.println("| |");
  17.         }
  18.         }
  19.             //Draw Top
  20.             public static void top() {
  21.           for (int space = 1; space <= (space * -3 + 12); space++) {
  22.             System.out.print(" ");
  23.         }
  24.  
  25.         System.out.print("__/");
  26.  
  27.         for (int dot = 1; dot <= (dot * 6 - 6); dot++) {
  28.             System.out.print(":");
  29.         }
  30.  
  31.         System.out.print("\\__");
  32.  
  33.         for (int space = 1; space <= (space * -3 + 12); space++) {
  34.             System.out.print(" ");
  35.         }
  36.           }
  37.             //Draw Line
  38.             public static void line() {
  39.               System.out.print("|");
  40.                 for (int bar = 1; bar <= 12; bar++) {
  41.                     System.out.print("\"\"");
  42.                 System.out.print("|");
  43.             }
  44.             }
  45.             //Draw Bottom
  46.             public static void bottom() {
  47.                 for (int space = 1; space <= (space * 2 - 2); space++) {
  48.             System.out.print(" ");
  49.         }
  50.  
  51.         System.out.print("\\__");
  52.  
  53.         for (int wave = 1; wave <= (wave * -2 + 13); wave++) {
  54.             System.out.print("/\\");
  55.         }
  56.  
  57.         System.out.print("__/");
  58.  
  59.         for (int space = 1; space <= (space * 2 - 2); space++) {
  60.             System.out.print(" ");
  61.         }
  62.           }
  63.             //Draw Middle
  64.             public static void middle() {
  65.                System.out.println(" ");
  66.           for (int a = 1; a <= 11; a++) {
  67.         System.out.println("|%%||%%|");
  68.        }
  69.      }    
  70.   }
  71.  
The image is really off and some of my methods don't even show but it compiles.

Trying to get this image if any one can help.

||
||
||
||
__/||\__
__/:::||:::\__
__/::::::||::::::\__
__/:::::::::||:::::::::\__
|""""""""""""""""""""""""|
\_/\/\/\/\/\/\/\/\/\/\/\_/
\_/\/\/\/\/\/\/\/\/\_/
\_/\/\/\/\/\/\/\_/
\_/\/\/\/\/\_/
||
||
||
||
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
|%%||%%|
__/||\__
__/:::||:::\__
__/::::::||::::::\__
__/:::::::::||:::::::::\__
|""""""""""""""""""""""""|
Jan 17 '08 #1
2 1250
r035198x
13,262 8TB
I am working on trying to do a image but I am having a hard time figuring out the right steps....
That would be an algorithm. You write down your algorithm first before you start writing the code.
Jan 17 '08 #2
BigDaddyLH
1,216 Expert 1GB
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Jan 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: JustSomeGuy | last post by:
I have a need to make an applicaiton that uses a variable number of nested for loops. for now I'm using a fixed number: for (z=0; z < Z; ++z) for (y=0; y < Y; ++y) for (x=0; x < X; ++x)
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
6
by: James Brown [MVP] | last post by:
Hi, I am having trouble understanding how the 'const' modifier affects the 'left-right' rule when deciphering c-declarations: const int *x; // x is a pointer to a 'const int' int const *x; ...
1
by: tkempy | last post by:
okay so i have a CIS class called abstraction and design. i'm completely new to this "java" stuff. I've never seen any of it in my life. our second homework is to create a program that produces a...
5
by: ertis6 | last post by:
Hi all, I need to calculate a value inside 8 nested for loops. 2 additional for loops are used during calculation. It was working fine with 4 loops. My code is like this: ... for(int i1=0;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.