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

  Compute and plot the 128 point fft of a cosine wave

Compare the differences in the FFT result. Explain why even though the inputs to both FFTs are the same cosine waves, the shapes of the FFTs are different. Calculate, plot and compare the results of the 512-point FFT of the above signal.

  Determine what are the relative juntion areas

Two transistors, fabricated with the same technology but having different junction areas, when operated at a base emitter voltage of 0.75V, have collector currents of 0.2mA and 5mA. A. Find Is for each device.

  Determine the instantaneous power

RC ciruit= Current course (3u(-t) A) in parrallel to 6k ohm resistor and 5uF cap. Determine the instantaneous power absorbed by the resistor at t=(0); 30ms; and 90ms.

  What value of resistors are required for the voltage divider

A HCS12 ATD is set to 8-bit unsigned mode. A temperature sensor measuring 0 to 100 degrees with an output of 25 mV/degree is attached to the input. The ATD low voltage reference is attached to ground and the high voltage reference

  Find an xc value to put in parallel with the motor

A P=900W electric motor with pf=0.82 lagging is connected to a 240 Vrms 60 hertz source. a) Draw an equivalent circuit showing impedance and phasor values for Vs, R and X. b) Find an Xc value to put in parallel with the motor which corrects the pf to..

  Describe are h1 and h2 independent events

You have two biased coins. Coin A comes up heads with probability 1/4. Coin B comes up heads with probability 3/4. However, you are not sure which is which so you flip each coin once where the first coin you flip is chosen randomly.

  Evaluate cross or auto correlation

You have to figure out which one using cross or auto correlation.

  Explain how the excitation be increased or decreased

Let us assume that a synchronouse 3 phase alternator produces a no-load line voltage of 13.2 KV. if a load having a lagging power factor of 0.8 is connected to the machine, must the excitation be increased or decreased

  What are the transfer function

What are the transfer function and the impulse response of the system?

  What is the mode integer m of the peak radiation

Consider an AlGaAs based heterostructure laser diode which has an optical cavity of length 200 microns. The peak radiation is at 870 nm and the refractive index of GaAs is about 3.7.  What is the mode integer m of the peak radiation

  Write the vhdl assignment operator for the y1 output

Write the VHDL assignment operator for the Y1 output of a BCD-to-binary encoder. Use Boolean operators, D0-D9 as the data inputs lines and Y0-Y2 for the outputs. Inputs and outputs are active-HIGH.

  Explain what are two of the major considerations

What are two of the major considerations that factor in the design of a substation. Give a couple of examples of station layouts where these factors are clearly demonstrated. What typical grounding materials are used in substations.

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