Questions
For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson.


For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson.

The Seller class

Use the following class definition:

class Seller
{
public:
  Seller();
  Seller( const char [], const char[], const char [], double );
    
  void print();

  void setFirstName( const char [] );
  void setLastName( const char [] );
  void setID( const char [] );
  void setSalesTotal( double );

  double getSalesTotal();

private:
  char firstName[20];
  char lastName[30];
  char ID[7];
  double salesTotal;
};

Data Members

The data members for the class are:

  • firstName holds the Seller's first name

  • lastName holds the Seller's last name

  • ID holds the Seller's id number

  • salesTotal holds the Seller's sales total

Constructors

This class has two constructors. The default constructor (the one that takes no arguments) should initialize the first and last names to "None", the seller ID to "ZZZ999", and the sales total to 0.

The other constructor for the class should initialize the data members using the passed in arguments. It takes 4 arguments: a character array with a Seller's first name, a character array with a Seller's last name, a character array with a Seller's id number, and a double that holds the Seller's sales total. The data members should be initialized by calling the various set methods.

Methods

void print()

This method displays the Seller information. It takes no arguments and returns nothing.

The information should be displayed as follows:

Giant, Andre               BIG357               678.53

void setFirstName( const char [] )

This method changes a Seller's first name. It takes one argument: an array of characters that represents the Seller's first name. It returns nothing.

If the length of the passed in argument is greater than 0, it should be used to initialize the firstName data member. Otherwise, the firstName data member should be set to "None".

void setLastName( const char [] )

This method changes a Seller's last name. It takes one argument: an array of characters that represents the Seller's last name. It returns nothing.

If the length of the passed in argument is greater than 0, it should be used to initialize the lastName data member. Otherwise, the lastName data member should be set to "None".

void setID( const char [] )

This method changes a Seller's id number. It takes one argument: an array of characters that represents the Seller's id number. It returns nothing.

If the length of the passed in argument is greater than 0 and less than 7, it should be used to initialize the ID data member. Otherwise, the ID data member should be set to "ZZZ999".

void setSalesTotal( double )

This method changes a Seller's sales total. It takes one argument: a double that represents the Seller's sales total. It returns nothing.

If the passed in argument is greater than or equal to 0, it should be used to initialize the salesTotal data member. Otherwise, the salesTotal data member should be set to 0.

double getSalesTotal()

This method returns a Seller's sales total data member. It takes no arguments.

main()

In main(), create 5 Seller objects. They should contain the values:

  • The first Seller should have your name, an id of "CSI240", and a sales total of 1234.56. Note: if you're pair programming, set the first name to the first name of both you and your partner: "Jane/John" and the last name to the last name of both you and your partner: "Doe/Doe".

  • The second Seller should be created using the default constructor (the one that doesn't take any arguments)

  • The third Seller should have the first name of an empty string (""), a last name of "Robinson", an id of "TOOBIG999", and a sales total of -876.34.

  • The fourth Seller should have the name "Tarik Cohen", an id of "RUN29", and a sales total of 13579.11

  • The fifth Seller should have the name "Kyle Long", an id of "TACK75", and a sales total of 24680.24

The rest of main() will include using the various methods on each of the 5 Seller objects. Display a label similar to "The first Seller" before anything is outputted for each of the objects.

For the first Seller, display the Seller information.

For the second Seller, display the Seller information, set the Seller name to "Mitchell Trubisky", set the id number to "QB10", set the sales total to 246.80, and then display the Seller information once again.

For the third Seller, display the Seller's information, set the Seller's first name to "Allen", set the id number to "WIDE12", set the sales total to 9900000.99, and then display the Seller information once again.

For the fourth Seller, display only the Seller's sales total.

For the fifth Seller, display the Seller's information, set the first name to an empty string (""), set the last name to an empty string, set the id number to an empty string, set the sales total to -52.96, and then display the Seller information once again.

Programming Notes

  1. Each method must have a documentation box like a function.

  2. Hand in a copy of the source code using Blackboard.

Output

Note: The information for the first Seller object will have your name.

The First Seller
Da Bear, Staley                 CSI240        1234.56

The Second Seller
None, None                      ZZZ999           0.00
Trubisky, Mitchell                QB10         246.80

The Third Seller
Robinson, None                  ZZZ999           0.00
Robinson, Allen                 WIDE12     9900000.99

The Fourth Seller
The sales total is $13579.11

The Fifth Seller
Long, Kyle                      TACK75       24680.24
None, None                      ZZZ999           0.00

In: Computer Science

Overview For this assignment, implement and use the methods for a class called Seller that represents...

Overview

For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson.

The Seller class

Use the following class definition:

class Seller
{
public:
  Seller();
  Seller( const char [], const char[], const char [], double );
    
  void print();

  void setFirstName( const char [] );
  void setLastName( const char [] );
  void setID( const char [] );
  void setSalesTotal( double );

  double getSalesTotal();

private:
  char firstName[20];
  char lastName[30];
  char ID[7];
  double salesTotal;
};

Data Members

The data members for the class are:

  • firstName holds the Seller's first name

  • lastName holds the Seller's last name

  • ID holds the Seller's id number

  • salesTotal holds the Seller's sales total

Constructors

This class has two constructors. The default constructor (the one that takes no arguments) should initialize the first and last names to "None", the seller ID to "ZZZ999", and the sales total to 0.

The other constructor for the class should initialize the data members using the passed in arguments. It takes 4 arguments: a character array with a Seller's first name, a character array with a Seller's last name, a character array with a Seller's id number, and a double that holds the Seller's sales total. The data members should be initialized by calling the various set methods.

Methods

void print()

This method displays the Seller information. It takes no arguments and returns nothing.

The information should be displayed as follows:

Giant, Andre               BIG357               678.53

void setFirstName( const char [] )

This method changes a Seller's first name. It takes one argument: an array of characters that represents the Seller's first name. It returns nothing.

If the length of the passed in argument is greater than 0, it should be used to initialize the firstName data member. Otherwise, the firstName data member should be set to "None".

void setLastName( const char [] )

This method changes a Seller's last name. It takes one argument: an array of characters that represents the Seller's last name. It returns nothing.

If the length of the passed in argument is greater than 0, it should be used to initialize the lastName data member. Otherwise, the lastName data member should be set to "None".

void setID( const char [] )

This method changes a Seller's id number. It takes one argument: an array of characters that represents the Seller's id number. It returns nothing.

If the length of the passed in argument is greater than 0 and less than 7, it should be used to initialize the ID data member. Otherwise, the ID data member should be set to "ZZZ999".

void setSalesTotal( double )

This method changes a Seller's sales total. It takes one argument: a double that represents the Seller's sales total. It returns nothing.

If the passed in argument is greater than or equal to 0, it should be used to initialize the salesTotal data member. Otherwise, the salesTotal data member should be set to 0.

double getSalesTotal()

This method returns a Seller's sales total data member. It takes no arguments.

main()

In main(), create 5 Seller objects. They should contain the values:

  • The first Seller should have your name, an id of "CSI240", and a sales total of 1234.56. Note: if you're pair programming, set the first name to the first name of both you and your partner: "Jane/John" and the last name to the last name of both you and your partner: "Doe/Doe".

  • The second Seller should be created using the default constructor (the one that doesn't take any arguments)

  • The third Seller should have the first name of an empty string (""), a last name of "Robinson", an id of "TOOBIG999", and a sales total of -876.34.

  • The fourth Seller should have the name "Tarik Cohen", an id of "RUN29", and a sales total of 13579.11

  • The fifth Seller should have the name "Kyle Long", an id of "TACK75", and a sales total of 24680.24

The rest of main() will include using the various methods on each of the 5 Seller objects. Display a label similar to "The first Seller" before anything is outputted for each of the objects.

For the first Seller, display the Seller information.

For the second Seller, display the Seller information, set the Seller name to "Mitchell Trubisky", set the id number to "QB10", set the sales total to 246.80, and then display the Seller information once again.

For the third Seller, display the Seller's information, set the Seller's first name to "Allen", set the id number to "WIDE12", set the sales total to 9900000.99, and then display the Seller information once again.

For the fourth Seller, display only the Seller's sales total.

For the fifth Seller, display the Seller's information, set the first name to an empty string (""), set the last name to an empty string, set the id number to an empty string, set the sales total to -52.96, and then display the Seller information once again.

Programming Notes

  1. Each method must have a documentation box like a function.

  2. Hand in a copy of the source code using Blackboard.

Output

Note: The information for the first Seller object will have your name.

The First Seller
Da Bear, Staley                 CSI240        1234.56

The Second Seller
None, None                      ZZZ999           0.00
Trubisky, Mitchell                QB10         246.80

The Third Seller
Robinson, None                  ZZZ999           0.00
Robinson, Allen                 WIDE12     9900000.99

The Fourth Seller
The sales total is $13579.11

The Fifth Seller
Long, Kyle                      TACK75       24680.24
None, None                      ZZZ999           0.00

In: Computer Science

What is the terminal voltage of the battery when the circuit is closed?

A battery of EMF 10 V and internal resistance 3 Ω is connected to a resistor. If the current in the circuit is 0.5 A, what is the resistance of the resistor? What is the terminal voltage of the battery when the circuit is closed?

In: Physics

What is the resistivity of the wire?

You apply a potential difference of 4.50 V between the ends of a wire that is 2.50 m in length and 0.654 mm in radius. The resulting current through the wire is 17.6 A.

A.What is the resistivity of the wire?

In: Physics

Three lightbulbs are connected to a 9-V battery as shown in Fig. 2.56 (a). Calculate:

Three lightbulbs are connected to a 9-V battery as shown in Fig. 2.56 (a). Calculate:

(a) the total current supplied by the battery,

(b) the current through each bulb,

(c) the resistance of each bulb.

In: Electrical Engineering

Which one of the following theories is used in the court's analysis provided in NLRB v....

Which one of the following theories is used in the court's analysis provided in NLRB v. Laughlin Steel Corp?

Cumulative Effect Theory

Substantial Economic Effect Theory

Prohibitive Effect Theory

In: Finance

In Dred Scott v. Stanford, the United States Supreme Court held that slaves were not entitled...

In Dred Scott v. Stanford, the United States Supreme Court held that slaves were not entitled to file suit in federal courts because they were not citizens.

Select one:

True

False

In: Economics

1) Briefly explain how V-series chemical warfare agents work. 2) Briefly explain the role of glutamic...

1) Briefly explain how V-series chemical warfare agents work.

2) Briefly explain the role of glutamic acid E327, histidine H440 and serine S220 in acetylcholinesterase catalysis.

In: Biology

Use the Peng-Robinson equation of state to compute the specific volume, V (L/mol), for methane gas...

Use the Peng-Robinson equation of state to compute the specific volume, V (L/mol), for methane gas at 298 K and 40 atm. Report your answer with 2 significant figures.

In: Other

Should go to the following link and post their comments.

 

Should go to the following link and post their comments. https://www.khanacademy.org/economics-finance-domain/macroeconomics/income-and-expenditure-topic/is-lm-model-tutorial/v/loanable-funds-interpretation-of-is-curve

In: Economics