+1 (315) 557-6473 

C++ Program to Create a Salesperson Program Assignment Solution.


Instructions

Objective
Write a C++ assignment program to create a salesperson program.

Requirements and Specifications

Assignment 5
Write a loop-based application (including algorithm) that uses a class called “SalesPerson” (see details below). The application will continue to run until the loop termination condition is selected. The application must find a specific record in the “AutoSales.txt” file with a given autoID, populate a SalesPerson object with that information and then display all the information in that object as well as the cost of the vehicle including sales tax (i.e., assume 7%).
The “AutoSales.txt” file format includes a record for each car sold and contains the following information for each sale(each field separated by colon)
  • Salesperson First Name
  • Salesperson Last Name
  • Salesperson ID
  • Automobile Make
  • Automobile Model
  • Automobile ID
  • Price
The SalesPerson class must contain the following
  • Constructor with parameters that initialize the instance variables as follows
  • firstName & lastName: “Mike” “Smith” (i.e., most active sales person)
  • ID: -1
  • automaker: “Chevy” (i.e., most popular make)
  • autoModel: “Camaro” (i.e., most popular model)
  • autoID: -1
  • price: 15000 (i.e., absolute minimum sales price)
  • firstName “string” instance variable
  • lastName “string” instance variable
  • ID “int” instance variable
  • autoMake “string” instance variable
  • autoModel “string” instance variable
  • autoID “int” instance variable
  • price “double” instance variable
  • “get…” & “set…” methods for each instance variable The “SalesPerson” class requires a header file, “SalesPerson.h”
  • Upload all files in “zip” format to the Canvas “Assignment 5 Submission” area.
Note: This assignment requires submission of multiple files
  • SalesPersonApp.cpp // contains “main( )” function
  • SalesPerson.cpp // contains “SalesPerson” member function definitions
  • SalesPerson.h // contains “SalesPerson” class definition
Source Code
#include "SalesPerson.h"
// Constructors
SalesPerson::SalesPerson() {
firstName = "Mike";
lastName = "Smith";
ID = -1;
autoMake = "Chevy";
autoModel = "Camaro";
autoID = -1;
price = 15000;
}
SalesPerson::SalesPerson(const string& fName, const string& lName, int sID, const string& aMake, const string& aModel, int aID, double p) {
firstName = fName;
lastName = lName;
ID = sID;
autoMake = aMake;
autoModel = aModel;
autoID = aID;
price = p;
}
// getters
string SalesPerson::getFirstName() {
return firstName;
}
string SalesPerson::getLastName() {
return lastName;
}
int SalesPerson::getID() {
return ID;
}
string SalesPerson::getAutoMake() {
return autoMake;
}
string SalesPerson::getAutoModel() {
return autoModel;
}
int SalesPerson::getAutoID() {
return autoID;
}
double SalesPerson::getPrice() {
return price;
}
// setters
void SalesPerson::setFirstName(const string& fName) {
firstName = fName;
}
void SalesPerson::setLastName(const string& lName) {
lastName = lName;
}
void SalesPerson::setID(int newID) {
ID = newID;
}
void SalesPerson::setAutoMake(const string& newAutoMake) {
autoMake = newAutoMake;
}
void SalesPerson::setAutoModel(const string& newAutoModel) {
autoModel = newAutoModel;
}
void SalesPerson::setAutoID(int newID) {
autoID = newID;
}
void SalesPerson::setPrice(double newPrice) {
price = newPrice;
}
// methods
double SalesPerson::getFinalPrice() {
// Returns the price including a 7% tax
return price + getTax();
}
double SalesPerson::getTax() {
// Returns the amount to be added to final price due to taxes
return getPrice()*0.07;
}