It would make sense to hold all the car details together. But that would require use of a language feature call a struct, a way of defining a group of field that form a record.
Because you can't use that, but have probably been introduced to arrays, you're asked to represent each of the three columns as arrays. So you have: OptionPackageCodeArray, PackageCostArray and PackageNameArray.
OptionPackageCodeArray is an array of strings, so it looks like:
1 2 3 4 5 6 7 8
|
std::string OptionPackageCodeArray[] =
{
"BB",
"SP",
"NP",
"HE",
"UC"
};
|
You're expected to declare the other arrays too, so you can sort of copy what I did for the first one, but remember that PackageCostArray is an array of doubles rather than strings.
Going thru what you're expected to do, it's pretty much spelled out. Your program first has to determine if the 2-letter code input by the user is valid.
1. You are required to use a loop to check the input against each item in the optionPackageCodeArray.
2. Begin with the first item then "walk" down through the array. If the code does NOT exist on the list, display an error message and stop.
3. If the code is valid, do some calculation and displaying.
4. First, add the base price to the package cost from the array and get a subtotal.
5. Then, calculate 15% of the subtotal for taxes and fees and add that to the subtotal for a final price.
6. Display the final price and the full name of the package from the last array, then stop.
What's the problem?