Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Input Data File This assignment will work with a sequential file. It has the

ID: 3559823 • Letter: T

Question

The Input Data File

This assignment will work with a sequential file. It has the following data fields:

Customer Number

Credit Limit

Previous Balance

Current Purchases

Payments

Credits/Returns

The Input Test Data File is called credit.dat You can create it in a text editor such as Notepad or write a .c program to create it. Only include the records and do not include the headings in the file. Place a space between each data item.

Customer

Number

Credit

Limit

Previous

Balance

Current

Purchases

Payments

Credits /

Returns

1001

2000.00

1900.47

500.00

100.00

0.0

1002

100.00

10.00

25.00

23.00

5.00

1003

4000.00

2500.00

400.50

300.00

0.0

1004

500.00

450.00

200.00

35.00

0.0

1005

250.00

120.00

100.00

0.0

45.50

Menu Choices

Write a c program that will allow the user a number of choices to process and view the information.

The main program should allow the user to enter one of five choices

Choice One:    For each customer record, show all of the fields contained in each record in the file, as well as the finance charge and new balance.

Choice Two:    Only display those records contained in the file in which the customer is over their credit limit. Display all of the fields contained in the record, as well as the finance charge and new balance. Additionally, display the amount the customer is over their credit limit.

Choice Three   Show the number of records contained in the file, along with the following accumulators: previous balance, payments, credits/returns, finance charge, as well as the new balance.

Choice Four: End Program Run

Be sure that your program rewinds the file for each choice made (excluding choice four (ending the programming run).

PROGRAMMING CONSIDERATIONS

Your program must pass the file via a file pointer to the appropriate function(s). Additionally, in terms of calculations, the finance charge is 1% of the new balance. Additionally, a 25.00 dollar fee should be charged if the customer account is over their credit limit and added to the new balance.

Need help please

Customer

Number

Credit

Limit

Previous

Balance

Current

Purchases

Payments

Credits /

Returns

1001

2000.00

1900.47

500.00

100.00

0.0

1002

100.00

10.00

25.00

23.00

5.00

1003

4000.00

2500.00

400.50

300.00

0.0

1004

500.00

450.00

200.00

35.00

0.0

1005

250.00

120.00

100.00

0.0

45.50

Explanation / Answer

#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; print header; print start_html("Results"); # first print the mail message... $ENV{PATH} = "/usr/sbin"; open (MAIL, "|/usr/sbin/sendmail -oi -t -odq") or &dienice("Can't fork for sendmail: $! "); print MAIL "To: recipient@cgi101.com "; print MAIL "From: nobody@cgi101.com "; print MAIL "Subject: Form Data "; foreach my $p (param()) { print MAIL "$p = ", param($p), " "; } close(MAIL); # now write (append) to the file open(OUT, ">>guestbook.txt") or &dienice("Couldn't open output file: $!"); foreach my $p (param()) { print OUT param($p), "|"; } print OUT " "; close(OUT); print
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote