0% found this document useful (0 votes)
2 views5 pages

Class Object Programs

The document contains multiple classes for different systems: a Sports Venue Information System, a Car Dealership Management System, a Cricket Delivery Tracker, and a Cricket Match Score Management System. Each system includes classes with constructors to initialize data and methods to display or manage that data. User input is used to gather information for each system, and validation is performed in the car management system.

Uploaded by

mohammedzaid0505
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)
2 views5 pages

Class Object Programs

The document contains multiple classes for different systems: a Sports Venue Information System, a Car Dealership Management System, a Cricket Delivery Tracker, and a Cricket Match Score Management System. Each system includes classes with constructors to initialize data and methods to display or manage that data. User input is used to gather information for each system, and validation is performed in the car management system.

Uploaded by

mohammedzaid0505
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

Sports Venue Information System

class Person:

def __init__(self):

line = input("Enter the venue details").strip()

if ',' in line:

parts = [Link](',', 1)

[Link] = parts[0].strip()

[Link] = parts[1].strip()

p1 = Person()

print("\nVenue Details")

print("Venue Name : " + [Link])

print("City Name : " + [Link])

Car Dealership Management System

class Car:

def __init__(self, brand, model, year, price, engine_capacity):

[Link] = brand

[Link] = model

[Link] = year

[Link] = price

self.engine_capacity = engine_capacity

def displayCarDetails(self):

print("Car Details:")

print("Brand:", [Link])

print("Model:", [Link])

print("Year:", [Link])

print(f"Price: ${[Link]}")

print(f"Engine Capacity: {self.engine_capacity} L")


class Main:

def main():

brand = input("Enter the brand of the car:\n")

model = input("Enter the model of the car:\n")

year = int(input("Enter the year of manufacture:\n"))

price = float(input("Enter the price of the car:\n"))

engine_capacity = float(input("Enter the engine capacity of the car:\n"))

# Validation

if year <= 1885 or price <= 0 or engine_capacity <= 0:

print("Invalid Input")

return

car = Car(brand, model, year, price, engine_capacity)

[Link]()

if __name__ == "__main__":

[Link]()

Cricket Delivery Tracker

class Delivery:

# Parameterized constructor

def __init__(self, over, ball, runs, batsman, bowler, nonStriker):

[Link] = over

[Link] = ball

[Link] = runs

[Link] = batsman
[Link] = bowler

[Link] = nonStriker

class Main:

def details():

# Taking input from user

over = int(input("Enter the over\n"))

ball = int(input("Enter the ball\n"))

runs = int(input("Enter the runs\n"))

batsman = input("Enter the batsman name\n")

bowler = input("Enter the bowler name\n")

nonStriker = input("Enter the nonStriker name\n")

# Creating object of Delivery class

delivery = Delivery(over, ball, runs, batsman, bowler, nonStriker)

# Displaying the details

print("Over:", [Link])

print("Ball:", [Link])

print("Runs:", [Link])

print("Batsman:", [Link])

print("Bowler:", [Link])

print("NonStriker:", [Link])

# Call the details method

[Link]()

Cricket Match Score Management System


class Innings:

# Default constructor

def __init__(self, battingTeam="", runs=0):

[Link] = battingTeam

[Link] = runs

class Main:

def main(self):

innings_list = [] # array to store innings objects

# Input for first innings

print("Enter the values for Innings 1")

print("Enter the BattingTeam")

team1 = input()

print("Enter the runs scored")

runs1 = int(input())

# create first innings object

innings1 = Innings(team1, runs1)

innings_list.append(innings1)

# Input for second innings

print("Enter the values for Innings 2")

print("Enter the BattingTeam")

team2 = input()

print("Enter the runs scored")

runs2 = int(input())

# create second innings object

innings2 = Innings(team2, runs2)


innings_list.append(innings2)

# Output

print("Innings 1 Details")

print("BattingTeam:", innings_list[0].battingTeam)

print("Runs scored:", innings_list[0].runs)

print("Innings 2 Details")

print("BattingTeam:", innings_list[1].battingTeam)

print("Runs scored:", innings_list[1].runs)

# Create object of Main class and call main method

Main().main()

You might also like