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

PROGRAMMING OF BUSINESS 4

The document contains a series of programming questions and solutions related to business scenarios, including voting eligibility, discounted price calculation, leap year determination, maximum of three numbers, insurance eligibility, day name from number, area calculation for geometrical shapes, theater admission charges, and hotel pricing policy. Each question is presented with corresponding code snippets in Python and C. The solutions demonstrate basic programming concepts such as conditionals, input handling, and mathematical calculations.

Uploaded by

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

PROGRAMMING OF BUSINESS 4

The document contains a series of programming questions and solutions related to business scenarios, including voting eligibility, discounted price calculation, leap year determination, maximum of three numbers, insurance eligibility, day name from number, area calculation for geometrical shapes, theater admission charges, and hotel pricing policy. Each question is presented with corresponding code snippets in Python and C. The solutions demonstrate basic programming concepts such as conditionals, input handling, and mathematical calculations.

Uploaded by

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

PROGRAMMING OF BUSINESS

(24K-7300)

Question #01: Voting Eligibility

age = int(input("Enter your age: "))

if age >= 18:

print("You are eligible to vote.")

else:

print("You are not eligible to vote.")

Question #02: Discounted Price Calculation

price = float(input("Enter the price of the item: "))

if price > 500:

discounted_price = price * 0.8

print(f"Discounted price is: {discounted_price}")

else:

print(f"No discount applied. Price is: {price}")

Question #03: Leap Year in C

#include <stdio.h>

int main() {

int year;

printf("Enter a year: ");

scanf("%d", &year);

if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {

printf("%d is a leap year.\n", year);

} else {

printf("%d is not a leap year.\n", year);


}

return 0;

Question #04: Maximum of Three Numbers

a = float(input("Enter first number: "))

b = float(input("Enter second number: "))

c = float(input("Enter third number: "))

max_num = max(a, b, c)

print(f"The maximum number is: {max_num}")

Question #05: Insurance Eligibility

age = int(input("Enter employee age: "))

gender = input("Enter employee gender (male/female): ").lower()

if age < 30 and gender == "female":

print("The employee is insured.")

elif age >= 30 and gender == "male":

print("The employee is insured.")

else:

print("The employee is not insured.")

Question #06: Day Name from Number

day_number = int(input("Enter a day number (1-7): "))

days = {

1: "Monday",
2: "Tuesday",

3: "Wednesday",

4: "Thursday",

5: "Friday",

6: "Saturday",

7: "Sunday"

print(days.get(day_number, "Invalid day number"))

Question #07: Geometrical Shapes Area

import math

print("Input 1 for area of circle")

print("Input 2 for area of rectangle")

print("Input 3 for area of triangle")

choice = int(input("Input your choice: "))

if choice == 1:

radius = float(input("Input radius of the circle: "))

area = math.pi * radius ** 2

print(f"The area is: {area:.2f}")

elif choice == 2:

length = float(input("Input length of the rectangle: "))

width = float(input("Input width of the rectangle: "))

area = length * width

print(f"The area is: {area:.2f}")

elif choice == 3:

base = float(input("Input base of the triangle: "))

height = float(input("Input height of the triangle: "))


area = 0.5 * base * height

print(f"The area is: {area:.2f}")

else:

print("Invalid choice.")

Question #08: Theater Admission Charge

age = int(input("Enter your age: "))

if age > 55:

charge = "$10.00"

elif 21 <= age <= 54:

charge = "$15.00"

elif 13 <= age <= 20:

charge = "$10.00"

elif 3 <= age <= 12:

charge = "$5.00"

else:

charge = "Free"

print(f"Ticket charge: {charge}")

Question #09: Hotel Pricing Policy

people = int(input("Enter the number of people: "))

business = input("Is the customer staying on company business? (yes/no): ").lower() == "yes"

age = int(input("Enter customer's age: "))

if people == 2:

cost = 85

elif people == 3:
cost = 90

elif people == 4:

cost = 95

else:

cost = 95 + (people - 4) * 6

if business:

cost *= 0.8

elif age > 60:

cost *= 0.85

print(f"The cost of the room is: ${cost:.2f}")

You might also like