Write a function charges that computes the total charge

Assignment Help Electrical Engineering
Reference no: EM13264881

A cell phone provider charges customers $45.00 a month for up to 10 GBytes of data usage. Additional data usages is $5.00 per GB. Any amount over the 10 GB limit will charge at least $5.00, and all additional data charges are in $5.00 increments. So, if someone used 11.2 GB of data they would be charged for 12 GB of data usage.

Write a function 'charges' that computes the total charge for a customer based on the GB of data the user uses per month. The function should also calculate the average cost per MByte of data (rounded to the nearest cent). Pass the needed information to the 'charges' function and return the results by reference (that is using a pointers).

Write a second function 'user_data_read' that takes as reference a file pointer to the file usage.txt , reads in the user data and stores the data by reference into the location of a variable that the main function can use. Then write a third function 'user_data_write' (this function should be called from main) that prints the customer data to a file charges.txt. All data should be passed by reference to 'user_data_write'. Your program should be capable of reading in at least 1000 different customers from one file.

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 GB's used

Here is a sample of the data file and the corresponding output file:

usage.txt

10 2009
15362 4.2
42768 11.1
12352 12.9


charges.txt

Customer Data Usage (GBs) Total Cost ($) Cost per MB ($/MB)
15362 4.2 45.0 0.0045
42768 11.1 ................................ (and so on)

Reference no: EM13264881

Questions Cloud

Find the rate at which you lose energy by exhaling humid air : The excess internal energy of metabolism is exhausted through a variety of channels, such as through radiation and evaporation of perspiration. Calculate the rate at which you lose energy by exhaling humid air
At what unit output level would the two methods provide : The sales price per deck would be the same under each method. At what unit output level would the two methods provide the same operating income (EBIT)?
Explain melting point of a mixture of 2-naphthol : An unknown compound has a melting point of 121 - 122 °C. Melting point of a mixture of pure benzoic acid and your unknown sample was 116-122 °C. Melting point of a mixture of 2-naphthol and your unknown sample was 110 - 116 °C. What is your unknow..
Calculate the dollar cost of each of the proposed plans : If the firm had made a purchase of $100,000 for which it had been given terms of 2/10 net 30, would it increase the firm's profitability to give up the discount and not borrow as recommended in part b? Why or why not?
Write a function charges that computes the total charge : Write a function 'charges' that computes the total charge for a customer based on the GB of data the user uses per month. The function should also calculate the average cost per MByte of data (rounded to the nearest cent).
Find the average electromagnetic energy density : An 800 kHz radio signal is detected at a point 9.5 km distant from the transmitter tower. Find the average electromagnetic energy density
Define how the ocean optics spectrophotometer works : using any diagrams that you wish to draw, explain how the Ocean Optics spectrophotometer works. Note: we are not asking how to operate the spectrophotometer.
Define what is the mass of the water : A 32.0 iron rod, initially at 22.0C, is submerged into an unknown mass of water at 63.7C, in an insulated container. The final temperature of the mixture upon reaching thermal equilibrium is 59.4C.
Role of it for wage calculation : Different Wages Payment plans available for wages Payment and the costs and benefits of hiring new labour.

Reviews

Write a Review

Electrical Engineering Questions & Answers

  Lithium ion battery technology

The paper includes Lithium ion battery technology with its advantages and disadvantages. The paper discusses about the Lithium air battery in which detailed reactions of Lithium with air including nonaqueous as well as aqueous are given.

  Power transformers and tariffs

Construction of different types of power transformer, significant energy savings

  Paper on orthogonal frequency-division multiplexing

This document is shown a paper on Orthogonal frequency-division multiplexing with advantages, disadvantages and uses.

  Function of the hmi in a scada system

This assignment contains electronics engineering questions like State the commonly found components of a SCADA (Supervisory control and data acquisition) system. and decribe the function of the HMI in a SCADA system.

  Resultant waveform of the odd harmonic series

Prepare an Excel graph showing the individual components and summated resultant waveform of the odd harmonic series resulting in an approximate square wave.

  Explain scada system

Explain the function of the HMI in a SCADA system.

  Design a 2-digit 24 second shot-clock

Design a 2-digit 24 second "shot-clock" countdown timer with pushbutton controller.

  Model a discrete-time system

To understand di erent signal models To be able to model a discrete-time system and design simple signal processing algorithms.

  Draw a relay construction diagram

Draw a relay construction diagram and briefly explain the operation of a relay.

  Frequency division multiplexing

Write a short technical report on Frequency Division Multiplexing

  Impact of electron energy

Briefly discuss the impact of electron energy, electron current and target on the Bremsstrahlung generated.

  Traffic light controller

The schematic of the traffic light controller

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd