Computer Science, asked by sougandhikakalluri5, 4 months ago

BO Classes

Now for doing any computation works with the class its not advised to use POJO class. So we can use a BO class for computational purposes.

The Stall owners wanted to calculate the total cost of a particular ItemType for the given timeline. To add a feature in the application, calculate the total cost for the given timeline.

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, attribute names and method names should be the same as specified in the problem statement.

Create a class named ItemType with the following private attributes,

Attribute Data Type
name String
deposit Double
costPerDay Double
Add appropriate getter/setter, default and parameterized constructor.
public ItemType(String name, Double deposit, Double costPerDay).


Create a class named ItemTypeBO and include the following method in the class.

Method Description
public Double calculateCost(Date start,Date end,ItemType typeIns) This method is used to calculate the total cost.
It contains start date, end date, item type object as the arguments.
It will return a Double which corresponds to the total cost.

Create a driver class Main to test the above classes. Get the start date and end date (manipulate as Date object) from the stall owners to calculate rent for the particular ItemType.

Input format:
The first line of input is a String which corresponds to the Item type name.
The next two lines of inputs are the double which corresponds to the deposit and the cost per day.
The next two lines of inputs are the start date (dd-MM-yyyy) and end date (dd-MM-yyyy).
Refer to Sample Input and Output for formatting specifications.

Output format:
Display the value of the total cost correct to 1 decimal place.
Refer to Sample Input and Output for formatting specifications.

Sample Input and Output:
[All text in bold corresponds to the input and rest corresponds to output]

Sample Input and Output 1:

Enter the details of the item type
Name:
Bench
Deposit:
1000.00
Cost per Day:
50.00
Enter the starting date:
12-12-2017
Enter the ending date:
14-12-2017
The total cost is Rs.100.0

Sample Input and Output 2:

Enter the details of the item type
Name:
Rolling Fan
Deposit:
500.00
Cost per Day:
50.00
Enter the starting date:
29-12-2017
Enter the ending date:
02-01-2018
The total cost is Rs.200.0

Answers

Answered by chetanreddy839
0

Answer:

POJO stands for Plain Old Java Object. A normal Java object, not sure by any special restriction. But when forced by the Java Language Specification and not requiring any classpath. POJOs area unit used for increasing the readability and reusability of a program. They’re simple to put in writing and perceive. They were introduced in EJB three.0 by Sun Microsystems.

A POJO shouldn’t contain the following:

Extend pre-specified classes, ex: public class GFG extends javax.servlet.http.HttpServlet isn’t a POJO class.

Similar questions