Questions: 1 835

Answers by our Experts: 1 539

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Q3) Create class name Addressfollowing attributes:doorNumber of type Integerstreet of type Stringcity of type Stringdistrict of type Stringstate of type String

pinCode of type IntegerInclude appropriate getters, setters ,constructors.

Include method that lists all districts in particular state sorted in alphabetical order.collections.Write a main method to test the above class. Input and Output FormatAll text in bold corresponds to input and the rest corresponds to output. Sample Input and Output:Enter the number of addresses to be inserted 2Enter address 1 details Enter door number2Enter street nameLMCEnter city nameOotyEnter district nameNilgirisEnter state nameTamilnaduEnter pin code641044Enter address 2 details Enter door number5Enter street nameRed CrossEnter city nameSatyamangalamEnter district nameErodeEnter state nameTamilnaduEnter pin code642054Enter a state nameTamilnaduList of districts in Tamilnadu are ErodeNilgirisEnter a district name ErodeList of cities in Erode areSathyamangalam


Q2) Problem Statement:Write a Program to perform the basic operations like insert,delete,display and search in list. List contains String object items where these operations are to be performed.Sample Input and Output 1 :1. Insert2. Search3. Delete4. Display5. ExitEnter your choice :1Enter the item to be inserted:BottleInserted successfully

ExitEnter your choice :1Enter the item to beinserted:WaterInserted successfully1. Insert2. Search3. Delete4. Display5. ExitEnter your choice :1Enter the item to beinserted:CapInserted successfullyEnter your choice :1Enter the item to beinserted:MonitorInserted successfully1. : 2Enter the item to search : MouseItem not found in the list.Enter your choice : 2Enter the item to search : MonitorItem found in the list.. Exit : 3Enter the item to delete : Mouse : 4The Items in the list are : BottleWater Cap Monitor : 3Enter the item to delete : CapDeleted successfullyEnter your choice : 4The Items in the list are : BottleWater Monitor


Q1) Create a class with Customer with the following properties CustomerID and CustomerName and in that class only write functions:

a. List<Customer> retriveCustomers() to fill the customer class with objects and retrieve filled details of the customer .

b. FindCustomer (List<Customer> clist1,int custid1) find the customer from the above list of customers by fetching id from the user.

c. Updatecustomer(List<Customer> clist1, int custid1) to update a particular customer when id is given

d. Deletecustomer (List<Customer> clist1,int custid1) to delete the particular customer when id is given .


Q2. There is a Change request from the customer. It is as follows:You need to calculate Interest paid by banks on Saving Account.Task 1 : Add a function declaration “void CalculateInterest()” in the interface. Define the functions in the concrete classes such as ICICI accounts get 7% interest and HSBC gives 5% interest.


Task 7: Create a console application. The Main() function needs to create the objects and execute thefunctionality as per the instructions.Main( ) //Write this function{

// Task to be performed:Create a Object of ICICI Set the Account type to Saving (Use enum) Deposit Rs. 50000 to this accountCreate another Object of ICICI Set the Account type to Current (use enum)Deposit Rs. 20000 to this accountPrint the Balance of both these account objects.Now call the Transfer function to transfer the money from Savings account to Current Account.The amount to be transferred is Rs. 5000.e.g. a1.Transfer(a2,5000);Now print the Balance after the Transfer from both the accounts.

Similarly, create two accounts of HSBC Bank. Transfer Rs. 30000 from Saving to Current and display thebalance.}


There is a Change request from the customer. It is as follows:

You need to calculate Interest paid by banks on Saving Account.

Task 1 : Add a function declaration “void CalculateInterest()” in the interface. Define the functions in the concrete classes such as ICICI accounts get 7% interest and HSBC gives 5% interest.


Task 7: Create a console application. The Main() function needs to create the objects and execute thefunctionality as per the instructions.

Main( ) //Write this function

{

// Task to be performed:

Create a Object of ICICI Set the Account type to Saving (Use enum) Deposit Rs. 50000 to this account

Create another Object of ICICI Set the Account type to Current (use enum)

Deposit Rs. 20000 to this account

Print the Balance of both these account objects.

Now call the Transfer function to transfer the money from Savings account to Current Account.

The amount to be transferred is Rs. 5000.

e.g. a1.Transfer(a2,5000);

Now print the Balance after the Transfer from both the accounts.

Similarly, create two accounts of HSBC Bank. Transfer Rs. 30000 from Saving to Current and display thebalance.

}


Task 5: Implement only the Deposit method to increment the Balance. Keep the other two methods abstractin the class.

Task 6: Now let’s create concrete classes which are inherited from the BankAccount class.

Concrete Bank Account Classes having their own rules for Minimum Balance class ICICI // Inherit this from BankAccount

{

Withdraw() // Override this method

{

// If Balance – amount is >= 0 then only WithDraw is possible.

// Write the code to achieve the same.

}

Transfer() //Override this method

{

// If Balance – Withdraw is >= 1000 then only transfer can take place.

// Write the code to achieve the same.

}

}

class HSBC // Inherit this from BankAccount

{

Withdraw() //Override this method

{

// If Balance – amount is >= 5000 then only WithDraw is possible.

// Write the code to achieve the same.

}

Transfer() //Override this method

{

// If Balance – Withdraw is >= 5000 then only transfer can

take place.

// Write the code to achieve the same.

}

}


Let’s build a sample banking program to perform the common tasks like Withdraw and Deposit.

Task 1: Create a class library project and Add a Class called BankAccount. This class needs to implement the IBankAccount Interface.

Task 2: Define a enum as follows. This enum will be used as a property in the interface.

//public enum BankAccountTypeEnum

{

Current=1,Saving=2

}

Task 3: Define IBankAccount interface and add the following fields to it.

double GetBalance();

void Deposit(double amount);

bool Withdraw(double amount);

bool Transfer(IBankAccount toAccount, double amount);

BankAccountTypeEnum AccountType { get; set; }

Task 4: Create an abstract class called as BankAccount and implement the class with the interface

definedabove. Add a property called Balance in this class

protected double balance;


Create an abstract class shape in which area abstract function is there so two classes triangle and rectangle can override the functionality of area in shape class .Then a change of request has come as per new requirement a we have to find the area of square and area of circle also but they don’t want to override the functionality of abstract class shape but they want to implement their code?And area of circle is Pi r2 and area of square is (side)2.Q3) Write overloaded methods to find total salary of employees. Create a class Employee and write an overloaded method to find total salary of employee.Total salary=salary + Bonus+ incentives (data types use it decimal,int,int) Total salary=salary +HRA + PF (data types use it double,float,int)Total salary=salary + perks +travelling_allowences (data types use it is float,int,short)Create another subclass as EmployeeJunior and there also write one overloaded method and call al the methods as per the parameters passed in the main method in console application.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS