To design, implement and document simple modular programs that use functions and loops.
Write a program that calculates the monthly bills for a telecommunications services company.
The company provides three services (telephone, internet and television) and each user can have only one service. The program should prompt the user to enter an account number (type unsigned int) and a service code (type char). Code P means telephone service, code I means internet service and code T means television service. The program should prompt the user until a valid code is entered (both lowercase and uppercase letters should be accepted).
The user should be prompted to provide the service consumption figures in number of minutes (type unsigned int). The rates depend on the service as follows:
Telephone (code P): 15.00 line rental plus 0.05 per minute used.
Internet (code I): 20.00 for the first 1000 minutes of internet connection (flat rate) and 0.02 for each additional minute the user was connected to internet.
Television (code T): TV users can either have a basic or a premium pack (but not both). For TV users, the program should also prompt the user to indicate the pack type. The rate varies depending on the user's TV pack as follows:
The program should display the account number and the amount due by the user.
The calculation of the amount due should be performed by three functions:
1. telephone(): Function that takes an input argument mins of type unsigned int and returns the amount due as a value of type double. This function should be used to compute the amount to be charged to telephone users.
2. internet(): Function that takes an input argument mins of type unsigned int and returns the amount due as a value of type double. This function should be used to compute the amount to be charged to internet users.
3. television(): Function that takes two input arguments pack_type and mins, both of type unsigned int, and returns the amount due as a value of type double. This function should be used to compute the amount to be charged to television users.
In the test part of your report, specify the results provided by your program for: i) 100 minutes of phone service; ii) 500 minutes of internet service; iii) 2000 minutes of internet service; iv) 1000 minutes of basic TV service; and v) 1000 minutes of premium TV service.
Note: You may want to use the toupper function in your program, which is defined in the ctype.h header file. Check your lecture notes or a C reference for details on how to use it.
In probability theory and statistics, sometimes it can be useful to compute the value of a metric called kurtosis. This metric is used to describe certain properties of a random variable (i.e., a variable that can take random values). Let x1 ,x2 ,...,xn denote a sequence (vector) of n samples (values) taken from a random variable of interest. Assume in this exercise that all n samples can only take positive real values (including zero). The sample kurtosis of a sequence of n values (x1 ,x2 ,...,xn ) can be computed based on the following expression: see image.
where represents the mean/average value of the sequence, which is given by: see image.
Write a program that computes the sample kurtosis of a sequence of positive real values (including zero) entered by the user. The program should have a maximum capacity of 10 values. The user should be prompted continuously until either of these events occurs:
a) The user enters a negative value (this means that the user has no more values).
b) The maximum capacity is reached (i.e., the user has entered 10 values). When the 10 th value is entered, the program should display a message indicating that the maximum capacity has been reached and more values cannot be accepted.
The program will then compute the sample kurtosis based on the valid values entered by the user (positive and zero) and display them (one per line) as well as the kurtosis, as shown in the following example (note that all indexes are displayed with 2 digits, e.g., Value 01):
Value 01 = 26.34
Value 02 = 4.34
Value 03 = 1.245
--------------------
Kurtosis = 1.5
In the test part of your report, indicate the results provided by your program for these cases:
Notes: