Need help writing pseudocode and flowchart for the following code. Help please.

Hi all, I have finished writing the code for the following program. I have concerns with the pseudocode that I have written and the flow chart seems really complicated. I dont know how to build it.

Here is the question:

An Internet service provider has three different subscription packages for its customers:
Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour.
Package B: For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour.
Package C: For $19.95 per month unlimited access is provided.
Write a program that calculates a customer s monthly bill. It should ask which package
the customer has purchased and how many hours were used. It should then display the total amount due.
Input Validation: Be sure the user only selects package A, B, or C. Also, the number of hours used in a month cannot exceed 744

Here is my program:
#include <iostream>
using namespace std;

int main()
{
char package;
int hours;

cout << "Select a package: \n" << endl;
cout << "Package\t\tCost\t\tHours Provided\t\tExtra Hours" << endl;
cout << "A\t\t$9.95\t\t10\t\t\t$2.00 per hour" << endl;
cout << "B\t\t$14.95\t\t20\t\t\t$1.00 per hour" << endl;
cout << "C\t\t$19.95\t\tUnlimited\t\tUnlimited" << endl;

cout << "\nEnter the package purchased: ";
cin >> package;
while(package!= 'A' && package!='a' && package!='B' && package!='b'&&
package!='C' && package!='c')
{cout <<"\nError! You must select package A, B, or C. ";
cout <<"Enter the package purchased: ";
cin >> package;}

cout <<"\nEnter the number of hours used: ";
cin >>hours;
cin.get();
while(hours < 0 || hours > 744)
{cout <<"\nError! Hours cannot be negative or exceed 744. \n\nYou must enter appropriate hours.";
cout <<"\n\nEnter the number of hours used. ";
cin >> hours;}

if(package == 'A' || package == 'a')
{if (hours <= 10)
cout<<"\nYour monthly fee is: $9.95";
else cout<<"\nYour monthly fee is: $"<<9.95+(hours-10)*2;}

if(package == 'B' || package == 'b')
{if (hours <= 20)
cout<<"\nYour monthly fee is: $14.95";
else cout<<"\nYour monthly fee is: $"<<14.95 + hours - 20;}

if(package == 'C' || package == 'c')
cout<<"\nYour monthly fee is: $19.95";

cin.get();
return 0;
}

What should be my pseudocode and flowchart ? Can i copy and paste my pseudocode here ?
Please help. Thank You C++ geniuses :)
Problems so far:

1. Haven't taken on-board advice already given;
2. Done your assignment backwards;
3. Started a new thread for the same subject;
4. Not used code tags.

Comments:

1. Maybe you posted the wrong version of your code, but more likely - Your code seems to work so you are to scared to change it. Just because it works doesn't mean it can't be improved and get more marks. So grow a std::pair (sorry for the hard sarcasm!) and do a new version of your code that makes use of the advice given- you can copy the existing code to a new file & change that you know? Sorry, I get a bit irate when I spend time giving advice & it is seemingly ignored.

Or maybe you don't want to post the final code because others in your class might copy it. In that case ask a question about how to do flow charts & don't post any code. Maybe you were hoping someone would do the flowchart for you? Not me, but I am happy to give clues.

2. You were supposed to do a flow chart & psuedo code first, then write the code - which would have been a whole lot easier all round. That is why your teacher includes that stuff in the assignment. I see newbies write messy code all the time for that very reason.

3 & 4. Self explanatory.

So, can you tell us what are the important parts of a flowchart? There are at least 2, the most important one starts with a D.

With psuedo code, I write it as comments, then go back and write the code after the comments. Leave the comments because they can serve as documentation.
Topic archived. No new replies allowed.