Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 136,223 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,319 people online right now. Registration is fast and FREE... Join Now!




how to display a simple graphic shape using text symbols

 
Reply to this topicStart new topic

how to display a simple graphic shape using text symbols

NeoTifa
14 Oct, 2008 - 08:41 AM
Post #1

oohhhh, i get one nao!!!
****

Joined: 24 Sep, 2008
Posts: 968



Thanked: 4 times
My Contributions
so, like, i have a new project, and i totally do not know how to even go about it. XD
QUOTE

"Project 3"

The purpose of this project is to provide you with more practice using conditional statements, loops, and methods. Your task is to write a program that allows a user to display a simple graphic shape using text symbols. Four basic shapes are allowed: box, right triange, isoceles triange, and a diamond. Each shape has two forms: filled or unfilled. The shapes are defined as follows:

B F 4 6:

******
******
******
******

B U 4 6:

******
* *
* *
******

R F 5

*
**
***
****
*****

R U 5

*
**
* *
* *
*****

I F 7

*
***
*****
*******

I U 7

*
* *
* *
*******

D F 5

*
***
*****
***
*

D U 5

*
* *
* *
* *
*

Your project should provide an interactive menu system that allows a user to select the type of object to display. The following menu items must be provided: B, R, I, D and Q. The meanings of these items are B -- box, R -- right triangle, I -- isosceles triangle, D -- diamond and Q -- quit. The letter indicates which shape to display and will always be followed by a space and a letter F or U indicating a filled or unfilled shape. Valid input can be uppercase as well as lowercase characters. All other letters entered as command inputs are considered invalid. Provide a mechanism to allow a user to recover from an error. For example, if the user enters an invalid menu item, do not terminate the program. Inform the user that an error has occurred and display messages to guide the user to select a proper menu item. If an error does occur, make sure to clear the input buffer using input.nextLine() where input is a Scanner object.

Once a valid menu item is detected, prompt the user for each parameter needed to satisfy the selected operation. Make sure to check the validity of the parameters. You may assume that a numeric value will be input when a number is expected, however the number may not be acceptable based on the limitations outlined in the table. You must give the user three (3) tries to correct their numeric input. If after the third attempt the user still has not entered valid numeric data, then return them to the main menu.

For full credit, you must use methods to display the shapes.


i dont even know how to begin with the shape printing stuff. better yet, i get an email saying that were not even allowed to use JOptionPane, so no gui. sad.gif halp!!!

ph34r.gif


edit: why didnt the spaces show up!!!!! all my shapes look ghey now sad.gif

This post has been edited by jayman9: 14 Oct, 2008 - 12:47 PM


Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post

Gloin
RE: How To Display A Simple Graphic Shape Using Text Symbols
14 Oct, 2008 - 10:09 AM
Post #2

On MeD.i.Cation
Group Icon

Joined: 4 Aug, 2008
Posts: 723



Thanked: 47 times
My Contributions
As you already noticed, I posted a partial solution to your problem in another thread. I will however not give you the entire solution to your assignment, simply because you wouldn't learn as much from it as if you solved it yourself. Consider the solution I posted a freebee. It's probably alot more advanced than what is expected fom you.
Some advice however, make a simple solution first so you have something to show, then you can start looking for some algorithm to solve the probem mathematically.
Start with an easy problem like,

B F 4 6:

******
******
******
******

Loop over 4 rows (using one for-loop)
with 6 *s on each row (another for-loop within the first)

User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: How To Display A Simple Graphic Shape Using Text Symbols
14 Oct, 2008 - 10:35 AM
Post #3

I vill break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,393



Thanked: 6 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

My Contributions
I should close this just because of the title tongue.gif
User is offlineProfile CardPM
+Quote Post

NeoTifa
RE: How To Display A Simple Graphic Shape Using Text Symbols
14 Oct, 2008 - 10:41 AM
Post #4

oohhhh, i get one nao!!!
****

Joined: 24 Sep, 2008
Posts: 968



Thanked: 4 times
My Contributions
NOOO dont do that!!!! turns out the reason why i dont know how to do that yet is because were going over it tomorrow in the lab lol. but im still clueless as to how it would line up. like, i know * is not equal to one space, so on the hollow shapes, how could i line those up? is there some type of text formatting code for java?
User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: How To Display A Simple Graphic Shape Using Text Symbols
14 Oct, 2008 - 10:55 AM
Post #5

I vill break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,393



Thanked: 6 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

My Contributions
QUOTE(NeoTifa @ 14 Oct, 2008 - 02:41 PM) *

NOOO dont do that!!!! turns out the reason why i dont know how to do that yet is because were going over it tomorrow in the lab lol. but im still clueless as to how it would line up. like, i know * is not equal to one space, so on the hollow shapes, how could i line those up? is there some type of text formatting code for java?



I was kidding.

But can we maybe think of a better title? smile.gif
User is offlineProfile CardPM
+Quote Post

Gloin
RE: How To Display A Simple Graphic Shape Using Text Symbols
14 Oct, 2008 - 11:12 AM
Post #6

On MeD.i.Cation
Group Icon

Joined: 4 Aug, 2008
Posts: 723



Thanked: 47 times
My Contributions
I don't think you should worry about the text formatting. The teacher only wants to know if you can solve the problem and get the correct output, not so much what the output looks like..

This post has been edited by Gloin: 14 Oct, 2008 - 11:13 AM
User is offlineProfile CardPM
+Quote Post

NeoTifa
RE: How To Display A Simple Graphic Shape Using Text Symbols
15 Oct, 2008 - 06:25 AM
Post #7

oohhhh, i get one nao!!!
****

Joined: 24 Sep, 2008
Posts: 968



Thanked: 4 times
My Contributions
sad.gif ok...... but still, is there a text formatter?


and what kinda math is involved with this?! XD gah!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 02:59AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month