Write the prototype function for Program A. a. c. Complete this section by writing appropriate program segment. d. Write the prototype function for this program if payment is printed in function CALCULATE_PAYMENT and this function does not return any value.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 6PP
icon
Related questions
Question
Syarikat Percetakan Global provides two types of thesis binding services, namely color
and black & white printing. The printing cost of one page is 50 cents and 20 cents for
colour and black & white respectively. While the binding price for a thesis is RM30.
Program A calculates and displays the total payment that a customer has to pay when
binding thesis using function. The CALCULATE_ PAYMENT function will calculate
the total payment and the results obtained from this function will be sent to main()
function for printing. Study Program A to answer questions a, b, c and d.
#include <iostream>
(a) II Function Prototype
int main() {
float payment;
int pages,num_thesis;
char printing_type;
// Input section
cout<<"Please enter number of thesis :";
cin>>num_thesis;
cout<<"Please enter type of Printing C-Color / B - Black and White : ";
cin>>printing_type;
cout<<"Please enter number of pages : ";
cin>>pages;
I/ Process section
payment= (b) // Function Calling
I/ Output section
cout<<"The total amount is RM"<<payment;
returm 0;
} // End Function Main
float CALCULATE_PAYMENT( char type,int num,int pg)
{
(c)
} Il end function
Program A
a.
Write the prototype function for Program A.
c.
Complete this section by writing appropriate program segment.
d.
Write the prototype function for this program if payment is printed in function
CALCULATE_PAYMENT and this function does not return any value.
Transcribed Image Text:Syarikat Percetakan Global provides two types of thesis binding services, namely color and black & white printing. The printing cost of one page is 50 cents and 20 cents for colour and black & white respectively. While the binding price for a thesis is RM30. Program A calculates and displays the total payment that a customer has to pay when binding thesis using function. The CALCULATE_ PAYMENT function will calculate the total payment and the results obtained from this function will be sent to main() function for printing. Study Program A to answer questions a, b, c and d. #include <iostream> (a) II Function Prototype int main() { float payment; int pages,num_thesis; char printing_type; // Input section cout<<"Please enter number of thesis :"; cin>>num_thesis; cout<<"Please enter type of Printing C-Color / B - Black and White : "; cin>>printing_type; cout<<"Please enter number of pages : "; cin>>pages; I/ Process section payment= (b) // Function Calling I/ Output section cout<<"The total amount is RM"<<payment; returm 0; } // End Function Main float CALCULATE_PAYMENT( char type,int num,int pg) { (c) } Il end function Program A a. Write the prototype function for Program A. c. Complete this section by writing appropriate program segment. d. Write the prototype function for this program if payment is printed in function CALCULATE_PAYMENT and this function does not return any value.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L