Question
please do the program in simple programming it is for my first c++ computer class i posted the example on pic 2,3 which is how this should be done
Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service
8:24 Search - IE Done HW3_CS114.cpp #include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; int main() {
8:25 Search - IE Done HW3_CS114.cpp else carWashPrice = 3.00; } } else{ carWashPrice = 0; } totalDue = gasCost + carWashPrice
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<iomanip>
#define Regular_Service 10 //define the constants for regular price
#define Premium_Service 25 //define the constant for premium service
using namespace std;
//driver program
int main()
{
   //variable declaration
   int opt;
   int minute,day,night;
   float amount;
   //display the messager
   cout<<endl<<"************************************";
   cout<<endl<<"****WEL COME TO CELLULAR SERVICE****";
   cout<<endl<<"************************************";
   //display the types of service
   cout<<endl<<"1. Regular Service\n2. Premium Service";
   cout<<endl<<"Enter which type of service you want ?";
   cin>>opt; //read the option
   cout<<fixed<<setprecision(2);
   //condition for regular service
   if(opt==1)
   {
      amount=Regular_Service; //assign the default price to amount
      cout<<endl<<"Enter the number of minutes use the call : ";
      cin>>minute;//read the number of minutes
      if(minute>0 && minute<=50) //condition for minute greater than 0 and upto 50
      {
          amount=Regular_Service;
       }
       else
       if(minute>50) //condition for minutes greater than 50
          amount=Regular_Service + (minute-50)*0.20;//compute the amount
          //display the details
          cout<<endl<<"You Have Choosen : Regular Service";
          cout<<endl<<"You have use the service for "<<minute<<" minutes.";
          cout<<endl<<"You have to pay $"<<amount<<" towards the service.";
   }
   else
   if(opt==2)//condition for premium service
   {
           amount = Premium_Service;//assign the default price to amount
       cout<<endl<<"Enter the number of minutes service is used during day time : ";
       cin>>day; //read the number of minutes in day time
       cout<<endl<<"Enter the number of minutes service is used during night time : ";
       cin>>night; //read the number of minutes in night time
      
      
       if(day>0 && day<=75) //condition for day time in between 0 to 75
       amount = Premium_Service;
       else
       if(day>75)//condition for day time above 75
       amount = Premium_Service + (day-75)*0.10;
      
  
       if(night>100)//condition for night time greater than 100
       amount = amount + (night-100)*0.05;
       //print the details
       cout<<endl<<"You Have Choosen : Premium Service";
          cout<<endl<<"You have use the service for "<<day<<" minutes during 6.00 A.M to 6 P.M";
          cout<<endl<<"You have use the service for "<<night<<" minutes during 6.00 P.M to 6 A.M";
          cout<<endl<<"You have to pay $"<<amount<<" towards the service.";
         
         
   }
  
  
  
}

output'

****WELCOME TO CELLULAR SERVICE**** 1. Regular Service 2. Premium Service Enter which type of service you want ?1 Enter the n

********* ****WEL COME TO CELLULAR SERVICE** 1. Regular Service 2. Premium Service Enter which type of service you want ?2 En

Add a comment
Know the answer?
Add Answer to:
please do the program in simple programming it is for my first c++ computer class i...
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
  • C++ programming I need at least three test cases for the program and at least one...

    C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...

  • This is for a C++ program: I'm almost done with this program, I just need to...

    This is for a C++ program: I'm almost done with this program, I just need to implement a bool function that will ask the user if they want to repeat the read_course function. I can't seem to get it right, the instructions suggest a do.. while loop in the main function. here is my code #include <iostream> #include <cstring> #include <cctype> using namespace std; const int SIZE = 100; void read_name(char first[], char last[]); void read_course(int & crn, char des[],...

  • Hi guys! I need help for the Data Structure class i need to provide implementation of...

    Hi guys! I need help for the Data Structure class i need to provide implementation of the following methods: Destructor Add Subtract Multiply Derive (extra credit ) Evaluate (extra credit ) ------------------------------------------------------- This is Main file cpp file #include "polynomial.h" #include <iostream> #include <sstream> using std::cout; using std::cin; using std::endl; using std::stringstream; int main(int argc, char* argv[]){    stringstream buffer1;    buffer1.str(        "3 -1 2 0 -2.5"    );    Polynomial p(3);    p.Read(buffer1);    cout << p.ToString()...

  • My if/else statement wont run the program that I am calling. The menu prints but once...

    My if/else statement wont run the program that I am calling. The menu prints but once I select a number the menu just reprints, the function called wont run. What can I do to fix this probelm? #include <iostream> #include "miltime.h" #include "time.h" #include "productionworker.h" #include "employee.h" #include "numdays.h" #include "circle.h" using namespace std; int main() { int select=1;     while (select>0) { cout << "Option 1:Circle Class\n"<< endl; cout << "Option 2:NumDay Class\n" << endl; cout <<"Option 3:Employee and Production...

  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

  • 13.21 Lab: Rational class This question has been asked here before, but every answer I have...

    13.21 Lab: Rational class This question has been asked here before, but every answer I have tested did not work, and I don't understand why, so I'm not able to understand how to do it correctly. I need to build the Rational.cpp file that will work with the main.cpp and Rational.h files as they are written. Rational Numbers It may come as a bit of a surprise when the C++ floating-point types (float, double), fail to capture a particular value...

  • graph binary search for size and time c++ //System Libraries #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include <iomanip> #include <alg...

    graph binary search for size and time c++ //System Libraries #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include <iomanip> #include <algorithm> using namespace std; //User Libraries //Global Constants, no Global Variables are allowed //Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc... //Function Prototypes //Execution Begins Here! int main(int argc, char** argv) { int n, i, arr[50], search, first, last, middle,count=0,count_in,tot; clock_t start, end; float duration; cout<<"Enter total number of elements :"; cin>>n; cout<<"Enter numbers"; for (i=0; i<n;i++) cin>>arr[i]; cout<<"Enter a...

  • Hey, so i am trying to have my program read a text file using a structure...

    Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...

  • I did a program in computer science c++. It worked fine the first and second time...

    I did a program in computer science c++. It worked fine the first and second time when I ran the program, but suddenly it gave me an error. Then, after a few minutes, it started to run again and then the error showed up again. This is due tonight but I do not know what is wrong with it. PLEASE HELP ME! Also, the instruction for the assignment, the code, and the error that occurred in the program are below....

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

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
ADVERTISEMENT