The Virtual Weight (vW) of an integer number (which consists of more than 1 digit) is the sum of the individual digits that are composing the number. For example, consider the following two numbers; 5638 and 1145, then the VW of each is calculated as following: vw(5638) = 5+6+3+8 = 22 vw(1145) = 1+1+4+5 = 11 Then, the VW can be classified as L (mean Low) or H (means High) using a specific cut-off value. For example, if the cut-off value is 15, then the VW of the number 5638 is H (High), and the VW of the number 1145 is L because 22 > 15 and 11 < 15 respectively Write a C++ program that: reads a positive integer n (where 5
The Virtual Weight (vW) of an integer number (which consists of more than 1 digit) is the sum of the individual digits that are composing the number. For example, consider the following two numbers; 5638 and 1145, then the VW of each is calculated as following: vw(5638) = 5+6+3+8 = 22 vw(1145) = 1+1+4+5 = 11 Then, the VW can be classified as L (mean Low) or H (means High) using a specific cut-off value. For example, if the cut-off value is 15, then the VW of the number 5638 is H (High), and the VW of the number 1145 is L because 22 > 15 and 11 < 15 respectively Write a C++ program that: reads a positive integer n (where 5
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...
Related questions
Question
please help me as fast as possible
![](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8c6ffa47-d1bf-4e44-be36-e2498707980a%2Fe325f19d-530b-4a8f-aaec-bce53f8b605c%2Fqqu2cpj.png&w=3840&q=75)
![The Virtual Weight (vW) of an integer number (which consists of more than 1 digit) is the sum
of the individual digits that are composing the number. For example, consider the following
two numbers; 5638 and 1145, then the VW of each is calculated as following:
vw(5638) = 5+6+3+8 = 22
vw(1145) = 1+1+4+5 = 11
Then, the VW can be classified as L (mean Low) or H (means High) using a specific cut-off
value. For example, if the cut-off value is 15, then the VW of the number 5638 is H (High),
and the VW of the number 1145 is L because 22 > 15 and 11 < 15 respectively
Write a C++ program that:
reads a positive integer n (where 5<ns20) from the user. If the user enters invalid
number, then the program should continue prompting until he/she enters a valid number
within the specified range.
• Then, the program should generate n random numbers using the built-in rand()
function.
• Every time a random number is generated, the program will classify that number as L
or H using the above method. Use a user-defined function to handle this process (see
below, the description of FunctionI)
• Also the program will count how many Low and High VW's for the generated numbers
using another function named countVW(..) – see the description of the Function2.
• Finally, the program will compute the sum of the numbers which have Low VWs only
and display the result as illustrated in the sample output.
The program must use at least two functions as following:
1. A function to process the given number in the parameters list, and specify whether its
v is 'L' or 'H' based on the given cut_off value in the parameter list. The function
returns one character either 'L' or 'H'. The prototype is given blow:
Prototype: char classify(int num, int cut_off);
//--use cut_off - 15
2. A function to count the classifications of the generated numbers. Every time is called,
the function increases (by 1) one of the counters that are defined in the main program
to count the L or H cases.
Prototype: void countW (int &counter);
//--notice the call by reference](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8c6ffa47-d1bf-4e44-be36-e2498707980a%2Fe325f19d-530b-4a8f-aaec-bce53f8b605c%2Fsi3dumh.png&w=3840&q=75)
Transcribed Image Text:The Virtual Weight (vW) of an integer number (which consists of more than 1 digit) is the sum
of the individual digits that are composing the number. For example, consider the following
two numbers; 5638 and 1145, then the VW of each is calculated as following:
vw(5638) = 5+6+3+8 = 22
vw(1145) = 1+1+4+5 = 11
Then, the VW can be classified as L (mean Low) or H (means High) using a specific cut-off
value. For example, if the cut-off value is 15, then the VW of the number 5638 is H (High),
and the VW of the number 1145 is L because 22 > 15 and 11 < 15 respectively
Write a C++ program that:
reads a positive integer n (where 5<ns20) from the user. If the user enters invalid
number, then the program should continue prompting until he/she enters a valid number
within the specified range.
• Then, the program should generate n random numbers using the built-in rand()
function.
• Every time a random number is generated, the program will classify that number as L
or H using the above method. Use a user-defined function to handle this process (see
below, the description of FunctionI)
• Also the program will count how many Low and High VW's for the generated numbers
using another function named countVW(..) – see the description of the Function2.
• Finally, the program will compute the sum of the numbers which have Low VWs only
and display the result as illustrated in the sample output.
The program must use at least two functions as following:
1. A function to process the given number in the parameters list, and specify whether its
v is 'L' or 'H' based on the given cut_off value in the parameter list. The function
returns one character either 'L' or 'H'. The prototype is given blow:
Prototype: char classify(int num, int cut_off);
//--use cut_off - 15
2. A function to count the classifications of the generated numbers. Every time is called,
the function increases (by 1) one of the counters that are defined in the main program
to count the L or H cases.
Prototype: void countW (int &counter);
//--notice the call by reference
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY