Create a class called InputData. It has two private data members data_a (int) and data_b (int). Write a function input() to get input for the attributes from the user and a function display() to display the values of the attributes. The values of these two data members can be returned by using two public functions get_a() and get_b().
*Derive a class called Arith_Unit from InputData. It contains the functions add(), sub(),mul(), div() to perform arithmetic operations on data_a and data_b.
Write the program segment for the following questions. ALL question are not
related.
5. set the array item with size 10 with the following data: 3, 5, 7, 9, 11 and 5, 10, 15, 20, 25
6. Let say the array arrayList was declared with size 15. Set the array arrayList with the following data 10, 15, 20, 25, ... using assignment statement
Write the program segment for the following questions. ALL question are not
related.
1. set the array mark with size 10 using input statement
2. set the first three elements of array itemX using input statement
3. set the third element until the sixth element of array itemX using input statement
4. set the array array with size 5 with the following data: 3, 5, 7, 9, and 11
Due to lockdown, AB bank handles a limited number of customers each day (30 persons). To maintain social distance, these persons enter into the bank in 3 rounds. First, 10 people go and perform their task one after one. After 2 minutes, one of them leave the bank finishing their work. When all of the 10 persons leave the bank, 10 more people enter into the bank and perform their work. This continues until all the 30 people are served.
Write a program that automates this task. It will store the name of the customers who are entering the bank. When the quota of 10 persons gets filled up, it will prevent others from entering the bank. After each 2 minutes, the program will print the name of the customer who is about to leave the bank. When the bank will be empty, it will let 10 more people enter into the bank. After serving 30 people, it will announce that bank is closed for the day
Create a class called Transmitter. It has three unsigned int private data members: pay_load,
parity and data_packet; It has one function called parity_bit(). It calculates parity bit by XORing
all pay_load bits and assign the value to parity. By using function get pay_load(), pay_load is got.
data_packet is calculated by multiplying parity_bit with 32768 and add the product with (pay_load
– 32768). Create another class called Receiver. It has unsigned int private data members Rx_Pkt
, Rx_Data and E_Flag. Rx_Data is got from Rx_Data as given below. First E_Flag is calculated
from Rx_Pkt by XORing all bits. If E_Flag is zero, then Rx_Data = Rx_Pkt – 32768, Else a
message should warn about corrupted packet. Derive a class called Tranceiver from the above two
classes and check the functionalities. Use any other functions if needed.
Create a class named EB_amount. It has the data members units_used and bill. Use member
function to set unit_used. Upto 200 units 3 rupees per unit, 201 to 500, 4 rupees per and above 500
5.5 rupees per unit are allotted by EB. Calculate the bill amount and display the amount. Create
another class Salary with basic, DA and HRA. Set basic by a member function. 104 percent of basic
is assigned as DA and 10 percent is allotted as HRA. Display the total salary. Derive a class Budget
contains income, tuition_fee, house_rent, saving, grocery, eb_bill as data members. Set the values
and get the values of income and eb_bill from parent classes. Display the budget details.
Write a program for a publishing company that markets both printed books and audio visual
lectures stored on CDs. Write a class Publication thatstores title and price. Derive a class book which
has an additional member as no_pages and a class Lecture with member play_time.
Define a class Student with data members as rollno and name. Derive a class Fees from student
that has a data member fees and functions to submit fees and generate receipt. Derive another class
Result from Student that displays the marks and grade obtained by the student. Write a program that
extends the class Result so that the final result of the Student is evaluated based on the marks obtained
in tests, activities and sports.
Create a class called InputData. It has two private data members data_a and data_b. Set the
values of these two data members by using two public functions get_a() and get_b(). Derive a class
called Arith_Unit from InputData. It contains the functions add(),sub(), mul(),div() to perform
arithmetic operations on data_a and data_b. Derive a class Logic_Unit from InputData. It
contains the functions and(), or() and xor() to perform logical operations on data_a and data_b.
Finally derive a class called ALUnit from Arith_Unit and Logic_Unit classes. It has to perform
arithmetic and logical operations according to the given codes. Choose code 0 to code 6 to perform
the said seven operations. Write sample program to test the ALU class.