Question

Design an algorithm for each of the exercises and type it into a word document. Upload...

Design an algorithm for each of the exercises and type it into a word document. Upload the document to PE1 assignment folder.

1) Decision-based Algorithm:

A cell phone company offers a plan with 750 minutes of voice communications at a rate of \$40.00/month. Any minutes over 750 are charged at a rate of 0.50 per minute.

Write an algorithm that allows the user to input the number of minutes a phone customer used during a particular month. The algorithm should determine the monthly charge. (Do not worry about taxes and other cell phone fees.)

Hint: You will need a decision statement that determines whether or not the user has exceeded his plan’s minutes. The formula to calculate his monthly charge will differ slightly based on the result of this decision.

Homework Answers

Answer #1

A cell phone company offers a plan with 750 minutes of voice communications at a rate of \$40.00/month. This means if even if the user uses less than 750 minutes of data communication he/she will be charged 40\$.

Any minutes over 750 are charged at a rate of 0.50 per minute. This means if more than 750 minutes are used the monthly charge will be 40\$ with additional cost = additional minutes * 0.5 \$

The formula for determining the cost of the cell phone bill is

c=p+(m−b)r

Where:

c is the total cost of the bill, to be found out.

p is the base price of the plan: \$40 for this problem.

m is the number of minutes used, data to entered by the user.

b is the base number of minutes allowed: 750 for this problem.

r is the rate for additional minutes: \$0.5 for this problem.

Hence there is a condition that number of minutes is greater than 750 or not, which leads to two separate course of action. To calculate the monthly charge the following algorithm in the form of flowchart can be designed:

Now moving on to write a pseudo code algorithm for the problem:

function monthly_charge(m);

Input: m = number of minutes used

Output: c = monthly charge

if (m>750) then # this is the decision statement that determines whether or not the user has exceeded his plan’s minutes

d = m - 750 ;

c = 40 + 0.5 * d ;

else

c = 40 ;

return (c)

end

Now here i am writing a c program to demonstrate the above algorithm. Check this out:

```#include <stdio.h>
int main () {
int b = 40;
int m,d.c;
printf("Enter the number of minutes used: ");
scanf("%d", &m);
if( m > 750 ) {
d=m-750;
c=40+(0.5*d);
printf("the monthly charge is %d\$\n",c );
} else {
printf("the monthly charge is 40\$\n" );
}
}
```

I have designed the required algorithm, also designed a flowchart for understanding, and finally wrote a c program which is a practical demonstration of the algorithm. Please up vote the answer if you find this helpful!!

Know the answer?
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
• Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

• Case Study 12: Hong Kong Police’s Project Management B Chuah Background In the 1990’s, Hong Kong...

Case Study 12: Hong Kong Police’s Project Management B Chuah Background In the 1990’s, Hong Kong Police (HKP) was responsible for the public safety and internal security of Hong Kong. She came under the umbrella of the Security Bureau of the Government of Hong Kong. It had more than 34,000 employees, of these, over 26,000 were disciplinary staff. This was the largest department within the hierarchy of the Government of Hong Kong. The organization structure of HKP was rather complicated....

• Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior...

Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior procurement manager for the Goldwell Restaurant Group. He is responsible for the procurement of IT commodities for the data center. After months of negotiating with the three best and lowest-priced bidders for the computer paper contract, Pauly selected Frankie’s Paper Company.  Pauly’s decision was made after a round of golf at Frankie’s country club. On the eighteenth hole, Frankie extended his hand to Pauly and...

• Summary should briefly analyze the central problems and issues of the case and provide some analysis...

Summary should briefly analyze the central problems and issues of the case and provide some analysis and suggestions. Thank you. Lean Initiatives and Growth at Orlando Metering Company It was late August 2002 and Ed Cucinelli, vice president of Orlando Metering Company (OMC), sat in his office on a late Saturday morning. He had come in to prepare for some strategic planning meetings that were scheduled for the upcoming week. As he noticed the uncommon silence in the building, Ed...

• I have this case study to solve. i want to ask which type of case study...

I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

• How can we assess whether a project is a success or a failure? This case presents...

How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App

Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?

Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT