Create all the instances to fill up your array

Assignment Help C/C++ Programming
Reference no: EM132007915

Assignment: Your assignment is to create a sketch that defines a class called "Tribble". A Tribble is a small fuzzy creature kept as a cute pet that breeds quickly. Your sketch should create hundreds of instances of Tribbles around the screen and show them doing their thing. Define methods and instance variables for the class Tribble as appropriate.

Tribbles look like small fuzzy blobs. You can start by drawing them as circles, but your final sketch should show your interpretation of what "fuzzy" means. Tribbles spend most of their time sleeping (not moving). Every five seconds they wake up and get excited and vibrate for two seconds (horizontally by 1 pixel each frame, randomly), then settle down and continue sleeping.

Each instance of Tribble should be on its own schedule of vibration and should start at a random location on the screen. Optional: give each Tribble a random color.

Timed Behavior: Each Tribble should have a boolean instance variable to indicate whether it is asleep or excited. It will also probably need some integer counts for timing so you know how long it has been asleep or excited.

Sequence: • Start with one Tribble. Define a simple class.

• Get simple drawing, random location, and setup done.

• Add the "excited" behavior (assume it is excited all the time).

• Add the sleep-wakeup timed behavior using your integer instance variables.

• Make the drawing better (fuzzier)

• Declare and initialize an array of 5 Tribbles

• Create all the instances to fill up your array (passing random locations and other values to the constructor)

• Update your draw() function to loop through and draw all the Tribbles and do any other calls needed

• Check that the sleeping-wakeup behavior is correct

• Check that all the tribbles are not synchronized (pass random integer counts to constructor to start them in different states)

• Increase the array size to 200

Reference no: EM132007915

Questions Cloud

How do the teams manage their team boundaries : How do the teams manage their team boundaries? What are the trade-offs between internal cohesion and external ties within each type of team?
What serious biases or misassumptions do groups : What serious biases or misassumptions do groups that are involved in inter-team conflict sometimes experience? How do these biases and prejudices affect.
Design a network infrastructure for two campuses : Design a network infrastructure for two campuses located in Atlanta and Cincinnati based upon the specifications
Historical averages of the united states : Are the current unemployment and inflations rates high or low compared to the historical averages of the United States?
Create all the instances to fill up your array : Declare and initialize an array of 5 Tribbles. Create all the instances to fill up your array (passing random locations and other values to the constructor).
Compute the expected return for stock : There is a 28.10% probability of a below average economy and a 71.90% probability of an average economy. Compute the Expected Return for Stock A :
Which of these would be considered discrimination : 1. In the United States, some groups have higher incomes than others. Which of these would be considered discrimination?
Dummy variable to exclude from the model : When I was trying to improve my regression model by adding dummy variables, I noticed that there were some omitted dummy variable
What total capital investment level : A company expects to earn $16 million in income this coming year. At what total capital investment level?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Determines whether to accept an object.

Modify the implementation of the DataSet class in Section to use both a Measurer and a Filter object. Only objects that the filter accepts should be processed.

  You need to prepare a program linear solver

Write a C program, called linear solver.c, that solves single-variable linear equations. The pro- gram should prompt the user to enter a linear equation of the form

  How many times is copy constructor called in the given code

How many times is the copy constructor called in the given code. Why are the parentheses needed in the expression (*p).data?

  Write a class players that contains attributes

Write a class players that contains attributes for the players name,average and team.

  Write a java class named mylinkedlist and implement it

void updateList(MyLinkedList otherlist) that will update the current list with a given otherlist. If an element in current list exists in the otherlist then replace (update) it, otherwise insert (add) it using the above insertSortNoDuplicate metho..

  Write a program that performs functions of the standard unix

Write a program called signal.c that performs the functions of the standard UNIX kill command. We will call our program signal instead of kill.

  Create a console program that calculates and displays

Create a console program that calculates and displays a person's annual salary over a specific number of years, starting in 2014. The user provides the:

  Write equivalent compound statements

What action must be taken before a variable can be used in a program?

  Inserts a node with info value x

Complete the code for a function that inserts a node with info      value x before, and a node with info value zafter,each node with      info value y in a linked list with first node pointer p.

  Repetition structure that includes a nested

Create your own While-End (or For-End) repetition structure that includes a nested if-then selection structure. You decide the theme. You should provide both the pseudocode and the flowchart of your example. Be sure to provide an overview of what ..

  Write program which prompts user to enter numbers

Write down the program which prompts the user to enter numbers, findsout how many positive and negative values have been entered, and calculates sum and average of numbers entered.

  Implement the trapezoidal rule for integrating a function

Implement the Trapezoidal Rule for integrating a function. Use the following function: double trap(double (*pf)(double x), double a, double b, int n) Here, pf points to the function f that is to be integrated.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd