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

rishitava qns

The document outlines several C++ programming tasks involving classes and objects. It includes specifications for creating classes such as `Outfit`, `Candidate`, `Bus`, and `ITEM`, each with specific private and public members, constructors, and member functions for initialization, input, and display. Additionally, it mentions a program for calculating the sum from 1 to N and a function to count lines in a text file starting with uppercase characters.

Uploaded by

Uchiha Itachi
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 views

rishitava qns

The document outlines several C++ programming tasks involving classes and objects. It includes specifications for creating classes such as `Outfit`, `Candidate`, `Bus`, and `ITEM`, each with specific private and public members, constructors, and member functions for initialization, input, and display. Additionally, it mentions a program for calculating the sum from 1 to N and a function to count lines in a text file starting with uppercase characters.

Uploaded by

Uchiha Itachi
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/ 3

1.

Write a program in C++ using classes and objects to find the sum from 1 to N, where N is an
integer provided as input.

2. Define a class `Outfit` in C++ with the following specifications:


- Private Members:
- `O_Code`: of type `string`
- `O_Type`: of type `string`
- `O_Size`: of type `int`
- `O_Fabric`: of type `string`
- `O_Price`: of type `float`
- A member function `InitPrice()` to calculate and assign the value of `O_Price` as follows:
- If `O_Fabric` is "DENIM":
- `O_Type` | `O_Price` (Rs.)
- `TROUSER` | 1500
- `JACKET` | 2500
- If `O_Fabric` is not "DENIM," reduce the above prices by 25%.
- Public Members:
- A constructor to initialize `O_Code`, `O_Type`, and `O_Fabric` to "NOT INITIALISED" and `O_Size`
and `O_Price` to 0.
- A function `Input()` to input values for `O_Code`, `O_Type`, `O_Size`, and `O_Fabric`, and then
invoke `InitPrice()`.
- A function `Display()` to display all the data members of an outfit.

3. Write a C++ program to explain inheritance using object-oriented programming concepts.

4. Define a class `Candidate` in C++ with the following description:


- Private Members:
- `RNo`: Registration Number of type `long`
- `Name`: of type `string`
- `Score`: of type `float`
- `Remarks`: of type `string`
- A member function `AssignRem()` to assign remarks based on the score as follows:
- Score | Remarks
- `>= 50` | "Selected"
- `< 50` | "Not Selected"
- Public Members:
- A function `ENTER()` to allow the user to enter values for `RNo`, `Name`, and `Score`, and to call
`AssignRem()`.
- A function `DISPLAY()` to display the content of all the data members.

5. Define a class `Bus` in C++ with the following specifications:


- Data Members:
- `Bus_no`: to store the bus number
- `From`: to store the place name of origin
- `To`: to store the place name of destination
- `Type`: to store the bus type (e.g., 'O' for ordinary)
- `Distance`: to store the distance in kilometers
- `Fare`: to store the bus fare
- Member Functions:
- A constructor to initialize `Type` as 'O' and `Fare` as 500.
- A function `CalcFare()` to calculate the fare based on the following criteria:
- Type | Fare per km
- `O` | 15
- `E` | 20
- `L` | 24
- A function `Allocate()` to allow the user to enter values for `Bus_no`, `From`, `To`, `Type`, and
`Distance`. This function should call `CalcFare()` to calculate the fare.
- A function `Show()` to display all the data members on the screen.

6. Write a function in C++ to count the number of lines starting with uppercase characters in the
text file "HELP.DOC".
7. Define a class `ITEM` in C++ with the following description:
- Private Members:
- `Code`: of type `int` (Item Code)
- `Iname`: of type `string` (Item Name)
- `Price`: of type `float` (Price of each item)
- `Qty`: of type `int` (Quantity of item in stock)
- `Offer`: of type `float` (Offer percentage on the item)
- A member function `GetOffer()` to calculate the offer percentage as follows:
- If `Qty <= 50`: Offer is 0%
- If `50 < Qty <= 100`: Offer is 5%
- If `Qty > 100`: Offer is 10%
- Public Members:
- A function `GetStock()` to allow the user to enter values for `Code`, `Iname`, `Price`, and `Qty`,
and to call `GetOffer()` to calculate the offer.
- A function `ShowItem()` to display all the data members.

You might also like