0% found this document useful (0 votes)
44 views8 pages

C Programming: Structures & Classes

The document discusses object-oriented programming and C/C++. It provides 4 examples of structs and classes to represent different data like customers, employees, cars, and products. It asks the reader to write code to declare arrays of these structs/classes, initialize them with sample data, and write functions or methods to manipulate the data like updating balances, increasing salaries, or printing destruction messages.

Uploaded by

Sahil Kumar
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)
44 views8 pages

C Programming: Structures & Classes

The document discusses object-oriented programming and C/C++. It provides 4 examples of structs and classes to represent different data like customers, employees, cars, and products. It asks the reader to write code to declare arrays of these structs/classes, initialize them with sample data, and write functions or methods to manipulate the data like updating balances, increasing salaries, or printing destruction messages.

Uploaded by

Sahil Kumar
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

STRUCTURED AND OBJECT-

ORIENTATION
PROGRAMMING

PPS-3
NAME: SATHWIK NOOKALA

REG NO:22BCE0144

1.) Suppose you are working on a program to simulate a simple banking system that stores customer information,
including account number, name, address, and balance. Design a structure to represent customer information, and
write a C program to declare an array of five customer records. Initialize the array with data for five customers and
display the records on the screen. In addition, write a function that takes a customer record as a parameter and updates
the customer's balance by a specified amount.

Code:
Output:

2.) Develop a program to manage an employee database. Each employee record consists
of the employee's name, ID, department, and salary. Design a structure to represent an
employee record, and write a C program to declare an array of ten employee records.
Initialize the array with data for ten employees and display the records on the screen. In
addition, write a function that takes an employee record as a parameter and increases
the employee's salary by 10%

Input:
Output:
3.) You are developing a program for a small car dealership to manage its inventory. Design
a class to represent a car and write a C program to declare an array of three cars. Initialize
the array with data for three cars and display the records on the screen. Each car record
should include the make, model, year, and price. In addition, write a constructor for the car
class that takes the make, model, year, and price as parameters and initializes the data
members of the object.

Code:
4.) You are developing a program for a small retail store to manage its products. Design
a class to represent a product and write a C++ program to declare an array of five
products. Initialize the array with data for five products and display the records on the
screen. Each product record should include the product name, price, and quantity. In
addition, write a destructor for the product class that prints a message indicating that
the object is being destroyed.

Code:

Output:
Output:

You might also like