Set 1
Set 1
Set 1
DB_AMJ22_ORACLE_UNIX_1
(Set 1)
Q1 Write a Java Program to find the sum of series to nth term (input the value of n from the user)
Create a class Customer with following private data members
Data Type Variable Name
String name
String address
Integer age
String mobileNumber
Methods in class Customer.
Method Name Function
This method displays the details of the customer with
displayCustomer( the total bill amount and discount amount
) under privilege customer and Normal customer
1)Privilege Customer
2)Normal Customer
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.
Consider the class ProdType with the following private attributes
Attributes Datatype
id Long
name String
deposit Double
costPerDay Double
Consider the class Product with the following private member attributes
Attributes Datatype
id Long
name String
prodType ProdType
vendor String
The class declarations, getters, setters and constructors are available in the template
code.
Consider the driver class Main. In the main method, display a List of objects in the given
format.
Table Structure:
oracle.properties:
db.url = jdbc:oracle:thin:@localhost:1521:xe
db.username = root
db.password = student
Note:
Use System.out.format("%-5s %-15s %-12s %s\n","ID","Name","Deposit","Cost per day") to
display ItemType details.
Use System.out.format("%-5s %-15s %-12s %s\n","ID","Name","Prod Type","Vendor") to
display Item details.
All double values should be formatted to 1 decimal place.
If the given item category doesn’t match with the existing item categories, then display
“No such category is present”.
[All text in bold corresponds to the input and rest corresponds to the output]
Sample Input and Output 1:
ID Name Deposit Cost per day
1 Food 50000.0 10000.0
2 Electronics 85000.0 15000.0
3 Fashion 36000.0 8000.0
4 Grooming 15000.0 5000.0
5 Books 20000.0 7500.0
Enter the category:
Food
ID Name Item Type vendor
1 Chocolate Food Foodies Court
2 Lollypop Food Foodies Court
Sample Input and Output 2:
ID Name Deposit Cost per day
1 Food 50000.0 10000.0
2 Electronics 85000.0 15000.0
3 Fashion 36000.0 8000.0
4 Grooming 15000.0 5000.0
5 Books 20000.0 7500.0
Enter the category:
Mobiles
No such category is present
Code Snippet
DBConnection.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;
ResourceBundle rb = ResourceBundle.getBundle("oracle");
ProductDao.java
import java.util.ArrayList;
import java.util.List;
return prodList;
Oracle.sql
ProdType.java
ProdTypeDAO.java
Main.java