he service charge is $7.00. It costs $0.45 per page for the first ten pages and $0.10 for each additional page. T

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a function that will find the cost to send an international fax. The service charge is $7.00. It costs $0.45 per page for the first ten pages and $0.10 for each additional page. Take as parameter the number of pages to be faxed, and calculate the total amount due. The total amount due is returned to the main program. (Only a function is required here) 

Expert Solution
Step 1

Source code in C++

#include<iostream>                                             //define the header

using namespace std;

int main()                                                           //define the main

{

float pages, Tcost;                                                              //declare the float variables 

cout<<"please enter number of pages"<<endl               //display the message to enter the number of pages

cin>>pages;                                                                             //Reading the pages

if(pages<=10)                                                                     //validating the conditions

{

Tcost=3+pages*0.45;                                                             //conditions

}

else                                                                                           //else block for alternative

{

 if(10<pages<=100)                                                       //again checking the condition

  Tcost=3+10*0.45+(pages-10)*0.1;

else                                                                                      //else block for alternative

 Tcost=1+0.45*10+(pages-10)*0.10;                                     //applying the condition

}

cout<<"Total cost is: "<<Tcost;                                //display message of total cost

return 0;

}

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY