Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program with c++ t hat processes the data of a retail company.Make sure your code satisfies all the requirements below. ( Also Please

Write a program with c++ that processes the data of a retail company.Make sure your code satisfies all the requirements below.

(Also Please explain me how and where your read read the data from,do you first save the data and where and with what prefix and

how you read from it? then where you save the data(the result), with what prefix and whre?)

program:

1. Define a new data type of Customer using struct, with the following members: ID, first name,

last name, number of items purchased, price of a single item, and total spending.

2. In the main function, declare an array of Customer.

3. The array should be created dynamically. In other words, you do not know how many customers when you write the program. The program can ask a user to enter the total number of customers, or better yet, let the code to count the number of records in the file.

4. The main function reads the data from a file: retails.txt.

Each row represents a customers record, with ID, first name, last name, number of item purchased and the price of a single item.

The data columns are separated by whitespaces.

5. Store the customer data in the array.

6. Design a function, computeTotals, to calculate the total spending of each customer:

total = numItems * price.

7. computeTotals takes two parameters: an array of Customer and the number of customers.

8. computeTotals must be coded with pointer notation (a 3-point deduction for non-pointer notations).

9. In the main function, print out all records, including the total spending, such as:

1001 Scott Adams 3 22.86 68.58

1002 Nicholas Allen 8 10.00 80.00

TXT doc

1001 Scott Adams 3 22.86 1002 Nicholas Allen 8 10.00 1003 Daniel Anderson 7 21.43 1004 Janet Bailey 12 4.29 1005 Frank Baker 2 37.86 1006 Hannah Barnes 2 32.86 1007 Debra Bell 3 7.14 1008 Joan Bennett 5 15.71 1009 Evelyn Brooks 9 39.29 1010 Michael Brown 7 37.86 1011 Janice Butler 8 38.57 1012 Gregory Campbell 2 37.86 1013 Patrick Carter 3 3.57 1014 Kevin Clark 8 8.57 1015 Kathleen Collins 14 8.57 1016 Pamela Cook 12 22.14 1017 Christine Cooper 4 6.43 1018 Diane Cox 2 27.86 1019 Lauren Cruz 9 40.00 1020 Richard Davis 7 22.14 1021 Julie Diaz 7 14.29 1022 Anna Edwards 15 19.29 1023 Dennis Evans 14 6.43 1024 Julia Fisher 15 5.00 1025 Ruth Flores 1 7.14 1026 Cheryl Foster 4 5.00 1027 Joseph Garcia 6 23.57 1028 Carolyn Gomez 7 38.57 1029 Joshua Gonzalez 2 22.86 1030 Martha Gray 7 15.00 1031 Larry Green 4 10.71 1032 Teresa Gutierrez 7 5.71 1033 Ryan Hall 3 3.57 1034 Brian Harris 8 17.14 1035 Anthony Hernandez 12 5.00 1036 Brandon Hill 9 15.71 1037 Heather Howard 3 16.43 1038 Victoria Hughes 14 26.43 1039 Steven Jackson 6 31.43 1040 Christina James 13 10.71 1041 Gloria Jenkins 2 10.00 1042 John Johnson 11 18.57 1043 William Jones 5 18.57 1044 Rachel Kelly 13 20.71 1045 Stephen King 4 38.57 1046 Edward Lee 8 5.00 1047 Ronald Lewis 1 16.43 1048 Ann Long 9 17.14 1049 Andrew Lopez 9 27.14 1050 Paul Martin 15 29.29 1051 Christopher Martinez 10 36.43 1052 David Miller 10 36.43 1053 Samuel Mitchell 3 33.57 1054 Mark Moore 2 5.00 1055 Megan Morales 6 35.71 1056 Katherine Morgan 12 29.29 1057 Amy Morris 11 24.29 1058 Brenda Murphy 6 32.86 1059 Alice Myers 7 6.43 1060 Justin Nelson 6 29.29 1061 Angela Nguyen 13 21.43 1062 Jacqueline Ortiz 5 22.14 1063 Cynthia Parker 13 23.57 1064 Jeffrey Perez 10 12.14 1065 Sara Perry 15 15.71 1066 Nicole Peterson 6 25.71 1067 Jack Phillips 8 6.43 1068 Marie Powell 11 6.43 1069 Judith Price 9 37.86 1070 Raymond Ramirez 6 37.14 1071 Samantha Reed 15 10.71 1072 Kelly Reyes 7 34.29 1073 Joyce Richardson 10 4.29 1074 Virginia Rivera 13 31.43 1075 Benjamin Roberts 4 12.86 1076 Timothy Robinson 5 7.86 1077 Charles Rodriguez 2 12.86 1078 Catherine Rogers 15 35.00 1079 Doris Ross 11 37.86 1080 Kathryn Russell 12 9.29 1081 Eric Sanchez 2 42.86 1082 Jean Sanders 11 17.14 1083 Jonathan Scott 5 10.00 1084 James Smith 9 15.00 1085 Shirley Stewart 14 41.43 1086 Andrea Sullivan 14 22.86 1087 Matthew Taylor 2 10.00 1088 Donald Thomas 13 14.29 1089 George Thompson 14 21.43 1090 Jerry Torres 6 15.00 1091 Alexander Turner 2 14.29 1092 Jason Walker 2 20.00 1093 Maria Ward 10 32.14 1094 Frances Watson 9 37.86 1095 Kenneth White 1 37.86 1096 Robert Williams 9 10.00 1097 Thomas Wilson 2 25.71 1098 Emma Wood 7 6.43 1099 Jacob Wright 11 3.57 1100 Gary Young 12 42.86 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning PostgreSQL On The Cloud Simplifying Database As A Service On Cloud Platforms

Authors: Baji Shaik ,Avinash Vallarapu

1st Edition

1484234464, 978-1484234464

More Books

Students also viewed these Databases questions