Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

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:

  • 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.

 

 

 

 

 

Problem Statement

Write a menu in C++ which should show the country code and name at the start of application:

    1. Press 0 for Pakistan.
    2. Press 1 for China.
    3. Press 2 for Italy.        
    4. Press 3 for UK.
    5. Press 4 for Iran.
    6. Press 5 for France.
    7. Press 6 for Turkey.
    8. 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

showElements( );

Percentage of death

PercentageDeath ( ):

Percentage of recovered

PercentageRecovered();

 

Source data:

 

Country Code

Total Cases

Total Deaths

Total Recovered

0

560,433

22,115

32,634

1

156,363

19,899

34,211

2

84,279

10,612

0

3

82,160

3,341

77,663

4

71,686

4,474

43,894

5

56,956

1,198

3,446

6

5,374

93

1095

 

 

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.

 

 

Views: 1200

Attachments:

Replies to This Discussion

Attachments:

thanks for sharing

CS201 Assignment 2 |100% Correct| Solution Spring 2020

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 

CS201 Assignment NO.2 2020

#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:)

RSS

Looking For Something? Search Below

Latest Activity

Shaaz WahCantt replied to Mr Siren Head's discussion Ning Chats
15 hours ago
Mr Siren Head replied to Mr Siren Head's discussion Ning Chats
16 hours ago
M. Haris left a comment for Sana rajput
20 hours ago
M. Haris left a comment for Sana rajput
20 hours ago
M. Haris liked Sana rajput's profile
20 hours ago
M. Haris liked MUSFIRA's profile
20 hours ago
M. Haris liked MUSFIRA's profile
20 hours ago
MUSFIRA replied to Mr Siren Head's discussion Ning Chats
20 hours ago

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service