Question: 2 0 . 3 0 LAB * : Program: Credit card debt ( Arrays ) Program Specifications Write a program to search three parallel arrays
LAB: Program: Credit card debt Arrays
Program Specifications Write a program to search three parallel arrays containing customer credit card debt information. Identify statistics such as the number of customer names that begin with S the number of customers with no debt, and the number of customers that live in a specific state.
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step Review the starter code in main The number of requested customers is input integer A function is called that reads data from a text file and fills three parallel arrays with customer names, state of residence, and amount of credit card debt for each customer. Using a function is a convenient way to fill arrays with hundreds of elements. Functions and reading data from text files are described in other sections of the book.
Step Input a debt limit integer first letter of customer's name char and state abbreviation string Note that the number of customers is already input during Step
Step pts Use a loop to process each element of the names and debt arrays to identify the customer with the highest debt. Output a report header, number of customers, and the person's name with the highest debt. Submit for grading to confirm two tests pass.
Ex: If input is:
mathrmPmathrmLA
the output is:
US Report
Customers:
Highest debt: Sullivan
Step mathbf pts Use a loop to process each element of the names array to count all customer names that begin with the specified letter. Ex: How many customer names begin with B or L Output the number of customer names that start with the specified letter. Submit for grading to confirm four tests pass.
Ex: If input is:
mathrmPmathrmTX
the output is:
US Report
Customers:
Highest debt: Sullivan
Customer names that start with P:
Step mathbf pts Use a loop to process each element of the names and debt arrays to count the number of customers that have debt higher than the specified debt limit and the number of customers that have no debt. Output all results. Submit for grading to confirm six tests pass.
Ex: If input is:
mathrmPmathrmTX
the output is:
US Report
Customers:
Highest debt: Sullivan
Customer names that start with P:
Customers with debt over $:
Customers debt free:
Step pts Repeat steps for all customers living in the specified state. Output all results including a header for the state report. Submit for grading to confirm all tests pass.
Ex: If input is:
mathrm~AmathrmCA
the output is:
US Report
Customers:
Highest debt: Anderson
Customer names that start with A:
Customers with debt over $:
Customers debt free:
CA Report
Customers:
Highest debt: Duenas
Customer names that start with A:
Customers with debt over $:
Customers debt free:
#include
#include
#include
using namespace std;
Read customer information from external file
Make no changes to the following code
void ReadCustomerDatastring names string states double debt int size
ifstream inFS;
Read all data from file into three parallel arrays
try
inFS.openCustomerDatacsv;
for int index ; index size; index
inFS namesindex; last name
inFS statesindex; state of residence
inFS debtindex; amount of debt
What if data file not found?
catch string err
cout "Failed to read the data file: err endl;
inFS.close;
int main
int size;
Input # of customers and create parallel arrays
cin size;
string namessize;
string statessize;
double debtsize;
Fill arrays with data from external file described in another section
ReadCustomerDatanames states, debt, size;
Type your code here
Input debt limit search phrase, and state
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
