Main Blog Directory

Something Cool

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

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

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...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Write an application that reads the (x,y) coordinates for two points.

Write an application that reads the (x,y) coordinates for two points.

LANGUAGE: Java CHALLENGE: Write an application that reads the (x,y) coordinates for two points. Compute the distance between the two points using the following formula: Distance = the square root of the sum of the square of the difference of the x coordinates and the square of the difference of the y coordinates...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

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).

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).

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....

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

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

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

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...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Define a class called Odometer that will be used to track fuel and mileage for a vehicle.

Define a class called Odometer that will be used to track fuel and mileage for a vehicle.

LANGUAGE:  C++ CHALLENGE: Define a class called Odometer that will be used to track fuel and mileage for a vehicle. Include member variables to track the distance driven (in miles) and the fuel efficiency of the vehicle (in miles per gallon). The class will have a constructor that accepts one parameter and initializes distance to...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours;

The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours;

LANGUAGE:  C++ CHALLENGE: The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours; any hours worked beyond 40 are paid at time-and-a-half (one and a half times the hourly rate). Given the variables hours, rate, and pay have already been declared and assigned values, write...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Given that a vector of int named a has been declared, and that the integer variable n contains the number of elements of the vector a, assign -1 to the last element in a.

Given that a vector of int named a has been declared, and that the integer variable n contains the number of elements of the vector a, assign -1 to the last element in a.

LANGUAGE:  C++ CHALLENGE: Given that a vector of int named a has been declared, and that the integer variable n contains the number of elements of the vector a, assign -1 to the last element in a....

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Write an expression whose value is the number of values that have been stored in v.

Write an expression whose value is the number of values that have been stored in v.

LANGUAGE:  C++ CHALLENGE: Assume v is a vector that has been declared and initialized. Write an expression whose value is the number of values that have been stored in v....

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Design a class named MyInteger

Design a class named MyInteger

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...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Design a class named Fan to represent a fan.

Design a class named Fan to represent a fan.

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...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Write a method that finds the number of occurrences of a specified character in a string using the following header

Write a method that finds the number of occurrences of a specified character in a string using the following header

LANGUAGE:  JAVA CHALLENGE: (Occurrences of a specified character ) Write a method that finds the number of occurrences of a specified character in a string using the following header: public static int count(String str, char a) Add a main method to the class that tests the method by prompting for a string and a character,...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More

Write a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, …, and Saturday is 6).

Write a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, …, and Saturday is 6).

LANGUAGE:  JAVA CHALLENGE: 3-5) (Find future dates) Write a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, …, and Saturday is 6). Also, prompt the user to enter the number of days after today for a future day and dis- play the...

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days - Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level

Read More