0% found this document useful (0 votes)
7 views

Practice Assignment MVC

The document outlines the submission guidelines and requirements for Assignment-02 in the CS-1002 Programming Fundamentals course at the National University of Computer & Emerging Sciences. It includes specific instructions for file naming, folder organization, submission format, and deadlines, along with details for five programming questions related to C++ coding. The assignment is due on February 20, 2025, and emphasizes the importance of adhering to the provided instructions to avoid receiving zero marks.

Uploaded by

asifkalu577
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Practice Assignment MVC

The document outlines the submission guidelines and requirements for Assignment-02 in the CS-1002 Programming Fundamentals course at the National University of Computer & Emerging Sciences. It includes specific instructions for file naming, folder organization, submission format, and deadlines, along with details for five programming questions related to C++ coding. The assignment is due on February 20, 2025, and emphasizes the importance of adhering to the provided instructions to avoid receiving zero marks.

Uploaded by

asifkalu577
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

CS-1002 Programming Fundamentals Spring-2025


ASSIGNMENT-02
Instructions:

Dear students we will be using auto-grading tools, so failure to submit according to the below format
would result in zero marks in the relevant evaluation instrument.
i. For each question in your assignment, make a separate cpp file e.g. for question 1, make
ROLL-NUM_Q#.cpp (24i-0001_Q1.cpp) and so on. Each file that you submit must contain
your name, student-id, and assignment # on top of the file in comments.
ii. Combine all your work in one folder. The folder must contain only .cpp files (no binaries, no
exe files etc.).
iii. Run and test your program on a lab machine before submission.
iv. Rename the folder as ROLL-NUM_SECTION (e.g. 24i-0001) and compress the folder as a zip
file. (e.g. 24i-0001.zip). do not submit .rar file.
v. Submit the .zip file on Google Classroom within the deadline.
vi. Submission other than Google classroom (e.g. email etc.) will not be accepted.
vii. The student is solely responsible to check the final zip files for issues like corrupt file, virus in
the file, mistakenly exe sent. If we cannot download the file from Google classroom due to
any reason it will lead to zero marks in the assignment.
viii. Displayed output should be well mannered and well presented. Use appropriate comments
and indentation in your source code.
ix. Correct and timely submission of the assignment is the responsibility of every student,
hence no relaxation will be given to anyone. Late Submission policy will be applied as
described in course outline.
x. Total Marks: 60.
xi. If there is a syntax error in code, zero marks will be awarded in that part of assignment.
xii. Your code must be generic.

Deadline: Deadline to submit assignment is 20th February 2025 11:00 PM. You are supposed to submit
your assignment on GOOGLE CLASSROOM. Only “.ZIP” files are acceptable. Other formats should be
directly given ZERO. Correct and timely submission of the assignment is the responsibility of every
student, hence no relaxation will be given to anyone. Late Submission policy will be applied as
described in course outline.
Tip: For timely completion of the assignment, start as early as possible.
Plagiarism: Plagiarism is not allowed. If found plagiarized, you will be awarded zero marks in the
assignment (copying from the internet is the easiest way to get caught).

Note: Follow the given instruction to the letter, failing to do so will result in a zero.
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

Question 1. (10 Marks)


Write a C++ program that gives the largest number using ternary operator among:
 Three Numbers that is if three numbers are taken as input form user.
 Four Numbers that is if four numbers are taken as input form user.

Question 2. (10 marks)


Write a code that takes two integers as input representing a month and day and prints the season
for that month and day. Assume that months are specified as an integer between 1 and 12 (1 for
January, 2 for February, and so on) and that the day of the month is a number between 1 and 31.
If the date falls between 16/12 and 15/3, you should print "Winter". If the date falls between 16/3
and 15/6, you should print "Spring". If the date falls between 16/6 and 15/9, you should print
"Summer". And if the date falls between 16/9 and 15/12, you should print "Fall".

Question 3. (10 marks)


A certain grade of steel is graded according to the following conditions:
(i) Hardness must be greater than 50
(ii) Carbon content must be less than 0.7
(iii) Tensile strength must be greater than 5600
The grades are as follows:
• Grade is 10 if all three conditions are met.
• Grade is 9 if conditions (i) and (ii) are met.
• Grade is 8 if conditions (ii) and (iii) are met.
• Grade is 7 if conditions (i) and (iii) are met.
• Grade is 6 if only one condition is met.
• Grade is 5 if none of the conditions are met.
Write a program, which will require the user to give values of hardness, carbon content and
tensile strength of the steel under consideration and output the grade of the steel.
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

Question 4. (10 marks)


You are given a grid as shown in the figure below. You can determine the color and number of
each square from the grid. Using switch write a C++ program that inputs two numbers within the
grid range. Your program will determine if the two squares entered in this grid have the same
color or not. Apply Input Validation.

Question 5. (20 marks)


Write a C++ program for a company that is planning to sell e-tickets for PSL-5 matches being
held in Rawalpindi Cricket Stadium (RCS). The map of the seating enclosures is shown below.
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

Each of the enclosures has the following maximum capacity:


● Imran Khan enclosure: Max 1000 seats.
● Javed Miandad enclosure: Max 1000 seats.
● Javed Akhter enclosure: Max 1000 seats.
● Azhar Mehmood enclosure: Max 1000 seats.
● Sohail Tanveer enclosure: Max 3000 seats.
● Shoaib Akhtar enclosure: Max 3000 seats.
● Imran Buksh enclosure: Max 2500 seats.
● Yasir Arafat enclosure: Max 2500 seats.

Here is the list of all ticket prices for night matches in Rawalpindi Cricket Stadium.
 27 February 2020 | Islamabad United v Quetta Gladiators (7 pm-10.15 pm)
(VIP – Rs. 3000, Premium – Rs. 1500, First-class – Rs. 1000, General – Rs. 500)
 28 February 2020 | Peshawar Zalmi v Lahore Qalandars (7 pm-10.15 pm)
(VIP – Rs. 3000, Premium – Rs. 1500, First-class – Rs. 1000, General – Rs. 500)
 29 February 2020 | Islamabad United v Peshawar Zalmi (7 pm-10.15 pm)
(VIP – Rs. 3000, Premium – Rs. 1500, First-class – Rs. 1000, General – Rs. 500)
 1 March 2020 | Islamabad United v Karachi Kings (7 pm-10.15 pm)
(VIP – Rs. 2000, Premium – Rs. 1000, First-class – Rs. 500, General – Rs. 250)
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

 2 March 2020 | Peshawar Zalmi v Karachi Kings (7 pm-10.15 pm)


(VIP – Rs. 1500, Premium – Rs. 1000, First-class – Rs. 500, General – Rs. 250)
 5 March 2020 | Peshawar Zalmi v Quetta Gladiators (7 pm-10.15 pm)
(VIP – Rs. 1500, Premium – Rs. 1000, First-class – Rs. 500, General – Rs. 250)

Here is the list of all ticket prices for day matches in Rawalpindi Cricket Stadium.
 7 March 2020 | Peshawar Zalmi v Islamabad United (2 pm-5.15 pm)
(VIP – Rs. 2000, Premium – Rs. 1000, First-class – Rs. 500, General – Rs. 250)
 8 March 2020 | Multan Sultans v Islamabad United (2 pm-5.15 pm)
(VIP – Rs. 1500, Premium – Rs. 1000, First-class – Rs. 500, General – Rs. 250)
The program should start by displaying a menu listing the schedule of matches in the
stadium.
1. 27 Feb 2020 – Islamabad United v Quetta Gladiators, Pindi Cricket Stadium
(7pm-10.15pm)
2. 28 Feb 2020 – Peshawar Zalmi v Lahore Qalandars, Pindi Cricket Stadium
(8pm-11.15pm)
3. 29 Feb 2020 – Islamabad United v Peshawar Zalmi, Pindi Cricket Stadium
(7pm-10.15pm)
4. 1 Mar 2020 – Islamabad United v Karachi Kings, Pindi Cricket Stadium
(7pm-10.15pm)
5. 2 Mar 2020 – Peshawar Zalmi v Karachi Kings, Pindi Cricket Stadium
(7pm-10.15pm)
6. 5 Mar 2020 – Peshawar Zalmi v Quetta Gladiators, Pindi Cricket Stadium
(7pm-10.15pm)
7. 7 Mar 2020 – Peshawar Zalmi v Islamabad United, Pindi Cricket Stadium
(2pm-5.15pm)
8. 8 Mar 2020 – Multan Sultans v Islamabad United, Pindi Cricket Stadium
(2pm-5.15pm)
Enter your choice (1 - 8)
When a user selects one of the above options, a sub-menu is shown listing names of all the
enclosures, their class, ticket price and number of seats available . The available seats are
randomly
generated for each enclosure within its range of maximum capacity. When the user selects one of
the enclosures in the sub-menu, the programs prompts the user if he/she wishes to buy tickets for
a family. In case, the family option is selected - the user is prompted to enter the required number
of adult and children tickets, his/her CNIC number (maximum 4 adults, and 5 children). If the
family option is not selected, the user is prompted to enter the required number of adult tickets,
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

his/her CNIC number (maximum 8 adults). To attract more spectators, the company is giving
discounts for groups and children. If the user selects family option or enters adult tickets greater
than four, 10% rebate is given on all adult tickets. A child ticket is given 20% rebate. The
program
finally displays the total amount due.
You have to write this program using switch statements primarily. Hint: For one and two-way
selections (e.g. input validations), you are allowed (and encouraged) to use if statements.
Input Validation: Make sure the user cannot select invalid options in the menu and that the
number of people is always greater than 0. Similarly, a user cannot enter more than available
tickets
for the chosen option. For family option, the number of children needs to be always greater than
one.
Note: use rand() to generate random numbers
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES ISLAMABAD

Enjoy Coding

You might also like