Answered step by step
Verified Expert Solution
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 Lab 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 or style 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: publiclabsone or in the Cavans assignment. Use the file named "transactiondata"
Use command line redirection to execute as in aout transactiondata
to compile use g labassignment cpp to create the executable file aout
The data:
Each line of th named "transactione data file begins with an or
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 will have a customer ID employee ID a or representing withdrawal or deposit, and a floating point transaction amount.
Lines beginning with an e and c may be intermingled, but all e and lines will come before lines beginning with
There will be at most employees and customers, and an unknown number of transactions. Names will be at most characters long.
An example data file is shown below:Page of Your program should read in the employee and customer information and update the customer account balance depending on the transaction. For example, t w means to update the balance for customer by withdrawing from Devon's account balance of 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:Devon Kourtney $$
For the above the data file, your output would be:
Your program should read in the employee and customer information and update the customer account balance depending on the transaction. For example, means to update the balance for customer by withdrawing from Devon's account balance of 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:
Devon
Kourtney $ $
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 Lab Be sure to include all the files needed to compile, link and run your program if you created more than a single program file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started