Question

In the land of Utopia , they don't want people to waste time on phone calls...

In the land of Utopia , they don't want people to waste time on phone calls and a phone call in minutes is charged as given below:

- First 30 minutes is charged 10 cents per minute.

- Next 30 minutes is charged 50 cents per minute

- Next 30 minutes is charged 75 cents per minute.

- If the call prolongs more than 90 minutes remaining minutes are charged at a dollar per minute.

So write a simple function calcCharge() to calculate the charge in dollars for a input of phone call in minutes. No main required

So for example if a person talks on the phone for an hour and 45 minutes (105 minutes), the charge will be calculated as a total of $55.50 ($3.00 for the first 30 minutes, $15.00 for the next 30 minutes, $22.50 for next 30 minutes and $15.00 for the remaining minutes.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

calcCharge(int duration)
{
   int charge=0,f,c[4];
   c[0]=10;c[1]=50;c[2]=75,c[3]=90; //cost of different time slots
   for(i=0;i<4;i++)
   {
       if((duration-30)>=0)
       {
           f=30;
           duration-=30;
       }
       else
       {
           f=duration;
           charge=charge+(f*a[i]);
           break;
       }
       charge=charge+(f*a[i]);
   }
   return charge;
}

Add a comment
Know the answer?
Add Answer to:
In the land of Utopia , they don't want people to waste time on phone calls...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment: My friend, Cary Parker, owns a small parking garage downtown. She wants you to write...

    Assignment: My friend, Cary Parker, owns a small parking garage downtown. She wants you to write a program to help her calculate the parking charge at the payment booth. The price to park in the lot is $5.50 per hour, plus city parking tax. However, partial hours (even one minute into an additional hour) are charged at the full hour’s rate. For example, if you park for exactly 60 minutes, or less, you will pay $5.50 plus tax, but if...

  • Don't mind the questions in the text. showed Americ ministe comm waste crati tic 30 11...

    Don't mind the questions in the text. showed Americ ministe comm waste crati tic 30 11 International until a Tampa paper charged that CASE CASE 14.1 Blood for Sale William H. Shaw and Vincent Barry Sol Levin was a successful stockbroker in Tampa, Plasma International searched worldwide ani Florida, when he recognized the potentially profit with the advice of a qualified team of medical con able market for safe and uncontaminated blood and, sultants, did extensive testing. Eventually they found...

  • Team Conflict In a rare moment alone in her office, Jennifer Ames reflected on the past...

    Team Conflict In a rare moment alone in her office, Jennifer Ames reflected on the past 10 years of her career at BabyProduct Corporation (BPC). She could easily chart her successes: She had taken on challenges and produced results where her colleagues had failed; she had increased the diversity of the work force in every unit she had led; she had successfully launched new products and developed several new markets. In fact, just a few months before, Ames had been...

  • Please provide a 1) Budgeted income statement for the year ending June 30, 2019. 2) Budgeted...

    Please provide a 1) Budgeted income statement for the year ending June 30, 2019. 2) Budgeted balance sheet for June 30, 2019. We only need annual totals for the budgeted financial statements Kimmel Gnomes, located in South Dakota, may be the only other manufacturer of high quality clay garden gnomes that are hand finished. Kimmel Gnomes are stoneware, rather than terracotta. Stoneware uses higher-quality clay than terracotta and the gnomes are fired at higher temperature, yielding a stronger, more durable...

  • Please provide a 1) Sales budget, including a schedule of expected cash collections. 2) Production budget....

    Please provide a 1) Sales budget, including a schedule of expected cash collections. 2) Production budget. Kimmel Gnomes, located in South Dakota, may be the only other manufacturer of high quality clay garden gnomes that are hand finished. Kimmel Gnomes are stoneware, rather than terracotta. Stoneware uses higher-quality clay than terracotta and the gnomes are fired at higher temperature, yielding a stronger, more durable gnome. The gnomes are fired inside and out and are colored with glaze before firing, rather...

  • Please provide a: 1) Direct materials budget, including a schedule of expected cash disbursements for materials....

    Please provide a: 1) Direct materials budget, including a schedule of expected cash disbursements for materials. 2) Direct labor budget. Kimmel Gnomes, located in South Dakota, may be the only other manufacturer of high quality clay garden gnomes that are hand finished. Kimmel Gnomes are stoneware, rather than terracotta. Stoneware uses higher-quality clay than terracotta and the gnomes are fired at higher temperature, yielding a stronger, more durable gnome. The gnomes are fired inside and out and are colored with...

  • Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the...

    Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019 for our corporate strategic planning process, and we cannot wait for Richard’s return from Kentucky. We would like you to prepare the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019. The deliverables are as follows: 1. Sales budget, including a schedule of expected cash collections. 2....

  • Rush Inuit is an impulsive, fly-by-the-seat-of-his-pants kind of guy. His best friend, Stu Earley, is the...

    Rush Inuit is an impulsive, fly-by-the-seat-of-his-pants kind of guy. His best friend, Stu Earley, is the exact opposite – cautious and reluctant. The two are recent UNCG graduates who roomed together all … ahem … eight years. You know who they are even though they graduated last year because everyone on campus knows Rush and Stu – they’re legends on the social scene. To make ends meet during college, Rush and Stu organized fun trips to exciting destinations and charged...

  • Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the...

    Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019 for our corporate strategic planning process, and we cannot wait for Richard’s return from Kentucky. We would like you to prepare the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019. The deliverables are as follows: 1. Selling and administrative expense budget. 2. Cash budget. 3. Budgeted...

  • Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the...

    Our controller, Richard Kimmel is negotiating with potential new Clay suppliers in Kentucky. We need the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019 for our corporate strategic planning process, and we cannot wait for Richard’s return from Kentucky. We would like you to prepare the Large Gnome Division’s Master Budget for the fiscal year ended June 30, 2019. The deliverables are as follows: 1. Manufacturing overhead budget. 2. Ending finished goods inventory budget calculating...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT