2 Replies - 834 Views - Last Post: 31 January 2013 - 02:45 PM Rate Topic: -----

#1 sasoriPre  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 31-January 13

Help needed here

Posted 31 January 2013 - 02:28 PM

Could someone give me some hints or clues about what i am trying to make
im making a program were i input the width,length and border of the program
Example:
width : 10
length : 10
border : 2
so output is
++++++++++
++++++++++
++      ++
++      ++
++      ++
++      ++
++      ++
++      ++
++++++++++
++++++++++


here my code so far
and i cant find why it wont work

import java.util.Scanner;
public class Edze {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int row, col, bor;
System.out.println("Enter row: ");
row = input.nextInt();
System.out.println("Enter col: ");
col = input.nextInt();
System.out.println("Enter bor: ");
bor = input.nextInt();
for(int i = 1; i < row; i++){
	if (i==1 || i == row)
		System.out.print("*");
	else 
		System.out.print(" ");
        for(int j = 1; j < col; j++){
        	if(j==1 || j==col)
        		System.out.print("*");
        	else 
        		System.out.print(" ");
        	for(int k = 1; k < bor; k++){
        		if(k==1 || k==bor)
        			System.out.print(" ");
        		else 
        			System.out.print(" ")
        	}
        }
}
System.out.print(" ");
}
}



sorry the output should be
++++++++++
++++++++++
++spaces++
++spaces++
++spaces++
++spaces++
++spaces++
++spaces++
++++++++++
++++++++++

This post has been edited by GregBrannon: 31 January 2013 - 02:45 PM
Reason for edit:: Fixed code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Help needed here

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10196
  • View blog
  • Posts: 37,655
  • Joined: 27-December 08

Re: Help needed here

Posted 31 January 2013 - 02:32 PM

Moved to Java. Please don't post programming questions in the Student Campus forum.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2891
  • View blog
  • Posts: 9,599
  • Joined: 12-December 12

Re: Help needed here

Posted 31 January 2013 - 02:45 PM

It what sense does it not work? What errors do you receive? Or what output does it create?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1