473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Subscription Package program

namcintosh
Well, everyone, here I am again. (I'm becoming a familiar face, am I???)

I am working on an program in Borland C++ Builder 6 in which I have to create a program that asks the user for their name, what package they choose, and how many hours did they use. (Keep in mind that this program is not completed.)

Well, I have the program, and here it is.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <iomanip>      //Needed for the showpoint and setprecison command
  3. #include <fstream>      //Needed to use files
  4. #include <string>
  5. #include <conio>        //Needed to show black output screen
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.         char choice;
  11.         int hours;
  12.         string name;
  13.         double charges;
  14.  
  15.     // Displays the menu choices  on the screen.
  16.         cout << "\t\tInternet Service Provider\n";
  17.         cout << "\t\tSubscription Packages\n\n";
  18.  
  19.     cout << "A: For $9.95 per month, can get 10 hours of\n";
  20.         cout << "   access. Additional hours are $2.00 per hour. \n\n" ;
  21.  
  22.         cout << "B: For $14.95 per month, you can get 20 hours\n";
  23.         cout << "   of access. Additonal hours are $1.00 per hour. \n\n";
  24.  
  25.         cout << "C: For $19.95 per month unlimited access is provided.\n\n";
  26.  
  27.         cout << "Please enter your name. ";
  28.         getline (cin, name);
  29.         cout << "Which subscription package would you like?\n";
  30.         cin.get(choice);
  31.  
  32.         cout << fixed <<showpoint <<setprecision(2);
  33.  
  34.         if (choice == 'A' || 'a')
  35.         {
  36.                 charges = 9.95 + (
  37.                 cout << "Your charges are $ " << charges << endl;
  38.         }
  39.         else if (choice == 'B'||'b')
  40.         {
  41.                 charges =
  42.                 cout << "Your charges are $ " << charges << endl;
  43.         }
  44.         else if (choice == 'C' || 'c')
  45.         {
  46.                 charges =
  47.                 cout << "Your charges are $ " << charges << endl;
  48.         }
  49.         else if (choice > 'C' || >744)
  50.         {       cout << "You must choose packages A, B, or C. Also, your hours\n";
  51.                 cout << "must not exceed 744.\n";
  52.         }
  53.  
  54.         getch();
  55.     return 0;
Here is my problem:
I am trying to find out what calculations to use on the charges line.

The choices are:
A- $9.95 a month 10 hours are provided. Additional hours are $2.00 per hour.
B. $14.95 a month 20 hours are provided. Additonal hours are $1.00 per hour.
C. $19.95 per month. Unlimted access is provided.

For example, if a user chooses package A, and they use 15 hours that month, then that user would pay the $9.95 charge (for the 10 hours) plus an additional $10.00 ($2.00 * $5.00), which would be $19.95. I know how to calculate it, I just need help figuring out how to write it in C++.

Any input is appreciated.
Apr 9 '07 #1
8 2206
im new here and im not quite sure this will work..i guess it wont hurt if i try..=)

i think you should ask anoher input from the user for the number of hours in excess to his subsrcription

:: Full code removed per Posting Guidelines ::

i havent tried the code yet but i think it will work more or less.. =)
Apr 9 '07 #2
im sorry i posted the complete code..i just read the rule on not posting them..sorry! =(
Apr 10 '07 #3
sicarie
4,677 Expert Mod 4TB
im sorry i posted the complete code..i just read the rule on not posting them..sorry! =(
fressanme-
It's ok, but we do appreciate not posting full code - thanks for reading up on that.

namcintosh-
It seems like you have 99% of it, what part are you stuck on?
Apr 10 '07 #4
Well, everyone, here I am again. (I'm becoming a familiar face, am I???)

I am working on an program in Borland C++ Builder 6 in which I have to create a program that asks the user for their name, what package they choose, and how many hours did they use. (Keep in mind that this program is not completed.)

Well, I have the program, and here it is.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <iomanip>      //Needed for the showpoint and setprecison command
  3. #include <fstream>      //Needed to use files
  4. #include <string>
  5. #include <conio>        //Needed to show black output screen
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.         char choice;
  11.         int hours;
  12.         string name;
  13.         double charges;
  14.  
  15.     // Displays the menu choices  on the screen.
  16.         cout << "\t\tInternet Service Provider\n";
  17.         cout << "\t\tSubscription Packages\n\n";
  18.  
  19.     cout << "A: For $9.95 per month, can get 10 hours of\n";
  20.         cout << "   access. Additional hours are $2.00 per hour. \n\n" ;
  21.  
  22.         cout << "B: For $14.95 per month, you can get 20 hours\n";
  23.         cout << "   of access. Additonal hours are $1.00 per hour. \n\n";
  24.  
  25.         cout << "C: For $19.95 per month unlimited access is provided.\n\n";
  26.  
  27.         cout << "Please enter your name. ";
  28.         getline (cin, name);
  29.         cout << "Which subscription package would you like?\n";
  30.         cin.get(choice);
  31.  
  32.         cout << fixed <<showpoint <<setprecision(2);
  33.  
  34.         if (choice == 'A' || 'a')
  35.         {
  36.                 charges = 9.95 + (
  37.                 cout << "Your charges are $ " << charges << endl;
  38.         }
  39.         else if (choice == 'B'||'b')
  40.         {
  41.                 charges =
  42.                 cout << "Your charges are $ " << charges << endl;
  43.         }
  44.         else if (choice == 'C' || 'c')
  45.         {
  46.                 charges =
  47.                 cout << "Your charges are $ " << charges << endl;
  48.         }
  49.         else if (choice > 'C' || >744)
  50.         {       cout << "You must choose packages A, B, or C. Also, your hours\n";
  51.                 cout << "must not exceed 744.\n";
  52.         }
  53.  
  54.         getch();
  55.     return 0;
Here is my problem:
I am trying to find out what calculations to use on the charges line.

The choices are:
A- $9.95 a month 10 hours are provided. Additional hours are $2.00 per hour.
B. $14.95 a month 20 hours are provided. Additonal hours are $1.00 per hour.
C. $19.95 per month. Unlimted access is provided.

For example, if a user chooses package A, and they use 15 hours that month, then that user would pay the $9.95 charge (for the 10 hours) plus an additional $10.00 ($2.00 * $5.00), which would be $19.95. I know how to calculate it, I just need help figuring out how to write it in C++.

Any input is appreciated.
I got it, thanks.
Apr 10 '07 #5
I got it, thanks.
how about if the subscriber exceeds 10hours?that means he would have to pay additional fees,right?i believe you lack that one..
Apr 10 '07 #6
fressanme-
It's ok, but we do appreciate not posting full code - thanks for reading up on that.

ill keep that in mind.. =D
Apr 10 '07 #7
ill keep that in mind.. =D
Yes, that is what it mean.

But, my calculations are still not coming out right
Apr 18 '07 #8
ill keep that in mind.. =D
I got it, thanks!!!
Apr 20 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Max A. Bündchen | last post by:
My enterprise is a Registered Microsoft Partner and we would to acquire a MSDN Universal subscription under the Empower ISV Program to start a new project in .Net (today we dev under VFP 7). ...
1
by: Mr_NeilT | last post by:
Ok. I am fairly computer literate and have built a number of simple web sites before but am now working on a new project. I have just got FrontPage 2003 and want to build a subscription web site...
5
by: Odd Bjørn Andersen | last post by:
I have a problem when using Replication Center on version 8.2 (fixpack 9) when I try to manage my SQL Replication environment. When I add existing Apply Control Servers I am not able to see...
33
by: news.microsoft.com | last post by:
To Microsoft and fellow MSDN Universal subscribers... Regarding new MSDN Universal (I mean Premier) price and level changes: 1) Way too expensive for the small and medium developer Universal...
6
by: WebMatrix | last post by:
Hello, Sorry for the repost, I haven’t got any response in aspnet.webservices group. We have a web service being used by several clients. It's SSL secured, uses Windows (Basic)...
3
by: shorti | last post by:
running on AIX with DB2 v8.2.2 I ran across a problem with naming source files with similar names. For instance, if I have these three files: upd_startaccessingdb.sqc upd_startusingdb.sqc...
0
by: UNIQUENAME | last post by:
i'm relatively new to db2, and having a problem. running udb v8 in a windows platform trying to connect from a ibm vse box. after a clean compile and succesful package build i execute program...
2
by: =?Utf-8?B?SmFzb24gQS4gSmVuc2Vu?= | last post by:
I have a MSDN Subscription expiring this month but really need Visual Studio 2008 when it comes out. I called customer service to find out but they don't know. They seemed to think it was a...
7
by: alito | last post by:
Hi all, I am new to using packages to group my modules. I can't figure out how to run a module that uses relative imports without writing a wrapper that imports that module. Everything I try...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.