This site requires JavaScript, please enable it in your browser!
Greenfoot back
Sauravbasyalking12
Sauravbasyalking12 wrote ...

2020/9/15

Could u help 3 question scenario

Sauravbasyalking12 Sauravbasyalking12

2020/9/15

#
In your Food class:1.Create two (2) additionalinstancevariables,which will be of Greenfoot image type. These two variables will be used to hold images for the Foodobjects. Thefirst variable can hold the original Food image, and the second can hold the new image for your chosen theme. 2.If you do not have one already, create a defaultFoodconstructor that takes no parameters and does not initialise any variables or propertieseg: public Food(){ //no code in here } 3.Create a second Food constructor that has oneintegerparameter. This Food constructor will set the image of the food to either the default image or the new food image. Passing the value 1 as an argument will set the default image. Passing the value 2will mean that thesecondimage will be set. I have done till step 2 but i could not do the step 3 so i had upladed the whole question.
danpost danpost

2020/9/15

#
Please refer to this page of the Java tutorials.
You need to login to post a reply.