Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I NEED HELP, HOW TO MAKE THIS CODE!!!

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I NEED HELP, HOW TO MAKE THIS CODE!!!

    ICS3U7Assignment: Shape Generator

    In the old days when pixel graphics are not widely supported by the monitors, text graphics were commonly used. Nowadays, it seems the pixel graphics is coming back in trend. Text graphics are pictures or images that are formed by text characters. Visit the following site to see some samples:

    Heart text arts (using text symbols) - fsymbols

    You will write a program that draws, only using *, a total of six different forms of 4 different shapes: lines, rectangle, triangle and trapezoid

    *********
    Horizontal line (length of 9)

    *
    *
    *
    *
    Vertical line (length of 4)

    *****
    *****
    *****
    Rectangle (width of 5, length of 3)

    *
    **
    ***
    ****
    *****
    Left slant right angle triangle (height of 5)


    *******
    *****
    ***
    *
    Isosceles triangle (upside down; height of 4)

    ****
    ******
    ********
    trapezoid (top base 4,height of 3)

    The user will specify the shape as well as the dimension of the shape.

    Your program should perform the following steps in order:
    1. Ask user for the choice of the shape (specified by numbers)
    i) Horizontal line
    ii) Vertical line
    iii) Rectangle
    iv) Left slant right angle triangle
    v) Isosceles triangle (upside down)
    vi) Trapezoid

    2. Ask user for the dimension of the shape (length for lines, length and width for rectangle, height of triangles, top base and height), maximum dimension is 20

    3. Draw the shape with specified properties

    4. Ask user if they want to continue
    • If user answers ‘y’ or ‘Y’ (for yes), repeat step 1 to 4
    • If user answers ‘n’ or ‘N’ (for no), the program will output the numbers of each shape that are drawn, then terminate the program

    Your program should validate all users’ input. If they are not valid, the program should continue prompting for input until they are correct.

    Here is a sample output of the program:

    Welcome to the Shape Generator:

    This program draws the following shapes:
    1) Horizontal Line
    2) Vertical Line
    3) Rectangle
    4) Left slant right angle triangle
    5) Isosceles triangle
    6) Trapezoid
    Enter your choice (1-5): 7

    Invalid choice! Your choice must be between 1 and 6.
    Enter your choice (1-5): 3

    Enter the width of the rectangle (1-20): 3
    Enter the length of the rectangle (1-20): 2

    Here is the rectangle:
    ***
    ***

    Would you like to draw another one (y/n)? Y

    This program draws the following shapes:
    1) Horizontal Line
    2) Vertical Line
    3) Rectangle
    4) Left slant right angle triangle
    5) Isosceles triangle
    6) Trapezoid
    Enter your choice (1-5): 1

    Enter the length of the horizontal line (1-20): -1

    Invalid dimension! The dimension must be between 1 and 20.
    Enter the height of the horizontal line (1-20): 25

    Invalid dimension! The dimension must be between 1 and 20.
    Enter the length of the horizontal line (1-20): 6

    Here is the horizontal line:

    ******

    Would you like to draw another one (y/n)? z

    Invalid input! Your input must be ‘y’ or ‘n’.
    Would you like to draw another one (y/n)? n

    Here is a summary of the shapes that are drawn.

    Horizontal Line 1
    Vertical Line 0
    Rectangle 1
    Right slant right angle triangle 0
    Isosceles triangle 0
    Trapezoid 0

    Thank you for using Shape Generator. Good Bye!!

    Save your program as Shape.java. Please mark sure to have the exactly same input and output format as shown above for full marks.

    Due Date: Friday, March 23, 2012

    Assessment:

    Application
    Correctness of Input (users’ input is validated): 10
    Correctness of Output (shapes are outputted correctly): 12

    Thinking / Inquiry
    Program Design (efficiency, choice of structure): 10

    Communication
    Documentation (program header, explanation of code): 5
    Submission (correct file names, on time) 5


    I know i need loops, i did while, do while, and for. Plz use these to help. Whoever helps, wille recieve $20 via Paypal. If u answer post ur email/ paypal ID and i will send u the money if satisfied, and the output is exactly the same


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I NEED HELP, HOW TO MAKE THIS CODE!!!

    Do you have any java programming questions? Or is this just a request for someone to write the code for you?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. How to make this code even simpler
    By blakmaze in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 30th, 2011, 03:00 PM
  2. How to make code more efficient?
    By Apocalypse in forum Java Theory & Questions
    Replies: 2
    Last Post: October 21st, 2011, 09:07 AM
  3. need help to make my code flexible.
    By sagar474 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 29th, 2011, 12:11 PM
  4. How to make HyperLink in java code?
    By abhiM in forum Java Theory & Questions
    Replies: 1
    Last Post: August 24th, 2011, 07:16 AM
  5. Make my code follow MVC
    By alpvii in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 29th, 2010, 07:48 AM

Tags for this Thread