Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCE 1 0 4 0 Lab 1 Assignment You are to write a program that reads in lines of input using scanf or cin, and

CSCE 1040 Lab 1 Assignment
You are to write a program that reads in lines of input using scanf or cin, and file redirection, process the data, and then output the results using printf or cout. This means you can use C or C++ style IO as is your personal preference.
Name your file lablassignment.cpp. Failure to name the file correctly may lead to a grade of zero.
The data file used in the example is available at: dmk0080/public/1040/labs/one. or in the Cavans assignment. Use the file named "transactiondata"
Use command line redirection to execute as in ./a.out transactiondata
to compile use g++ labassignment 1.cpp to create the executable file a.out
The data:
Each line of th named "transactione data file begins with an 'e','c', or 't'.
Lines beginning with 'e' will have an integer employee ID and an employee name.
Lines beginning with 'c' will have an integer customer ID, customer name, and a floating point account balance.
Lines beginning with a 't' will have a customer ID, employee ID, a 'w' or 'd' representing withdrawal or deposit, and a floating point transaction amount.
Lines beginning with an 'e' and 'c' may be intermingled, but all 'e' and 'c' lines will come before lines beginning with 't'.
There will be at most 50 employees and 50 customers, and an unknown number of transactions. Names will be at most 15 characters long.
An example data file is shown below:Page 1 of 2Your program should read in the employee and customer information and update the customer account balance depending on the transaction. For example, t 18 w 4924.86 means to update the balance for customer 1 by withdrawing 4924.86 from Devon's account balance of 56442.27875. For each transaction, output customer name, the employee name, a plus sign for deposit or a minus sign for withdrawal, the transaction amount, and the new balance after the transaction with two decimal places (truncate values; do not worry about rounding). For example, the output for the example transaction above would appear as (include the line of digits):123456789012345678901234567890123456789012345678901234567890Devon Kourtney - $4924.86$51517.42
For the above the data file, your output would be:
t,8,10,d,5599.44
t,6,9,d,1936.16
t,7,9,d,7363.98
Your program should read in the employee and customer information and update the customer account balance depending on the transaction. For example, t18w4924.86 means to update the balance for customer 1 by withdrawing 4924.86 from Devon's account balance of 56442.27875. For each transaction, output customer name, the employee name, a plus sign for deposit or a minus sign for withdrawal, the transaction amount, and the new balance after the transaction with two decimal places (truncate values; do not worry about rounding). For example, the output for the example transaction above would appear as (include the line of digits):
123456789012345678901234567890123456789012345678901234567890
Devon
Kourtney -$4924.86 $ 51517.42
For the above the data file, your output would be:You should create structures to hold the data for each employee and for the customers, including their current balance. Then create arrays of these structures. You will need counters to keep track of the next available space in each array, as well as to use for loop control when searching for information. The arrays may be fixed size base on the limits provided above. When you receive a 't" command you can get the employee name and customer name and balance from the arrays. Be sure to update the customer balance to complete the transaction processing. You will output the iformation as described above.
When oyu have completed and tested your program on the CSE Linux Servers, you will need to download it to your local machine, and then upload it to the assignment box in Canvas for Lab1. Be sure to include all the files needed to compile, link and run your program if you created more than a single program file.
image text in transcribed

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

Step: 3

blur-text-image

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago