Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Who's Online 0

Don't Hesitate for ask Question, post your assignment with hope you will find best solution.

CS201 Assignment No 01 Solution & Discussion

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…


Comments

  • ansaraliansarali Posts: 25,240
    30 Mcqs From Past Papers (Moaaz File)
    And The remaining mcqs from 41 to 45 lecs
    Subjective main aik question Coutab; isko explain karna tha k compiler isay kaisy interprete kary ga.
    Contructor destructor k about question thay 2.
    Baki sab program thay érror finding error correction k related aur 2 programs ki output btana thi just.
  • ansaraliansarali Posts: 25,240
    #include <iostream> 
    #include <stdlib.h> 
    #include <conio.h> 
    using namespace std; 
    
    int main()
    
    {
    int total = 0, ch, nOfstudents1, nOfstudents2, nOfstudents3, nOfstudents4;//store the use choice 
    int percent; 
    while (true) {
    cout << "=================================================\n";
    cout << "Please select the program option, in which you want to enter enrollemnts\n\n";
    cout << "Please enter option 1 for BCS\n";
    cout << "Please enter option 2 for BIT\n";
    cout << "Please enter option 3 for BBA\n";
    cout << "Please enter option 4 for BA\n";
    cout << "Please Enter program option:\t";
    cin >> ch; 
    cout << "\n=======================================================================\n";
    if (ch >= 1 && ch <= 4) {
    break; 
    }
    else {
    cout << "THE PROGRAM OPTION IS INVALID PLEASE TRY AGAIN."; 
    cout << "Press any key to continue..."; 
    _getch();
    system("cls");
    }
    
    }//while loops ends
    switch (ch) {
    case 1: 
    cout << "\nPlease Enter number of students in Year 1 :\t";
    cin >> nOfstudents1; 
    cout << "\nPlease Enter number of students in Year 2 :\t";
    cin >> nOfstudents2; 
    cout << "\nPlease Enter number of students in Year 3 :\t";
    cin >> nOfstudents3; 
    cout << "\nPlease Enter number of students in Year 4 :\t";
    cin >> nOfstudents4; 
    cout << "======================DEPARTMENT OF COMPUTER SCIENCE ================================\n";
    cout << "The number of Students in Year 1 is :\t" << nOfstudents1; 
    cout << "\nThe number of Students in Year 2 is :\t" << nOfstudents2; 
    cout << "\nThe number of Students in Year 3 is :\t" << nOfstudents3; 
    cout << "\nThe number of Students in Year 4 is :\t" << nOfstudents4; 
    percent = (nOfstudents1 * 100.0) / 371; 
    cout << "\n\nThe percentage of Students in Year 1 is :\t" << percent << "%";
    percent = (nOfstudents2 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 2 is :\t" << percent<< "%";
    percent = (nOfstudents3 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 3 is :\t" << percent << "%";
    percent = (nOfstudents4 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 4 is :\t" << percent<< "%";
    
    total = nOfstudents1 + nOfstudents2 + nOfstudents3 + nOfstudents4; 
    cout << "\n\nThe total number of students in program is :\t" << total; 
    //check the enrollment is over the limit
    if (nOfstudents1 > 100) {
    cout << "\n\nThe number of students enrolled in year 1 is over the limit."; 
    }
    if (nOfstudents2 > 100) {
    cout << "\nThe number of students enrolled in year 2 is over the limit."; 
    }
    if (nOfstudents3 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    if (nOfstudents4 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    break; 
    
    case 2: 
    cout << "\nPlease Enter number of students in Year 1 :\t";
    cin >> nOfstudents1; 
    cout << "\nPlease Enter number of students in Year 2 :\t";
    cin >> nOfstudents2; 
    cout << "\nPlease Enter number of students in Year 3 :\t";
    cin >> nOfstudents3; 
    cout << "\nPlease Enter number of students in Year 4 :\t";
    cin >> nOfstudents4; 
    cout << "======================DEPARTMENT OF COMPUTER SCIENCE ================================\n";
    cout << "The number of Students in Year 1 is :\t" << nOfstudents1; 
    cout << "\nThe number of Students in Year 2 is :\t" << nOfstudents2; 
    cout << "\nThe number of Students in Year 3 is :\t" << nOfstudents3; 
    cout << "\nThe number of Students in Year 4 is :\t" << nOfstudents4; 
    percent = (nOfstudents1 * 100.0) / 371; 
    cout << "\n\nThe percentage of Students in Year 1 is :\t" << percent << "%";
    percent = (nOfstudents2 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 2 is :\t" << percent << "%";
    percent = (nOfstudents3 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 3 is :\t" << percent << "%";
    percent = (nOfstudents4 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 4 is :\t" << percent << "%";
    
    total = nOfstudents1 + nOfstudents2 + nOfstudents3 + nOfstudents4; 
    cout << "\n\nThe total number of students in program is :\t" << total; 
    //check the enrollment is over the limit
    if (nOfstudents1 > 100) {
    cout << "\n\nThe number of students enrolled in year 1 is over the limit."; 
    }
    if (nOfstudents2 > 100) {
    cout << "\nThe number of students enrolled in year 2 is over the limit."; 
    }
    if (nOfstudents3 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    if (nOfstudents4 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    break; 
    case 3: 
    cout << "\nPlease Enter number of students in Year 1 :\t";
    cin >> nOfstudents1; 
    cout << "\nPlease Enter number of students in Year 2 :\t";
    cin >> nOfstudents2; 
    cout << "\nPlease Enter number of students in Year 3 :\t";
    cin >> nOfstudents3; 
    cout << "\nPlease Enter number of students in Year 4 :\t";
    cin >> nOfstudents4; 
    
    cout << " ======================DEPARTMENT OF BUSINESS ADMINISTRATION ================================ \n"; 
    cout << "The number of Students in Year 1 is :\t" << nOfstudents1; 
    cout << "\nThe number of Students in Year 2 is :\t" << nOfstudents2; 
    cout << "\nThe number of Students in Year 3 is :\t" << nOfstudents3; 
    cout << "\nThe number of Students in Year 4 is :\t" << nOfstudents4; 
    percent = (nOfstudents1 * 100.0) / 371; 
    cout << "\n\nThe percentage of Students in Year 1 is :\t" << percent << "%";
    percent = (nOfstudents2 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 2 is :\t" << percent << "%";
    percent = (nOfstudents3 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 3 is :\t" << percent << "%";
    percent = (nOfstudents4 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 4 is :\t" << percent << "%";
    total = nOfstudents1 + nOfstudents2 + nOfstudents3 + nOfstudents4; 
    cout << "\n\nThe total number of students in program is :\t" << total; 
    //check the enrollment is over the limit
    if (nOfstudents1 > 100) {
    cout << "\n\nThe number of students enrolled in year 1 is over the limit."; 
    }
    if (nOfstudents2 > 100) {
    cout << "\nThe number of students enrolled in year 2 is over the limit."; 
    }
    if (nOfstudents3 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    if (nOfstudents4 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    break; 
    
    case 4: 
    cout << "\nPlease Enter number of students in Year 1 :\t";
    cin >> nOfstudents1; 
    cout << "\nPlease Enter number of students in Year 2 :\t";
    cin >> nOfstudents2; 
    cout << "\nPlease Enter number of students in Year 3 :\t";
    cin >> nOfstudents3; 
    cout << "\nPlease Enter number of students in Year 4 :\t";
    cin >> nOfstudents4; 
    
    cout << "======================DEPARTMENT OF FINE ARTS ================================\n";
    cout << "The number of Students in Year 1 is :\t" << nOfstudents1; 
    cout << "\nThe number of Students in Year 2 is :\t" << nOfstudents2; 
    cout << "\nThe number of Students in Year 3 is :\t" << nOfstudents3; 
    cout << "\nThe number of Students in Year 4 is :\t" << nOfstudents4; 
    percent = (nOfstudents1 * 100.0) / 371; 
    cout << "\n\nThe percentage of Students in Year 1 is :\t" << percent << "%";
    percent = (nOfstudents2 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 2 is :\t" << percent << "%";
    percent = (nOfstudents3 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 3 is :\t" << percent << "%";
    percent = (nOfstudents4 * 100.0) / 371; 
    cout << "\nThe percentage of Students in Year 4 is :\t" << percent << "%";
    
    total = nOfstudents1 + nOfstudents2 + nOfstudents3 + nOfstudents4; 
    cout << "\n\nThe total number of students in program is :\t" << total; 
    //check the enrollment is over the limit
    if (nOfstudents1 > 100) {
    cout << "\n\nThe number of students enrolled in year 1 is over the limit."; 
    }
    if (nOfstudents2 > 100) {
    cout << "\nThe number of students enrolled in year 2 is over the limit."; 
    }
    if (nOfstudents3 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    
    if (nOfstudents4 > 100) {
    cout << "\nThe number of students enrolled in year 3 is over the limit."; 
    }
    break; 
    
    }//switch ends
    
    cout << "\n\n Press any key to continue..."; 
    _getch();
    return 0; } 
    


  • ansaraliansarali Posts: 25,240

    CS201 Introduction to Programming 

  • ansaraliansarali Posts: 25,240
    Mcqs 40 th past moaz m se the ziada tr
    do wjile loop bnana tha for multiples of 4
    program bna tha cout m display dena tha aur function call krana tha
    ek arrray ko access krna tha using index
    ek code dia tha us m ghlti nikalni thi
    malloc and calloc function aya t
    construction time explain krna tha
  • ansaraliansarali Posts: 25,240
    Today my cs201 paper
    Program for class
    Write program to copy one array into another array and array of 5 elements
    Aur baki questions find errors in the given code
    Calloc and malloc function
    Write program for constructor
  • ansaraliansarali Posts: 25,240
    +92 323 4134266: Eng201 Questions

    Define Visual Aids 2 marks

    What do you understand about claim in business English 2 marks

    Rules for writing Bad-news message 3 marks

    Briefly explain the content of slides in oral presentation 3 marks

    True False(handouts) 3 marks

    True False(handouts) 3 marks

    How can you make your presentation more interesting and effective? 5 marks

    Empirical research report 5 fill in the blanks 5 marks

    Turn sentences from active into passive 10 marks

    5 same sentences (different punctuation) ???True False 10 MARKS!(lol pata nehi kis nay likha question)

    92 323 4134266: Today my cs201 paper
    Program for class
    Write program to copy one array into another array and array of 5 elements
    Aur baki questions find errors in the given code
    Calloc and malloc function
    Write program for constructor
  • ansaraliansarali Posts: 25,240
    Cs201
    To day paper is.
    2.30 pm
    Mcq from moaz and waqar file. Almost 30+.
    2.long question about matrix .
    And print
    Virtual ***university.
    Short question based on definition and coding.
    1)convert if statement S Code into switch statement form.
    2) define Compress of file.
    3)new operator and it function.
    4)write a program by using macro .
    5) define default function argument?
    6) classes m sy tha aik question.
Sign In or Register to comment.

ACC311 ACC501 ACC311  ACC501 ACF619  ACFI619 BIF401 BIF402 BIF501 BIF601 BIF602

BIF604 BIF619 BIF720 BIF731 BIF732 BIF733 BIT701 BIT703 BIT710 BIT715 BIO101 BIO102 

BIO201 BIO202 BIO203 BIO204 BIO301 BIO302 BIO303 BIO401 BIO502 BIO503 BIO601 BIO731 

BIO732 BIO733 BIO734 BNK601 BNK603 BNK604 BNK610 BNK612 BNK619 BNK620

BNK701 BNK703 BNK704 BNK725 BNKI619 BNKI620 BT101 BT102 BT201 BT301 BT302 BT401

BT402 BT403 BT404 BT405 BT406 BT503 BT504 BT505 BT601 BT603 BT605 BT619 BT720 BT731

BT732 BT733 BT734 BT735 BTI619

CS001 CS101 CS201 CS202 CS204 CS205 CS206 CS301 CS302 CS304 CS310 CS311 CS312 CS314 CS315 CS401

CS402 CS403 CS405 CS406 CS407 CS408 CS409 CS410 CS411 CS420 CS431 CS432 CS435 CS441 CS501 CS502 

CS504 CS506 CS507 CS508 CS510 CS519 CS601 CS602 CS603 CS604 CS605 CS606 CS607 CS608 CS609 CS610

CS611 CS614 CS615 CS619 CS620 CS625 CS701 CS702 CS703 CS704 CS706 CS707 CS708 CS709 CS710 

CS711 CS712 CS713 CS716 CS718CS720 CS721 CS723 CS724 CS726 CS799 COM619 COMI619