using void functions 1. Complete the program shown below. Note: do not omit the comments a) You will write a void function to get a positive integer between 1 and 12 inclusive. The twelve numbers represent the months of the year. The user will be asked to enter an integer between 1 and 12 inclusive. If the number entered by the user is not within range, an appropriate error message will be displayed, and the user will be asked to try again until a valid number is entered. b) You will write a void function to print the month number and the month name with an appropriate message. Consider a good layout when displaying the output. c) You will also complete the function main by making a call to the function GetMonthNumber with an appropriate argument and by making a call to the function DisplayMonth with an appropriate argument d) Add a loop to allow the program to repeat, allowing the user to continue. Consider proper indentation and alignment of the statements. e) Output your name as well before the program ends. f) Test the functions using different test data. Show several examples to show that the program performs validation check as well. Write the documentation and include the screenshots.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section: Chapter Questions
Problem 4PP
icon
Related questions
Question
100%

using void functions 1. Complete the program shown below. Note: do not omit the comments a) You will write a void function to get a positive integer between 1 and 12 inclusive. The twelve numbers represent the months of the year. The user will be asked to enter an integer between 1 and 12 inclusive. If the number entered by the user is not within range, an appropriate error message will be displayed, and the user will be asked to try again until a valid number is entered. b) You will write a void function to print the month number and the month name with an appropriate message. Consider a good layout when displaying the output. c) You will also complete the function main by making a call to the function GetMonthNumber with an appropriate argument and by making a call to the function DisplayMonth with an appropriate argument d) Add a loop to allow the program to repeat, allowing the user to continue. Consider proper indentation and alignment of the statements. e) Output your name as well before the program ends. f) Test the functions using different test data. Show several examples to show that the program performs validation check as well. Write the documentation and include the screenshots. 

 

//prompt user to enter number and read the number
cout <« "Enter a number between 1 and 12 inclusive: ":
cin >>
//while number entered is not between
//between 1 and 12
// inclusive
while
{
cout « number « " is not between 1 and 12 inclusive. \n";
cout « "Try again. Enter a number between 1 and 12: ";
// read the next number
}
//*******************
// Definition of function DisplayMonth.
// The parameter number holds an integer between 1 and 12 inclusive
// representing a month number.
// The function displays the month number and the corresponding month name.
**********
//***********
****************************
**************
void DisplayMonth (_
Transcribed Image Text://prompt user to enter number and read the number cout <« "Enter a number between 1 and 12 inclusive: ": cin >> //while number entered is not between //between 1 and 12 // inclusive while { cout « number « " is not between 1 and 12 inclusive. \n"; cout « "Try again. Enter a number between 1 and 12: "; // read the next number } //******************* // Definition of function DisplayMonth. // The parameter number holds an integer between 1 and 12 inclusive // representing a month number. // The function displays the month number and the corresponding month name. ********** //*********** **************************** ************** void DisplayMonth (_
// Purpose:
To get a month number betveen 1 and 12 inclusive and
print the month number and the corresponding month name.
II This part to be completed
//---
//tor using cin and cout
include <iostream>
using namespace std:
// Function Prototypes
void GetMonthMamber (ints):
void Displaytonth (int) :
int main()
int monthilum:
//a number representing a month
GetMonthlunber L
): 1/get a month number
//call function to output the month number
// and month name
systen (pause":
return 0:
// Definition of function GetMonthliumber.
// The parameter number is a reference parameter to an int.
I/ The funetion asks the user to enter an integer betveen 1 and 12 inclusive.
// It the number entered is not within range, an error message will be
// displayed, and the user will be asked to try again until a valid nunber is
// entered.
.......
void GetMonthlumber(
//nunber representing month nunber
//prompt uaer to enter number and read the number
cout « "Enter a number betveen 1 and 12 inclusive: ":
cin >>
I/hile nunber entered 1s not betveen
) //betveen 1 and 12
// inclusive
while
cout « nunber <«- is not between 1 and 12 inclusive. \n":
cout ce Try again. Enter a nunber betveen 1 and 12: ":
// read the next number
Transcribed Image Text:// Purpose: To get a month number betveen 1 and 12 inclusive and print the month number and the corresponding month name. II This part to be completed //--- //tor using cin and cout include <iostream> using namespace std: // Function Prototypes void GetMonthMamber (ints): void Displaytonth (int) : int main() int monthilum: //a number representing a month GetMonthlunber L ): 1/get a month number //call function to output the month number // and month name systen (pause": return 0: // Definition of function GetMonthliumber. // The parameter number is a reference parameter to an int. I/ The funetion asks the user to enter an integer betveen 1 and 12 inclusive. // It the number entered is not within range, an error message will be // displayed, and the user will be asked to try again until a valid nunber is // entered. ....... void GetMonthlumber( //nunber representing month nunber //prompt uaer to enter number and read the number cout « "Enter a number betveen 1 and 12 inclusive: ": cin >> I/hile nunber entered 1s not betveen ) //betveen 1 and 12 // inclusive while cout « nunber <«- is not between 1 and 12 inclusive. \n": cout ce Try again. Enter a nunber betveen 1 and 12: ": // read the next number
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning