Create a class named gamer that has a field for name

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

Create a class named Gamer that has a field for name(string) and a field for points(int).

Write a C++ class that will include the following operations:

Constructor(s): A Gamer object should be able to be declared either with no parameters (assign default calues of your choice) or with parameters (any string is legal, but points should not be allowed to go below 0).

Set functions: separate functions for each data member (again, any string is legal, but only non-negative integers for points)

Get functions: separate function for each data member (name and point)

Operators:

+ add the points of two Gamer objects and return an integer

+= add an integer into the first operand's points field

-= subtract an integer from the first operand's points field, storing the result back into the same field. If the value ends up being negative, store a value of 0 instead.

++ increment the Gamer object's points field by 1(both pre-increment and post-increment versions)

== compare the name and points field of one Gamer object to those of another. Return true if both are the same and false otherwise.

> compare the points field of one Gamer object to that of another. Return true if the first Gamer object's points field is larger and false otherwise.

>> read in a name and points values from the keyboard, check the points value, and store into private data

<< write out the name and points fields in some readable format

 

 

Reference no: EM13161725

Questions Cloud

All the new strings generated : Explain why, if on some round, all the new strings generated for any syntactic category are longer than s, and s has not already been generated for L(), then s cannot ever be put in L(). Hint: Use Exercise 11.3.5.
Brownian motion is a physical phenomenon : Brownian motion is a physical phenomenon which can be observed, for instance, when a small particle is immersed in a liquid.
Write a program code to compute and build a table of reynold : Write a program code to compute and build a table of Reynolds numbers at flow velocities varying from 100 to 1000 ft/sec (at increments of 100)
Method called printpowersof2 that accepts a maximum number : Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)
Create a class named gamer that has a field for name : Create a class named Gamer that has a field for name(string) and a field for points(int).
Federal government regulates labels : The federal government regulates labels, warranties, and consumer products. Without government regulation, what abuses are likely to occur?
Determine the current flows : given an electrical circuit which consists of resistor and voltage sources, determine the current flows (i1,i2,i3, and i4) use the following values for the voltage and resistor sources: V1=20 volts V2=12 volts V3=40 volts, R1= 18 ohms R2= 10 ohms R3=..
Method named printgrid : Write a method named printGrid that accepts two integer parameters rows and cols. The output is a comma-separated grid of numbers where the first parameter (rows) represents the number of rows of the grid and the second parameter (cols) represents th..
Minimum contacts test : Compare the minimum contacts test, as it is applied to the bricks-and-mortar activity of businesses, to their cyberspace activity. If you were a small business

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Perform operations on arrays

Perform operations on arrays execute tests and repetitions

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  Programs written with inheritance

Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite the classes Point3D, Sphere and Cylinder using composition rather than inheritance

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Compute a program that calculates three resistance inputs

C language, compute a program that calculates three RESISTANCE inputs, and gives you the total resistance in OHMS. Like this, the total resistance is _____ ohms. These are three parallel circuits so the formula would be (1/R1 + 1/ R 2 +  1/ R 3 )  -1

  Implement the tronomino tiling algorithm

Implement the tronomino tiling algorithm,  our program should take an arbitrary input positive integer  k  in the Linux command line and generate a 2 k  * 2 k  board.

  Sort an array of elements using the quick sort algorithm

Sort an array of 10,000 elements using the quick sort algorithm as follows: sort the array using pivot as the middle element of the array

  rewrite that statement in a more readable style.

Give an example statement in C, C++, or Java that is particularly unreadable. Rewrite that statement in a more readable style.

  Design and implement a library system

Design and implement a library system that does the following: ? Takes details of a student/library users: first name, last name, other names, user ID number, and nationality.

  Write an lc-3 machine language program

Write an LC-3 machine language program starting at location x3000 which divides the number in memory location x4000 by the number in memory location x4001 and stores the quotient at x5000 and the remainder at x5001.

  Displays columns titled "name", "quantity", "price", value

Write a program that displays columns titled "Name", "Quantity", "Price", and "Value". The fourth column contains the result of multiplying each item's quantity by its price. In addition, the program should calculate and display the total value of th..

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