Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write comments in every single line in java package com.company; import java.lang.*; import java.io.FileWriter; import java.util.*; import java.time.format.DateTimeFormatter; import java.time.LocalDateTime; import java.lang.*; import java.io.BufferedReader; import

Write comments in every single line in java


package com.company;

import java.lang.*;
import java.io.FileWriter;
import java.util.*;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
import java.lang.*;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileWriter;
import java.util.*;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;


public class Main {


public static void main(String[] args) {

Scanner sc=new Scanner(System.in);
System.out.println("Enter Name");
String name=sc.nextLine();
System.out.println("Enter ID");
String id=sc.nextLine();

try
{
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
FileWriter fw=new FileWriter("D:testout.txt");
fw.write(name+" "+id+" "+dtf.format(now));
fw.close();
System.out.println("Registered successfully");

}
catch(Exception e){System.out.println(e);}
System.out.println("Success...");
System.out.println("");
System.out.println("Enter ID To see your vaccine dose data and time ");

BufferedReader br;
String line = "";

int found=0;
String st=sc.nextLine();
try {
br = new BufferedReader(new FileReader("D:testout.txt"));
try {
while((line = br.readLine()) != null)
{

String[] words = line.split(" ");

for (String word : words) {
if (word.equals(st)) {
found=1;
break;
}
}
}
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(found==1)
{
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime tom = now.plusDays(7);
LocalDateTime tom1 = tom.plusDays(27);
System.out.println("First Dose is "+dtf.format(tom));
System.out.println("Second Dose is "+dtf.format(tom1));
}
else
System.out.println("Candidate have not registered");

}

}

Step by Step Solution

3.44 Rating (144 Votes )

There are 3 Steps involved in it

Step: 1

package comcompany import javalang import javaioFileWriter import javautil import javatimeformatDateTimeFormatter import javatimeLocalDateTime import ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
636b5a6fe4d37_243540.pdf

180 KBs PDF File

Word file Icon
636b5a6fe4d37_243540.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Applied Equity Analysis and Portfolio Management Tools to Analyze and Manage Your Stock Portfolio

Authors: Robert A.Weigand

1st edition

978-111863091, 1118630912, 978-1118630914

More Books

Students also viewed these Computer Engineering questions

Question

Write in logarithmic form: 4 -2 = 0.0625.

Answered: 1 week ago