The Artima Developer Community
Sponsored Link

Java Answers Forum
Shapes from Jave code

1 reply on 1 page. Most recent reply: Nov 14, 2002 6:49 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
James Smith

Posts: 1
Nickname: britbiker
Registered: Nov, 2002

Shapes from Jave code Posted: Nov 14, 2002 2:36 PM
Reply to this message Reply
Advertisement
Hi everyone, I've only been learning Java for 6 weeks now thought I may as well ask! Would anyone be able to advise how to go about writing code for this problem

(a)Develop a JAVA method(subroutine) using nested loops called solidDiamond, so that when called it will generate the type of pattern shown below. It should have a parameter called size that specifies the number of asterisks appearing along any side of the pattern. Show how it would be called to generate the pattern below. (can't show it here as the format won't work)

That is 5 lines with differing numbers of * on them, the first line has one * the second three *, the middle line five * the forth line again three * then the last line again one *. The first and last have been centred so that when they are all put together they form the shape of a diamond.


Any help would be great!
Take it easy
James ;)


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Shapes from Jave code Posted: Nov 14, 2002 6:49 PM
Reply to this message Reply
This incredible diamond-drawing homework technology was beaten to death in the old Java Answers Forum -- try searching the archives.

Flat View: This topic has 1 reply on 1 page
Topic: help with the display when printed Previous Topic   Next Topic Topic: Prime Integers

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use