[go: up one dir, main page]

0% found this document useful (0 votes)
7 views3 pages

Practical Question 3

The document outlines two programming tasks: counting even and odd numbers from user input and creating a Railway Reservation System. The first task requires a loop to input numbers and an if-else condition to determine their parity. The second task involves displaying train classes, booking tickets with seat availability checks, and applying discounts based on the number of tickets purchased.

Uploaded by

ganapathi.aids22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Practical Question 3

The document outlines two programming tasks: counting even and odd numbers from user input and creating a Railway Reservation System. The first task requires a loop to input numbers and an if-else condition to determine their parity. The second task involves displaying train classes, booking tickets with seat availability checks, and applying discounts based on the number of tickets purchased.

Uploaded by

ganapathi.aids22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Question 3: Count Even and Odd Numbers

Write a program that takes a positive integer N as input and then takes N more numbers as
input. The program should count how many of those numbers are even and how many are
odd.

Example:

Input:

Enter N: 5
Enter numbers: 10 25 33 42 8

Output:

Even numbers: 3
Odd numbers: 2

Requirements:

 Use a (for, while, or do-while loop) to take N numbers as input.


 Use an if-else condition to check if a number is even or odd.
3. Software Requirements: Railway Reservation System
Objective:

Create a Railway Reservation System where passengers can:

 View available train classes


 Book tickets
 Check seat availability

Functional Requirements:

1. Display Train Classes:


o 1st Class - ₹1000
o 2nd Class - ₹700
o Sleeper - ₹500
2. Book Tickets:
o Use switch case to select a class.
o Check if seats are available (if-else).
3. Calculate Final Cost:
o Multiply the number of passengers by ticket price.
o If more than 5 tickets, apply 8% discount (if condition).

Example Input & Output:

Input:

Welcome to XYZ Railways


Available Classes:
1. 1st Class - ₹1000
2. 2nd Class - ₹700
3. Sleeper - ₹500

End User will see this Green Highlighted above when he is in the system
following are inputs

Enter your choice (1-3): 3


Enter number of tickets: 6
Checking seat availability...
Seats Available!

Processing: - No need to show this processing to End user

 Selected Class: Sleeper


 Total Cost: 6 × ₹500 = ₹3000
 Discount: 8% of ₹3000 = ₹240
 Final Price: ₹2760
Output: - This Should be the Output result

Class: Sleeper
Tickets: 6
Total Before Discount: ₹3000
Discount Applied: ₹240
Final Price: ₹2760
Your tickets are confirmed!

Concepts Used:

✅ Switch Case - Selecting train class


✅ If-Else - Checking seat availability
✅ Looping Structure - Multiple tickets
✅ Basic Arithmetic - Cost calculation

You might also like