Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Internet Lite Corporation is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional

image text in transcribed
Internet Lite Corporation is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional hours or partial hours are charged at $1.99 each. Write a function charges that computes the total charge for a customer based on the number of hours of connection time used in a month. The function should also calculate the average cost per hour of the time used (rounded to the nearest cent), so use two output parameters to send back these results. Write a second function round_money that takes a real number as an input argument and returns as the function value the number rounded to two decimal places. Write a main function that takes data from an input file usage.txt and produces an output file charges.txt. The data file format is as follows: Line 1: current month and year as two integers Other lines: customer number (a 5-digit number) and number of hours used Here is a sample data file and the corresponding output file: Data file usage.txt 10 2009 15362 4.2 42768 11.1 11111 9.9 Output file charges.txt Charges for 10/2009 Customer 15362 42768 11111 Hours used 4.2 11.1 9.9 Charge per hour 7.99 11.97 7.99 Average cost 1.90 1.08 0.81

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions