Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Exercise: factor smiley#

Sumit Rawal answered on October 3, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Exercise: The Factorial!
  • Exercise: big smile
  • Exercise: smile method

  • Exercise: factor smiley#

    0

    The code below has a single static method called main. The process is declared using the keywords public static void, the name of the function, parentheses containing parameters for the position (String[] args), an open curly brace ({), and a closing curly brace (}).

    You have to do the following:

    Write three static methods: drawOutline, drawMouth, and drawEyes. These methods should take no parameters, and you can use the keywords public static void to define them. If you usually code in Python, don’t forget the curly braces.

    Factor the drawing code, except c.draw(), into these functions. Leave the code c = new Canvas(200, 200) in the main. The variable c will be available to all three tasks since it is declared in the class outside any function. This is necessary so that you can make calls to c.circle, etc.

    Call your functions from the main using drawOutline(), etc., to draw the smiley. (static methods within the same class can be called just like functions in other languages, so no dot (.) is required.) 

    I'm sharing more

    Popularity 1/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on Oct 03 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.