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

  Determine the value of the resistance in terms of parameters

Show that a linear dependent current source controlled by a voltage appearing across an element in parallel with the dependent source is equivalent to a resistor. Determine the value of the resistance in terms of the parameters of the dependent so..

  Find out the open circuit voltage-v of the cell

Consider a 6 cm2 dye sensitised solar cell with reverse saturation current Jr=10-10A/cm2. When the solar irradiance is 1,000 W/m2, it produces an equivalent photo current/short circuit current of 15 mA/cm2 at 300 K.

  At what coordinate on the x axis is the electric field

Two particles are fixed to an x axis: particle 1 of charge q1 = 2.03 x 10-8 C at x = 16.0 cm and particle 2 of charge q2 = -4.62q1 at x = 77.9 cm. At what coordinate on the x axis is the electric field produced by the particles equal to zero

  Describe an experiment that galvani could have performed

When we discussed the work of Galvani and Volta, we noted that Galvani's work was not fully appreciated until the development of instruments capable of detecting and amplifying the small biopotentials present in living organisms.

  Determine phase lag for the system if the input u given

Consider the stable system represented by the differential equation: dx(t)/dt + 3x(t) = u(t) Determine the phase lag for this system if the input u(t) = sin3t.

  Describe a system project that might have three iterations

Discuss these possible reasons, indicating which are the most important: The field is so young; such different needs; there are so many types of systems; and people with widely different backgrounds are developing.

  Find the electric field intensity using spherical vectors

(a) Find the electric field intensity using Cartesian vectors, Ecart, at the free space point P(-2.00 m, 5.00 m, 2.00 m). (b) Find P in spherical coordinates. (c) Find the electric field intensity using spherical vectors, Espher.

  Explain complex cmos gate of the function

1. An SEdit schematic showing a properly constructed complex CMOS gate of your function. 2. Annotate the schematic with proper sizing parameters for each transistor to achieve behavior similarto a symmetric inverter

  Find the mass flow rate in sec at inlet and mass flow rate

steam flows through a turbine one inlet and two exits with know condition at the steady state ( hints: h1=3231KJ/kg, h2=2812 KJ/kg , specific volume (v)= 0.0994 m^3/kg , at p= 30 bars,v=0.4045m^3/kg, at p=5 bars, no potential and kinetic energy ch..

  Compare the capacitance per unit length of cases

Capacitance can be altered by immersing part of the two wire line into a different medium. (a) What is the capaccitance per unit length in F/m of the transmission lines. You must explain your reasoning and show the equation you used.

  Develop a sensor circuit using commodity components

ETEC 6414 Sensors and Wireless Communications, Assignment 1(a) –Sensor Circuit,  Develop a Sensor Circuit using commodity components

  Calculate equivalent series impedance and resistance

The nameplate on a 50-MVA, 60-Hz single-phase transformer indicates that it has a voltage rating of 8.0-kV: 78-kV. An open-circuit test is conducted from the low-voltage side, and the corresponding instrument readings are 8.0kV, 62.1A, and 206kW.

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