Re: CS201 Assignment 2 Solution and Discussion
Assignment No. 2
Semester: Spring 2020
CS201 – Introduction to Programming Total Marks: 20
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/students).
Software allowed to develop Assignment
In this assignment, the students will learn:
• How to fill / populate a two-dimensional array using given source data.
• How to write user defined functions and pass an array to them as parameter.
• How to use if statement and do while loop.
• How to calculate the percentage in elements of array.
• How to display array elements.
Assignment Submission Instructions
You are required to submit only .cpp file on the assignments interface of CS201 at VU-LMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.
Write a menu in C++ which should show the country code and name at the start of application:
- Press 0 for Pakistan.
- Press 1 for China.
- Press 2 for Italy.
- Press 3 for UK.
- Press 4 for Iran.
- Press 5 for France.
- Press 6 for Turkey.
- Press 7 to exit.
Instructions to write C++ program:
Write functions to calculate % of recovered patients, % of deaths in specific country . Following function names should be used for consistency.
|To display all elements in matrix form
|Percentage of death
||PercentageDeath ( ):
|Percentage of recovered
First, user will call the showElements() method to display all the data in matrix form:
Then, it will display a menu to calculate the percentage of dead and recovered persons for specific country:
If user presses 0 then it will show the percentage of dead and recovered persons for Pakistan:
If user presses 1 then it will show the percentage of dead and recovered persons for China:
If the user enters option other then 0 to 7. Following messages display:
Choice should be between 0 and 7
Invalid choice, please select again:
Lectures Covered: This assignment covers Lecture # 11-15.
Deadline: The deadline to submit your assignment solution is 16-6-2020. Your assignment must be submitted within the due date through VU-LMS. No assignment will be accepted through email after the due date.