Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit

java

LANGUAGE: Java CHALLENGE: Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit A method named increment. It does not take…

Read More

Creating objects of the Currency class requires a name (string), a currency symbol (string) and the number of decimal places (integer) usually associated with the currency (in that order).

C++

LANGUAGE:  C++ CHALLENGE: Creating objects of the Currency class requires a name (string), a currency symbol (string) and the number of decimal places (integer) usually associated with the currency (in that order). Define an object named curr, of type Currency corresponding to “US Dollar” with the symbol “$” and 2 decimal places.

Read More

Consider a class Movie that contains the following information about a movie: * Title * MPAA Rating (e.g. G, PG, PG-13, R) * Number of people who rated this movie as a 1 * Number of people who rated this movie as a 2 * Number of people who rated this movie as a 3 * Number of people who rated this movie as a 4 * Number of people who rated this movie as a 5

C++

LANGUAGE:  C++ CHALLENGE: Consider a class Movie that contains the following information about a movie: * Title * MPAA Rating (e.g. G, PG, PG-13, R) * Number of people who rated this movie as a 1 * Number of people who rated this movie as a 2 * Number of people who rated this movie…

Read More

Design a class named MyInteger

java

LANGUAGE:  JAVA CHALLENGE: (The MyInteger class ) Design a class named MyInteger. The class contains: * An int data field named value that stores the int value represented by this object. * A constructor that creates a MyInteger object for the specified int value. A getter method that returns the int value. * The methods…

Read More

Design a class named Fan to represent a fan.

java

LANGUAGE:  JAVA CHALLENGE: (The Fan class ) Design a class named Fan to represent a fan. The class contains: – Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed. – A private int data field named speed that specifies the speed of the fan (the…

Read More