<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS201 Assignment 1 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Assignment No.  1<br />
Semester: Fall 2019<br />
CS201 – Introduction to Programming	Total Marks: 20</p>
<p dir="auto">Due Date:  November 14, 2019<br />
Instructions<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">o	Assignment is submitted after due date.<br />
o	Submitted assignment does not open or file is corrupt.<br />
o	Assignment is copied (From internet/students).</p>
<p dir="auto">Software allowed to develop Assignment</p>
<ul>
<li>Dev C++</li>
</ul>
<p dir="auto">Objectives:<br />
To enable students to understand and practice the concepts of:<br />
•	Variables and operators<br />
•	Loops or repetition structures<br />
•	If-else statements<br />
•	Functions<br />
•	Random number generation<br />
•	Control random number in specific range</p>
<p dir="auto">Assignment Submission Instructions<br />
You have to submit only.cpp file on the assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.<br />
Please note again, assignment submitted other than .cpp format will get zero marks.</p>
<p dir="auto">Assignment</p>
<p dir="auto">Programming is a nice tool which can be used to make our life easier. With the help of programming we can do many things auto generated and efficiency. As a programmer first task of this semester is given to you is develop a console-based application for school teachers. This application will auto generate questions for Grades 1, 2, 3, 4 and 5. Using this application teacher will be able to give different paper to each student.</p>
<p dir="auto">Assignment Statement:<br />
Write a menu-based program in C++ that will take input from user(teacher) and fulfill following requirements.</p>
<p dir="auto">•	There should be a menu that allow to select grade of class.<br />
•	Created questions should be mixed type (addition and subtraction).<br />
•	User will give number of questions that will be generated for a paper.<br />
•	Ratio of addition and subtraction questions is not fixed. It will random, a paper can have more questions of one type than other. See sample output screenshot.<br />
•	Number of minimum and maximum digits in paper of grade 1 will be two.<br />
•	Number of minimum and maximum digits in paper of grade 2 will be three.<br />
•	Number of minimum and maximum digits in paper of grade 3 will be four.<br />
•	Number of minimum and maximum digits in paper of grade 4 will be five.<br />
•	Number of minimum and maximum digits in paper of grade 5 will be six.<br />
•	Screen shot of required application is given below as simple output.<br />
•	Most critical requirement is, the operand (number) on left side of subtraction sign must be larger than the number on right side of sign (operator). This requirement is highlighted in sample screenshot too.<br />
•	In case of addition operation, the operand (number) on left side of addition sign can be larger or smaller from the number on right side of sign (operator).</p>
<p dir="auto">Solution instructions:<br />
•	Variables, loops, if-else, rand() function with % operator, functions (one which return a value and one which do not return a value) will help you to solve the problem.<br />
•	Use rand() function to generate a random number. You can control the range of number with the help of modulus (%) operator.<br />
•	To use rand() function you must include “stdlib.h” header file.<br />
•	To control the range of random number rand() % N can help, if value of N will be 100 then  range of randomly generated number will be 0 to 99.<br />
•	If you want to control the range of random number between 10 to 19 then following formula will help.<br />
o	[10 + rand() % (19 – 10 + 1)]</p>
<p dir="auto">Sample output:<br />
<img src="https://i.imgur.com/bzmMnV2.png" alt="7fc82ca0-0224-4978-9a93-24adafab2eab-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Lectures Covered: (Lecture # 1- 10) and Solution Deadline: (November 14, 2019).</p>
]]></description><link>https://community.secnto.com//topic/725/cs201-assignment-1-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 19:59:31 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/725.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Dec 2019 13:14:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Sun, 05 Dec 2021 14:01:41 GMT]]></title><description><![CDATA[<p dir="auto">modules:composer.user_said_in, <a class="plugin-mentions-user plugin-mentions-a" href="/user/cyberian" aria-label="Profile: cyberian">@<bdi>cyberian</bdi></a>, <a href="/post/6900">CS201 Assignment 1 Solution and Discussion</a></p>
<blockquote>
<p dir="auto">Write a C++ program that performs  the following tasks:<br />
1-Print your name and VU id.<br />
2-Add last 3 digit of your VU id.<br />
3-Display the result of sum on screen.<br />
4-Use if-else statement ::<br />
a)	If sum is odd then print your name using while loop. Number of iterations of while loop should be equal to the sum.<br />
b)	If sum is even then print your VU id using while loop. Number of iterations of while loop should be equal to the sum.<br />
[use remainder operator on sum value to determine the odd and even value for if condition]<br />
For example, suppose the student id is BC123456781. Then by adding last 3 digits of vu id, we get 16 which is an even number. In this case, program should print your VU ID for 16 times using while loop.</p>
</blockquote>
<pre><code>// C201 Assignment No: 1 Fall2021 
#include &lt;iostream&gt; 
#include &lt;string&gt; 
using namespace std; 
void printnameid(string studentid, string studentname); 
int calculatelastthreedigits(string studentid); 

int main() 
{
string studentid="bc123456789"; 
string studentname="ZAHID"; 
printnameid(studentid,studentname); 
int TotalLastThreeDigits=calculatelastthreedigits(studentid); 
int counter=1; 
int a,b,c; 
a=6; 
b=4; 
c=0; 
cout&lt;&lt;"Sum of Last Three Numbers ="&lt;&lt;a+b+c; 
cout&lt;&lt;"\n\n"; 
if ( TotalLastThreeDigits % 2 == 0) // Divide by 2 and see if the reminder is zero? then it is even otherwise it is odd number 
{ 
cout &lt;&lt; "the sum is an even value: \n\n"; cout&lt;&lt;"++++++++++++++++++++++++++++++++++++++++++++ \n\n"; while(counter &lt;= TotalLastThreeDigits) 
{ 
cout &lt;&lt; " Iteration: " &lt;&lt; counter &lt;&lt; "\n"; 
cout &lt;&lt; "My student id is:" &lt;&lt; studentid &lt;&lt; "\n"; 
counter++; 
} 
} 
else 
{ 
cout &lt;&lt; "the sum is an odd value: \n\n"; 
while(counter &lt;= TotalLastThreeDigits) 
{ 
cout &lt;&lt; " Iteration: " &lt;&lt; counter &lt;&lt; "\n"; 
cout &lt;&lt; "My name is " &lt;&lt; studentname &lt;&lt; "\n"; 
counter++; 
} 
} 
return 0; 
} 
void printnameid(string studentid, string studentname){ 
cout&lt;&lt;"My name is " &lt;&lt; studentname &lt;&lt; "\n\n\n"; 
cout&lt;&lt;"My student id is:" &lt;&lt; studentid &lt;&lt; "\n\n\n"; 
} 
int calculatelastthreedigits(string studentid) { 
int end=studentid.length(); // Ending point that is total length of string 
int start=end-3; // Starting point 
string lastthreedigits=studentid.substr(start,end); // Trim the last three digits; 
int total=0; 
//Calculate the sum of last three digits 
for ( int index=0; index &lt; lastthreedigits.length(); index++) { 
total += lastthreedigits[index] - '0'; 
} 
return total; // return the total to calling statement. 
} 
</code></pre>
]]></description><link>https://community.secnto.com//post/6902</link><guid isPermaLink="true">https://community.secnto.com//post/6902</guid><dc:creator><![CDATA[cyberian]]></dc:creator><pubDate>Sun, 05 Dec 2021 14:01:41 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Sun, 05 Dec 2021 13:48:43 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://youtu.be/SlF9LZazXO8" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/SlF9LZazXO8</a></p>
]]></description><link>https://community.secnto.com//post/6901</link><guid isPermaLink="true">https://community.secnto.com//post/6901</guid><dc:creator><![CDATA[Liza Liza]]></dc:creator><pubDate>Sun, 05 Dec 2021 13:48:43 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Sat, 04 Dec 2021 15:23:37 GMT]]></title><description><![CDATA[<pre><code>Assignment No.  1
</code></pre>
<p dir="auto">Semester: Fall 2021<br />
CS201 – Introduction to Programming	Total Marks: 20</p>
<p dir="auto">Due Date: 9-12-2021<br />
Instructions<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">o	Assignment is submitted after due date.<br />
o	Submitted assignment does not open or file is corrupt.<br />
o	Assignment is copied (From internet/students).</p>
<p dir="auto">Recommended tool to develop Assignment</p>
<ul>
<li>Dev C++</li>
</ul>
<p dir="auto">Objectives:<br />
To enable students to understand and practice the concepts of:<br />
•	Data Types and Variables<br />
•	Arithmetic and Logical Operators<br />
•	Expression solving<br />
•	If-else statements<br />
•	repetition structure</p>
<p dir="auto">Assignment Submission Instructions<br />
You have to submit only.cpp file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format will be scaled with zero mark. So, check your solution file format before submission.</p>
<p dir="auto">For any query related to assignment, please contact <a href="mailto:cs201@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs201@vu.edu.pk</a>.</p>
<pre><code>                                        Lectures: 1 to 6
</code></pre>
<p dir="auto">Assignment</p>
<p dir="auto">Write a C++ program that performs  the following tasks:<br />
1-Print your name and VU id.<br />
2-Add last 3 digit of your VU id.<br />
3-Display the result of sum on screen.<br />
4-Use if-else statement ::<br />
a)	If sum is odd then print your name using while loop. Number of iterations of while loop should be equal to the sum.<br />
b)	If sum is even then print your VU id using while loop. Number of iterations of while loop should be equal to the sum.<br />
[use remainder operator on sum value to determine the odd and even value for if condition]</p>
<p dir="auto">For example, suppose the student id is BC123456781. Then by adding last 3 digits of vu id, we get 16 which is an even number. In this case, program should print your VU ID for 16 times using while loop.</p>
<p dir="auto">Sample screen shot::<br />
<img src="https://i.imgur.com/dRAnYZw.png" alt="58ccaf69-dc5a-41d0-a65e-dc8d1439127a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Sample screen shot::<br />
<img src="https://i.imgur.com/fa1at91.png" alt="a23329f7-ae4f-4c8c-89ae-c4fe014fcc3b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">NOTE: Student’s name and id are supposed values (not real) in above example. You will print your own VU Id and Name otherwise you will get zero marks.</p>
]]></description><link>https://community.secnto.com//post/6900</link><guid isPermaLink="true">https://community.secnto.com//post/6900</guid><dc:creator><![CDATA[cyberian]]></dc:creator><pubDate>Sat, 04 Dec 2021 15:23:37 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Fri, 07 May 2021 12:44:17 GMT]]></title><description><![CDATA[<pre><code>Assignment No.  1
</code></pre>
<p dir="auto">Semester: Spring 2021<br />
CS201 – Introduction to Programming	Total Marks: 20</p>
<p dir="auto">Due Date:20th May 2021<br />
Instructions<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">o	Assignment is submitted after due date.<br />
o	Submitted assignment does not open or file is corrupt.<br />
o	Assignment is copied (From internet/students).</p>
<p dir="auto">Recommended tool to develop Assignment</p>
<ul>
<li>Dev C++</li>
</ul>
<p dir="auto">Objectives:<br />
To enable students to understand and practice the concepts of:<br />
•	Data Types and Variables<br />
•	Arithmetic and Logical Operators<br />
•	Expression solving<br />
•	If-else statements<br />
•	repetition structure</p>
<p dir="auto">Assignment Submission Instructions<br />
You have to submit only.cpp file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format will be scaled with zero mark. So, check your solution file format before submission.</p>
<p dir="auto">For any query related to assignment, please contact <a href="mailto:cs201@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs201@vu.edu.pk</a>.</p>
<pre><code>                                        Lectures: 1 to 6
</code></pre>
<p dir="auto">Assignment</p>
<p dir="auto">An expression is given here. You are required to write a C++ program that solves the given mathematical expression.</p>
<p dir="auto">Z = x2 + 2xy – x/y<br />
set the values of x = 2 and y = 1</p>
<p dir="auto">Three main tasks are to be done by each student:-</p>
<ol>
<li>Expression solving</li>
<li>Decisions making (if-else structure)</li>
<li>Repetition structure (while loop).</li>
</ol>
<p dir="auto">After evaluation of above expression, you should add the value of z to last digit of your vu id. As a result,</p>
<ol>
<li>If you get an odd number, then you should print your VU id using while loop. This while loop should run as many times as odd number you got from (z+ last digit of your vu id).<br />
For example, suppose the value of z is 2 and the student’s id is BC123456781. Then by  adding last digit of vu id 1 to value of z, result will be 3 which is an odd number. In this case, program should print your VU ID for 3 times using while loop.</li>
</ol>
<p dir="auto">Sample screen shot::</p>
<ol>
<li>If you get an even number, then you should print your Name using while loop. This while loop should run as many times as even number you got from (z+ last digit of your vu id).<br />
For example, suppose the value of z is 2 and the student’s id is BC123456782. Then by  adding last digit of vu id 2 to the value of z, result will be 4 which is an even number. In this case, program should print your Name for 4 times using while loop.</li>
</ol>
<p dir="auto">Sample screen shot::</p>
<p dir="auto">NOTE: Values of “z” and “student’s id” are arbitrary (not real).</p>
]]></description><link>https://community.secnto.com//post/6618</link><guid isPermaLink="true">https://community.secnto.com//post/6618</guid><dc:creator><![CDATA[cyberian]]></dc:creator><pubDate>Fri, 07 May 2021 12:44:17 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Mon, 22 Feb 2021 07:10:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/danish-hafeez" aria-label="Profile: danish-hafeez">@<bdi>danish-hafeez</bdi></a> said in <a href="/post/6501">CS201 Assignment 1 Solution and Discssion</a>:</p>
<blockquote>
<p dir="auto">Assignment No.  1<br />
Semester: Fall 2020<br />
CS201 – Introduction to Programming	Total Marks: 20</p>
<p dir="auto">Due Date:  26-November-2020<br />
Instructions<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">o	Assignment is submitted after due date.<br />
o	Submitted assignment does not open or file is corrupt.<br />
o	Assignment is copied (From internet/students).</p>
<p dir="auto">Recommended tool to develop Assignment</p>
<ul>
<li>Dev C++</li>
</ul>
<p dir="auto">Objectives:<br />
To enable students to understand and practice the concepts of:<br />
•	Data Types and Variables<br />
•	Arithmetic and Logical Operators<br />
•	If-else statements</p>
<p dir="auto">Assignment Submission Instructions<br />
You have to submit only.cpp file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format will not be accepted and will be scaled with zero marks.</p>
<p dir="auto">For any query related to assignment, please contact <a href="mailto:cs201@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs201@vu.edu.pk</a>.</p>
<p dir="auto">Assignment</p>
<p dir="auto">Information about an ABC organization is given below.</p>
<ol>
<li>There are 10 employees in the organization.</li>
<li>There are 2 employees of level-A, 3 employees of level-B, 5 employees of level-C.</li>
<li>The information about their salaries is given below.<br />
a)	The salary of level-A employee is Rs.1, 25,000.<br />
b)	The salary of level-B employee is Rs.80, 000.<br />
c)	The salary of level-C employee is Rs.45, 000.</li>
<li>Rs.600 is deducted from the salaries of all employees against staff welfare fund.</li>
<li>If ANNUAL salary of an employee is more than Rs.600, 000, 1% tax is deducted from salary each month.<br />
You are required to write a C++ program which finds</li>
</ol>
<ol>
<li>Total monthly tax deduction for all employees.</li>
<li>Total amount of welfare fund collected each month from all employees.</li>
<li>Net monthly salary of an employee. (Level-A, level-B, level-C).<br />
(Hint: Net_Monthly_Salary= Original_Salary- Monthly_Tax – Monthly_Welfare_Fund)</li>
<li>Total amount which organization pays to its employees each month.</li>
<li>Also create a menu using (if-else) conditional statements, if a user wants to know about the separate tax collection of Level-A, Level-B, And Level-C employees.<br />
If user enters 1, leve-A employee tax will be shown.<br />
If user enters 2, leve-B employee tax will be shown.<br />
If user enters 1, leve-C employee tax will be shown.<br />
If user inputs wrong number then a message will be shown: “incorrect input”.</li>
</ol>
<p dir="auto">Sample Screenshot of Output:</p>
<p dir="auto"><img src="https://i.imgur.com/zwyAenm.png" alt="0c0009a2-e98d-4ac8-bc24-9e61013c58bd-image.png" class=" img-fluid img-markdown" /></p>
</blockquote>
<p dir="auto"><strong>Solution</strong></p>
<pre><code>#include&lt;iostream&gt;
//#include&lt;conio.h&gt;
using namespace std;

int main()
{    
	float totaltax = 0, totalfund = 0, fund = 600, salaryA = 125000, salaryB = 80000, salaryC = 45000, Annaul_SalaryA=0,
	 Annaul_SalaryB=0, Annaul_SalaryC=0,salaryofall = 0, taxA = 0, taxB = 0, taxC = 0, netsalaryA = 0, netsalaryB = 0, netsalaryC = 0;
	 int num=0;
		

	//Monthly welfare fund
	totalfund = 10*fund;
	
	//Annual salaries
	Annaul_SalaryA = salaryA*12;
	Annaul_SalaryB = salaryB*12;
	Annaul_SalaryC = salaryC*12;
	
	// Checking tax eligibility and Monthly Tax Calculation
	if(Annaul_SalaryA &gt; 600000)
	{
		taxA = salaryA*.01;
	}
	
	if(Annaul_SalaryB &gt; 600000)
	{
		taxB = salaryB * .01;
	}

	if(Annaul_SalaryC &gt; 600000)
	{
		taxC = salaryC * .01;
	}
	else
	{
		taxC = 0;
	}
	totaltax = taxA*2 + taxB*3 + taxC*5;
	
	//Net salaries after deduction
	
	netsalaryA = salaryA - taxA - fund;
	netsalaryB = salaryB - taxB - fund;
	netsalaryC = salaryC - taxC - fund;
	
	//Total amount paid by university
	
	salaryofall = salaryA*2 + salaryB*3 + salaryC*5;
	
	
	cout&lt;&lt;"Total Monthly Tax deduction of all employees :\t"&lt;&lt;totaltax&lt;&lt;endl; 
	cout&lt;&lt;" Total amount of Welfare Fund collected : \t"&lt;&lt;totalfund&lt;&lt;endl;
	cout&lt;&lt;" Net monthly salary of A Level employee : \t"&lt;&lt;netsalaryA&lt;&lt;endl;
	cout&lt;&lt;" Net monthly salary of B Level employee : \t"&lt;&lt;netsalaryB&lt;&lt;endl;
	cout&lt;&lt;" Net monthly salary of C Level employee : \t"&lt;&lt;netsalaryC&lt;&lt;endl;
	cout&lt;&lt;" Total amount paid by university after a month :\t"&lt;&lt;salaryofall&lt;&lt;endl;
	cout&lt;&lt;endl;
	//Separate details of tax collection
	cout&lt;&lt;"Enter 1 to know the tax collection of Level A employees "&lt;&lt;endl;
	cout&lt;&lt;"Enter 2 to know the tax collection of Level B employees "&lt;&lt;endl;
	cout&lt;&lt;"Enter 3 to know the tax collection of Level C employees "&lt;&lt;endl;
	cin&gt;&gt;num;
	if(num==1)
	{
		cout&lt;&lt;"tax collection of Level A employees is Rs."&lt;&lt;taxA*2&lt;&lt;endl;
	}
	else if (num==2)
	{
		cout&lt;&lt;"tax collection of Level B employees is Rs."&lt;&lt;taxB*3&lt;&lt;endl;
	}
	else if (num==3)
	{
		cout&lt;&lt;"tax collection of Level C employees is Rs."&lt;&lt;taxC*5&lt;&lt;endl;
	}
	else
	{
		cout&lt;&lt;"Incorrect input";
	}
	
}

</code></pre>
]]></description><link>https://community.secnto.com//post/6502</link><guid isPermaLink="true">https://community.secnto.com//post/6502</guid><dc:creator><![CDATA[zaasmi]]></dc:creator><pubDate>Mon, 22 Feb 2021 07:10:28 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Mon, 22 Feb 2021 07:09:39 GMT]]></title><description><![CDATA[<pre><code>Assignment No.  1
</code></pre>
<p dir="auto">Semester: Fall 2020<br />
CS201 – Introduction to Programming	Total Marks: 20</p>
<p dir="auto">Due Date:  26-November-2020<br />
Instructions<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">o	Assignment is submitted after due date.<br />
o	Submitted assignment does not open or file is corrupt.<br />
o	Assignment is copied (From internet/students).</p>
<p dir="auto">Recommended tool to develop Assignment</p>
<ul>
<li>Dev C++</li>
</ul>
<p dir="auto">Objectives:<br />
To enable students to understand and practice the concepts of:<br />
•	Data Types and Variables<br />
•	Arithmetic and Logical Operators<br />
•	If-else statements</p>
<p dir="auto">Assignment Submission Instructions<br />
You have to submit only.cpp file on the assignments interface of CS201 from your LMS account. Assignment submitted in any other format will not be accepted and will be scaled with zero marks.</p>
<p dir="auto">For any query related to assignment, please contact <a href="mailto:cs201@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs201@vu.edu.pk</a>.</p>
<p dir="auto">Assignment</p>
<p dir="auto">Information about an ABC organization is given below.</p>
<ol>
<li>There are 10 employees in the organization.</li>
<li>There are 2 employees of level-A, 3 employees of level-B, 5 employees of level-C.</li>
<li>The information about their salaries is given below.<br />
a)	The salary of level-A employee is Rs.1, 25,000.<br />
b)	The salary of level-B employee is Rs.80, 000.<br />
c)	The salary of level-C employee is Rs.45, 000.</li>
<li>Rs.600 is deducted from the salaries of all employees against staff welfare fund.</li>
<li>If ANNUAL salary of an employee is more than Rs.600, 000, 1% tax is deducted from salary each month.<br />
You are required to write a C++ program which finds</li>
</ol>
<ol>
<li>Total monthly tax deduction for all employees.</li>
<li>Total amount of welfare fund collected each month from all employees.</li>
<li>Net monthly salary of an employee. (Level-A, level-B, level-C).<br />
(Hint: Net_Monthly_Salary= Original_Salary- Monthly_Tax – Monthly_Welfare_Fund)</li>
<li>Total amount which organization pays to its employees each month.</li>
<li>Also create a menu using (if-else) conditional statements, if a user wants to know about the separate tax collection of Level-A, Level-B, And Level-C employees.<br />
If user enters 1, leve-A employee tax will be shown.<br />
If user enters 2, leve-B employee tax will be shown.<br />
If user enters 1, leve-C employee tax will be shown.<br />
If user inputs wrong number then a message will be shown: “incorrect input”.</li>
</ol>
<p dir="auto">Sample Screenshot of Output:</p>
<p dir="auto"><img src="https://i.imgur.com/zwyAenm.png" alt="0c0009a2-e98d-4ac8-bc24-9e61013c58bd-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.secnto.com//post/6501</link><guid isPermaLink="true">https://community.secnto.com//post/6501</guid><dc:creator><![CDATA[danish hafeez]]></dc:creator><pubDate>Mon, 22 Feb 2021 07:09:39 GMT</pubDate></item><item><title><![CDATA[Reply to CS201 Assignment 1 Solution and Discussion on Wed, 15 Jan 2020 08:49:42 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Solution Code</strong></p>
<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;stdlib.h&gt;
using namespace std;

int selectGrade(){
	int grade = 0;
	
	cout&lt;&lt;"1 : First Grade\n";
	cout&lt;&lt;"2 : Second Grade\n";
	cout&lt;&lt;"3 : Third Grade\n";
	cout&lt;&lt;"4 : Fourth Grade\n";
	cout&lt;&lt;"5 : Fifth Grade\n";	
	
	cout&lt;&lt;"\nPlease select grade, use numbers 1 to 5: ";
	
	do {
		cin&gt;&gt;grade;
		if(grade &gt;= 1 &amp;&amp; grade &lt;= 5){
			break;
		}
		else {
			cout&lt;&lt;"\nGrade must be between 1 and 5\n";
			cout&lt;&lt;"Invalid choice, please select correct grade: ";
		}
	} while(true);
	return grade;	
}

void createQuestions(int l, int u, int q){
	
	int firstNum = 0, secondNum = 0;
	
	for(int i = 1; i &lt;= q; i++){
		
		firstNum = l + (rand() % (u - l + 1));
		secondNum = l + (rand() % (u - l + 1));
			 
		cout&lt;&lt;setw(2)&lt;&lt;i&lt;&lt;".";
		
		if(rand() % 2 == 0){
			cout&lt;&lt;"  ("&lt;&lt;firstNum&lt;&lt;" + "&lt;&lt;secondNum&lt;&lt;") = ______\t\t";;
		}
		else{
			if(firstNum &gt; secondNum) {
				cout&lt;&lt;"  ("&lt;&lt;firstNum&lt;&lt;" - "&lt;&lt;secondNum&lt;&lt;") = ______\t\t";
			}
			else{
				cout&lt;&lt;"  ("&lt;&lt;secondNum&lt;&lt;" - "&lt;&lt;firstNum&lt;&lt;") = ______\t\t";
			}			
		}
		
		if(i % 3 == 0){
			cout&lt;&lt;"\n";
		}
	}	
}

void generatePaper(int grade, int questions) {
	
	int lowerLimit, Upperlimit;
	
	if(grade == 1){
		lowerLimit = 10; 
		Upperlimit = 99;
		createQuestions(lowerLimit, Upperlimit, questions);
	}
	else if(grade == 2){
		lowerLimit = 100; 
		Upperlimit = 999;
		createQuestions(lowerLimit, Upperlimit, questions);
	}
	else if(grade == 3){
		lowerLimit = 1000; 
		Upperlimit = 9999;
		createQuestions(lowerLimit, Upperlimit, questions);
	}
	else if(grade == 4){
		lowerLimit = 10000; 
		Upperlimit = 99999;
		createQuestions(lowerLimit, Upperlimit, questions);
	}
	else if(grade == 5){
		lowerLimit = 100000; 
		Upperlimit = 999909;
		createQuestions(lowerLimit, Upperlimit, questions);
	}
}

main(){
	
	int grade = 0, numQuestions = 0;
	grade = selectGrade();
	
	cout&lt;&lt;"Enter number of questions you want to generate: ";
	cin&gt;&gt;numQuestions;
	
	cout&lt;&lt;endl;
	generatePaper(grade, numQuestions);	
	cout&lt;&lt;endl;
	system("pause");
}


</code></pre>
]]></description><link>https://community.secnto.com//post/2130</link><guid isPermaLink="true">https://community.secnto.com//post/2130</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Wed, 15 Jan 2020 08:49:42 GMT</pubDate></item></channel></rss>