CIS 1202 Assignment County Auditor Search and Sort (20 Points) Instructions: Wri
ID: 3664478 • Letter: C
Question
CIS 1202 Assignment County Auditor Search and Sort (20 Points) Instructions: Write a program for the county auditor that will sort the tax data, search for specific addresses, and sort the data from the data in ascending order Address Amount due 500 151 Acorn 1500 161 Acorn 200 Main 15000 500 Arcade 25000 161 Acorn 6000 120 Xenia 1000 200 Acorn 20000 Requirements 1. Use a menu-driven program for the user to enter their selection a. Display all the properties and their tax bill b. Sort the database from low to high and display the address and amount due c. Provide a lookup function for the user to search for a home d. Display the largest delinquent tax bill e. Exit the program 2. Use 5 functions a. Display the menu b. Display the addresses and the amount due c. Sort the database from low to high and display the address and tax due d. Provide a look up function e. Display the largest delinquent tax bill 3. Validate data as the user enters it. 4. Output must be labelled and easy to read as shown in the sample output below. Only display 2 decimal points when displaying Total Amount Due and Change Due 5. Program must be documented with the following: a. Name b. Date c. Program Name d. DescriptionExplanation / Answer
#include<iostream>
#include<string>
#include <iomanip>
#include <cstdlib>
using namespace std;
int totalsList(int value[7], string address[7]);
void lookUp(int value[], string address[]);
void display(int value[], string address[]);
void showHighest(int value[], string address[]);
void sortArray(int[], int);
void sortStrings(string[], string);
void showArray(const int[], int);
int main() {
int size = 0;
int value[7] = { 500, 1000, 1500, 6000, 15000, 20000, 25000 };
string address[7]{ "151 Acorn", "120 Xenia", "161 Acorn", "161 Acorn", "200 Main", "200 Acorn", "500 Arcade" };
int choice;
cout << "County Auditor's Tax Look Up Program: ";
cout << "1.) Display The Data. ";
cout << "2.) Look up Taxes. ";
cout << "3.) Sort taxes in ascending order. ";
cout << "4.) Show Property with largest tax due. ";
cout << "5.) Exit Program. ";
cin >> choice;
while (choice <= 5) {
if (choice == 1) {
display(value,address);
}
if (choice == 2) {
lookUp(value,address);
}
if (choice == 3) {
sortArray(value, 7);
sortString(address, 7);
cout << "Sorted Values: ";
showArray(value, 7);
system("pause");
}
if (choice == 4) {
showHighest(value, address);
}
}
//exit
if (choice == 5) {
return 0;
}
system("pause");
}
void lookUp(int value[], string address[]) {
string add;
cout << "Enter Address: ";
getline(cin, add);
getline(cin, add);
if (add != address[0] || add != address[1] || add != address[2] || add != address[3] || add != address[4]
|| add != address[5] || add != address[6] || add != address[7]) {
cout << "This address is not found, please re-enter ";
}
int valCor = 0;
if (add == address[0]) {
valCor = 500;
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[1]) {
valCor = 1000;
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[2]) {
valCor = value[2];
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[3]) {
valCor = value[3];
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[4]) {
valCor = value[4];
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[5]) {
valCor = value[5];
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
if (add == address[6]) {
valCor = value[6];
cout << "The address: " << add << " has tax due of: " << "$" << valCor << endl;
}
system("pause>nul");
}
void display(int value[], string address[]) {
cout << "All Addresses and Owed Taxes, correspondingly: ";
cout << "---------------------------------------------- ";
cout << address[0] << " Tax: $" << value[0] << endl;
cout << address[2] << " Tax: $" << value[0] << endl;
cout << address[3] << " Tax: $" << value[0] << endl;
cout << address[4] << " Tax: $" << value[0] << endl;
cout << address[5] << " Tax: $" << value[0] << endl;
cout << address[6] << " Tax: $" << value[0] << endl;
system("pause");
}
void showHighest(int value[], string address[]){
cout << "Highest Value: ";
cout << "The Highest Property tax is on the location " << address[6] << "with a tax of: $" << value[6];
}
void sortArray(int array[], int size)
{
bool swap;
int temp;
do
{
swap = false;
for (int count = 0; count < (size - 1); count++)
{
if (array[count] > array[count + 1])
{
temp = array[count];
array[count] = array[count + 1];
array[count + 1] = temp;
swap = true;
}
}
} while (swap);
}
void sortString(string array[], int size)
{
bool swap;
int temp;
do
{
swap = false;
for (int count = 0; count < (size - 1); count++)
{
if (array[count] > array[count + 1])
{
temp = array[count];
array[count] = array[count + 1];
array[count + 1] = temp;
swap = true;
}
}
} while (swap);
}
void showArray(const int array[],int size)
{
for (int count = 0; count < size; count++)
cout << "$" << array[count] << " ";
cout << endl;
}