Assignment No. 2 Semester: Spring 2020 CS201 – Introduction to Programming |
Total Marks: 20
Due Date: 16-6-2020 |
||
Instructions 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
- Dev C++
Objectives: In this assignment, the students will learn:
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.
|
|||
|
|
||
Problem Statement Write a menu in C++ which should show the country code and name at the start of application:
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.
Source data:
Sample Output: 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:
Good Luck
|
||||||||||||||||||||||||||||||||||||||
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.
|
Tags:
thanks for sharing
CS201 Introduction to Programming Assignment 2 Solution & Discussion Spring 2020
CS201 Assignment 2 Solution Idea:
#include<iostream>
using namespace std;
void showElements(long s[][4]);
void PercentageDeath(long s[][4], int i);
void PercentageRecovered(long s[][4], int i);
main()
{
long source_data[7][4]= {0,560433, 22115, 32634, 1,156363, 19899, 34211, 2,84279, 10612, 0, 3,82160, 3341, 77663, 4,71686, 4474, 43894, 5,56956, 1198, 3446, 6,5374, 93, 109};
showElements(source_data);
int user_choice;
do
{
cout"\nPress the country code to calculate percentage of dead and recovered persons\n";
cout"\n*** Press 0 for Pakistan ***";
cout"\n*** Press 1 for China ***";
cout"\n*** Press 2 for Italy ***";
cout"\n*** Press 3 for UK ***";
cout"\n*** Press 4 for Iran ***";
cout"\n*** Press5 for France ***";
cout"\n*** Press 6 for Turkey ***";
cout"\n*** Press 7 to Exit ***";
cout"\n\nPlease select an option use number from 0 to 7 : ";
input:
cin>>user_choice;
if(user_choice>=0 && user_choice<=6)
{
PercentageDeath(source_data, user_choice);
PercentageRecovered(source_data, user_choice);
}
else if(user_choice<0 || user_choice>7)
{
cout"\n\nChoice should be between 0 to 7 ";
cout"\ninvalid choice ! please select again : ";
goto input;
}
}while(user_choice!=7);
}
void showElements(long s[][4])
{
cout"Source Data : \n\n";
cout"Country\tCases\tDeaths\tRecovered\n\n";
for(int i=0; i<7; i++)
{
for(int j=0; j<4; j++)
{
couts[i][j]"\t";
}
cout"\n";
}
}
void PercentageDeath(long s[][4], int i)
{
float d_rate=(float)100*s[i][2]/s[i][1];
cout"\nPercentage of death is "d_rate;
}
void PercentageRecovered(long s[][4], int i)
{
float r_rate=(float)100*s[i][3]/s[i][1];
cout"\n\nPercentage of recocered is "r_rate"\n";
}
CS201 Solution file below link
#cs201assignment2solution #cs201assignmentsolution2020
CS201 Assignment 2 Solution Spring 2020 | CS201 Solution 2 Assignment
Solution Code
http://www.mediafire.com/file/j91kzlen0m2vxdy/CS201_Assignment_No_2...
#vu #assignment #cs201
CS201 Assignment 2 Solution 2020, Solution
In this video, I made CS201 Assignment 2 Solution 2020 watch the full video to learn and Subscribe to this channel for more Assignment Solutions and Programming Learning Purpose...
#vu assignment
#assignment solution
#vu
#assignment
#cs201
#cs201 operating systems
#cs201 assignment
#cs201 assignment 2020
#programming,programming assignment
#vu solution
#virtual university,
#vu short notes,
#cs201 short notes,
#cs201 solution,
#cs201 assignment 2,
#cs201 assignment solution,
#cs201 assignment no. 2,
#cs201 assignment solution 2,
#cs201 2020,
#cs201 assignment no. 2 spring 2020,
#cs201 solved pdf,
#cs201 pdf,
#cs201 solved file,
thanks for sharing TM sir:)
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post