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

struct

The document contains a series of programming tasks that involve creating structs and classes for various objects such as Rectangle, Student, Employee, and BankAccount. Each task requires implementing methods for calculations, data input, and displaying information. The tasks focus on fundamental programming concepts including data structures, functions, and user input handling.

Uploaded by

heist994
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

struct

The document contains a series of programming tasks that involve creating structs and classes for various objects such as Rectangle, Student, Employee, and BankAccount. Each task requires implementing methods for calculations, data input, and displaying information. The tasks focus on fundamental programming concepts including data structures, functions, and user input handling.

Uploaded by

heist994
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

QUESTION# 1

Create a struct Rectangle with two properties:

 length (Double)
 width (Float)

Write functions to calculate and return:

 The area of the rectangle.


 The perimeter of the rectangle.

QUESTION#2

Write a program that takes user input for student name and marks then tell the gpa
according to respective marks.
 Create a struct named student containing student name(string) and marks(int).
 Use a function to allocate gpa according to marks.
 Create another function to display student name and gpa.

QUESTION#3

Define a struct called Employee that contains the following data:

 employeeID (Integer)
 firstName (String)
 lastName (String)
 salary (Float)

Write a program that:

 Accepts data for employees.


 Calculates and displays the average salary of all employees.
 Displays the employee with the highest salary.
 Define the Employee struct.
 Write functions to input employee data, calculate the average salary, and find the
employee with the highest salary.

QUESTION# 4

Define a struct Student that contains:

 name (String)
 marks (Float)
Write a program to input data for 5 students, store them in an array of structs, and then sort them
based on their marks in descending order.

Question#1 Create a class Rectangle that stores the length and width of a rectangle and
includes:

 Methods to calculate the area and perimeter of the rectangle.


 Method to display the dimensions of the rectangle.

Question #2 Create a class Student that stores the student's name, roll number, and marks. The
class should:

 Take input from the user for student details.


 Calculate the total marks and percentage.
 Display the student's details.

Question#3 Create a class BankAccount with the following properties:

 accountNumber (String)
 balance (Double)

Provide methods to:

 Set account details.


 Deposit money.
 Withdraw money.
 Display account details.

You might also like