ComputerForum.com ComputerForum.com  

Go Back   Computer Forum > General Chat > General Computer Chat

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 10-29-2009, 06:09 AM   #1 (permalink)
Silver Member
 
drdallon's Avatar
 
Join Date: Jul 2008
Location: Banks Oregon
Age: 18
Posts: 249
Default NEED HELP! w/programing.

Okay so i have an assignment due 3 days ago in programing, i was sick and couldnt get around to doing it all. I can still turn it in but i need some help i cannot for the life of me figure out how to code this.

The assignment is:

4) Write a class named MakeAPattern that reads a number of lines from the user then makes a pattern of stars in the Run I/O window as follows: If the user enters 7, the output should look exactly like:

*******

******

*****

****

***

**

*

The ‘algorithm’ is: the top line has the same number of stars as the user entered. The next line has one fewer stars, and so on. The last line has only one star.

Hints: You need a nested loop to do this. For the outside loop, use the variable holding the value you read from the user as your counter, and decrement the counter inside the loop instead of incrementing it as we normally do. Use a different counter for the inner loop and initialize it to the value currently held in the outer loop counter.

Finally, use:

System.out.print(‘*’) // caution: not java single quotes

to print a single star and System.out.println() to print an end-of-line.

We are using jGRASP. If some one could code or, or atleast point me in the right direction that would be a HUGE help!

Thank you!
__________________
Case:Antec Twelve Hundred Black Steel ATX
MoBo:EVGA 123-YW-E175-A1
CPU: Intel Core 2 Quad Q9550 Yorkfield 3.40GHz
CPU Cooler:TT120
GPU:EVGA GeForce GTX 260 Core 216 896MB 448-bit
RAM:OCZ Reaper HPC Edition 4GB
HD1:WD Caviar 500GB 7200 RPM SATA 3.0Gb/s
HD2:WD Caviar 160GB 7200 RPM SATA 3.0Gb/s
PSU:ABS Tagan BZ series 700W
OS:HD1:Windows Vista 64bit HD2:Windows XP professional x64
drdallon is offline   Reply With Quote


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:57 AM.


Powered by: vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.