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.

CS201 Introduction to Programming Assignment No 01 Solution & Discussion Due Date: 13-05-2019

CS201 Introduction to Programming Assignment No 01 Solution & Discussion Due Date: 13-05-2019

XYZ University wants to track students’ admissions. They need a program in C++ which will automate the process.

  • The program will display the following menu options to user:-

======================================================

Please select the program option, in which you want to enter enrollments.

Please enter option 1 for BCS program.

Please enter option 2 for BIT program.

Please enter option 3 for BBA program.

Please enter option 4 for BA program.

===============================================

  • First the user will select the program option, for any invalid option the program should not perform any calculation and display an error message like:-

           THE PROGRAM NAME IS INVALID, PLEASE TRY AGAIN.

Press any key to continue…

  • On pressing any key from the keyboard, the program should start again from the beginning.
  • Upon entering the valid program option, the program will ask the user to enter students’ enrollment for four years as:-
  • Please enter number of students in Year 1.
  • Please enter number of students in Year 2.
  • Please enter number of students in Year 3.
  • Please enter number of students in Year 4.

 

  • After entering the valid program option and students’ enrollment data for four years, the department name of the program needs to be displayed. (e.g. for BCS & BIT, the department name needs to be DEPARTMENT OF COMPUTER SCIENCE, for BBA, the department name should be DEPRTAMENT OF BUSINESS ADMINISTRATION while for BA, the department name should be DEPARTMENT OF FINE ARTS.)
  • Finally, the program will perform some calculations and will display the following information:-
  • The number of students in each year.
  • The percentage of student’s enrollment in each year against particular program.
  • The total number of students in the program.
  • Also if the number of students enrolled in a year is greater than 100, then display a message that THE NUMBER OF STUDENTS ENROLLED IN THAT YEAR IS OVER THE LIMIT.

      

Views: 2761

Attachments:

Replies to This Discussion

source file not compiled even after compiling the file show this msg,what is the solution 

#include <cstdlib>
using namespace std;

int main()
{
// All Variable Declared...
int program_option;
int year1;
int year2;
int year3;
int year4;
int studentsSum;

cout "Please Select The Program Options, In Which You Want To Enter Enrollments.\n";
cout "Please Enter Option 1 for BCS program.\n";
cout "Please Enter Option 2 for BIT program.\n";
cout "Please Enter Option 3 for BBA program.\n";
cout "Please Enter Option 4 for BA program.\n";
cout "===================\n";
do {
cout "Please Enter Program Option: ";
cin >> program_option;
if(program_option > 4){
cout "THE PROGRAM NAME IS INVALID, PLEASE TRY AGAIN.\n";
system("pause");
}
} while(program_option > 4);

cout "Please enter number of students in Year 1: ";
cin >> year1;

cout "Please enter number of students in Year 2: ";
cin >> year2;

cout "Please enter number of students in Year 3: ";
cin >> year3;

cout "Please enter number of students in Year 4: ";
cin >> year4;
cout "\n\n";
if(program_option == 1){
cout "==============DEPARTMENT OF COMPUTER SCIENCE==============\n";
} else if(program_option == 2){
cout "==============DEPARTMENT OF COMPUTER SCIENCE==============\n";
} else if(program_option == 3) {
cout "==============DEPRTAMENT OF BUSINESS ADMINISTRATION==============\n";
} else {
cout "==============DEPARTMENT OF FINE ARTS==============\n";
}
cout "\n";

cout "The number of students in year 1 is: ";
cout year1;
cout "\n";

cout "The number of students in year 2 is: ";
cout year2;
cout "\n";

cout "The number of students in year 3 is: ";
cout year3;
cout "\n";

cout "The number of students in year 4 is: ";
cout year4;
cout "\n\n";

studentsSum = year1 + year2 + year3 + year4;

cout "The percentage of students in year 1 is: ";
double percentage = (double)year1 / studentsSum * 100;
cout percentage; cout "%\n";

cout "The percentage of students in year 2 is: ";
percentage = (double)year2 / studentsSum * 100;
cout percentage; cout "%\n";

cout "The percentage of students in year 3 is: ";
percentage = (double)year3 / studentsSum * 100;
cout percentage; cout "%\n";

cout "The percentage of students in year 4 is: ";
percentage = (double)year4 / studentsSum * 100;
cout percentage; cout "%\n";

cout "The total number of students in the program is: ";
cout studentsSum;
cout "\n";

if(studentsSum > 100){
cout "The number of students enrolled in that year is over the limit.";
}
}

RSS

Looking For Something? Search Below

Latest Activity

+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
4 minutes ago
ASIM!! commented on ASIM!!'s photo
19 minutes ago
ASIM!! replied to ASIM!!'s discussion Faisla
33 minutes ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
56 minutes ago
ASIM!! replied to ASIM!!'s discussion Faisla
59 minutes ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
1 hour ago
ASIM!! replied to ASIM!!'s discussion Faisla
2 hours ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
2 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