Page 312 - IT-802_class_12
P. 312
std_name=sc.nextLine();
System.out.print("Enter Student Regd. No:");
std_regd_no=sc.nextLine();
System.out.print("Enter Student Class : ");
std_class = sc.nextLine();
System.out.print("Enter Student Section : ");
section=sc.nextLine();
System.out.print("Enter Book Name : ");
book=sc.nextLine();
System.out.print("Enter Author Name of the Book:");
author=sc.nextLine();
System.out.print("Enter Date of issue of the Book(dd/mm/yyyy):");
issue=sc.nextLine();
System.out.print("Enter Date of Return of the Book(dd/mm/yyyy):");
Return = sc.nextLine();
s1 = issue;
s2 = Return;
int d = 0,d1 = 0,m = 0,m1 = 0, x = 0,y ,y1,i;
day_late = 0;
while(true)
{
i=issue.indexOf("/");
/*The indexOf() method returns the index of the first occurrence
of the character passed as parameter in the String object.
i
t takes a character as parameter and returns the index as an integer
value.*/
if (i<0)
break;
if(x==0)
{
d = integer.parseint(issue.substring(0,i));
/*A substring is a part of a string. The substring() method is used
for extracting all the characters from the index position
till the end of the string. it returns a String value.*/
issue=issue.substring(i+1);
}
else if(x==1)
{
m = integer.parseint(issue.substring(0,i));
issue=issue.substring(i+1);
}
310 Touchpad Information Technology-XII

