Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

From Round.C aka Problem 1 From Cell.dat File You have decided to look in to changing your cell phone service because you keep going over

image text in transcribed

From Round.C aka Problem 1

image text in transcribed

From Cell.dat File

image text in transcribed

You have decided to look in to changing your cell phone service because you keep going over the free minutes limit and the per minute charges are costing you big time. The two service providers you have been looking at are Jog and Holo-T. Both services have the same number of free minutes, but charge differently for calls in excess of that limit. Your phone lets you download the data for each call you make in excess of your free minutes to your computer, so you decide to write a program to calculate how much it would cost you for a typical month using each of these services. (You can find a sample data file in -ee 160/Homework/Hw1/cell.dat). Jog charges you $0.05 per minute for each excess minute. However, they calculate your excess minutes by rounding each call to the nearest minute and adding up the total. Holo-T charges you $0.07 per excess minute. However, they caclulate your excess minutes by adding the total of all your excess calls, and then rounding the total to the nearest minute. Write a program that reads the data from a file (redirected on the command line), and computes the cost for each of the cell phone companies. You will run the program with a command like: a.out int round_to_int (float value) { int num; num=value; value=value-num; if(value>0.5) num ++; return num; int main() { float val; while (1) printf("Enter number:"); scanf("%f", &val); if(val==0) break; printf("int is:%d ", round to int(val)); return 0; } 2.53 3.75 1.60 3.25 1.50 1.53 2.48 5.98

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

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

Under what conditions do two 2 2 upper triangular matrices commute?

Answered: 1 week ago