Category: C++

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

Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

LANGUAGE: C++ CHALLENGE: Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) 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 the definition of a function printDottedLine, which has no parameters and doesn’t return anything.

Write the definition of a function printDottedLine, which has no parameters and doesn’t return anything.

LANGUAGE: C++ CHALLENGE: Write the definition of a function printDottedLine, which has no parameters and doesn’t return anything. The function prints to standard output a single line (terminated by a new line character) consisting of 5 periods....

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 called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created.

Design a class called Date that has integer data members to store month, day, and year.  The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created.

LANGUAGE: C++ CHALLENGE: Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created. If the user creates a Date object without passing any...

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 full class definition for a class named Averager, and containing the following members: An data member named sum of type integer. An data member named count of type integer.

Write a full class definition for a class named Averager, and containing the following members: An data member named sum of type integer. An data member named count of type integer.

LANGUAGE: C++ CHALLENGE: Write a full class definition for a class named Averager, and containing the following members: An data member named sum of type integer. An data member named count of type integer. A constructor with no parameters. The constructor initializes the data members sum and the data member count to 0. A function named...

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 three variables, k, m, n, of type int that have already been declared and initialized, write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321

Given three variables, k, m, n, of type int that have already been declared and initialized, write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321

LANGUAGE: C++ CHALLENGE: Given three variables, k, m, n, of type int that have already been declared and initialized, write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321 NOTE: The vertical bar, |, on...

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 class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order).

The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order).

LANGUAGE: C++ CHALLENGE: The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order). Given the Date variable datep, dynamically allocate a Date object with the initial value of March 12, 2006, and assign...

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