The RARO is Automobile Rip Offs (RARO) Management Team just got out of a meeting with the Enhanced Uniform Learning Ripoffs (EULER) Team from Mathematically Obfuscated Analysis of Nuances (MOAN). The EULER team derived that customers could be scored based on the following formula:
y = 5k - 2(k - v)
where k is the length of the customer's name and v is the number of vowels in the customer's name. The EULER team also determined that customers with 4, 8, 12, … letters in their names were bad luck, so they would be assigned a score of -1.
RARO wants you to write two functions to analyze customer names:
In your main() function, ask the user for a customer name to test, and report the number of vowels, the length of the name, and the score of the customer's name.
The EULER Team determined the average amount the customer spends can be modeled using this formula:
s = k y2 + vy
RARO wants you to find total spent based on this for 6 non trivial customer names.
RARO now wants you to integrate this into your previous work by putting the score into the struct you used before:
struct customer
{
unsigned int customerID;
string name;
double amountSpent;
unsigned short numTimesRippedOff;
int nameScore; /* NOTE: new member of the struct */
};
Take your previous work (from lab 07) and make the following changes to integrate the two pieces together:
The real challenge here is the conflict of interest: the name in the struct is a string and the functions above take NUL Terminated Character Arrays. This is the underlying problem I want you to attack. You will need convert the name from a string to a NUL Terminated Character Array OR change the name in the struct to be a NUL Terminated Character Array and adjust the rest of your lab 07 accordingly to handle name as a NUL Terminated Character Array. You may use my model solution for lab 07 if you prefer to build on that instead of your own lab.
Part I is worth 8 points. Part II is worth 10 points (Part I + 2 more points). Part III is worth 12 points (Part II + 2 points extra credit). The lab is out of 10 points. When you're done, submit your lab08.tar.gz file on Blackboard. I will be grading your program on the following criteria:
![[Dilbert]](dilbert.gif)