Posts

4th program

Image
  import java.io.*; import java.nio.file.*; import java.util.List; import java.util.stream.Collectors; public class AFO{     // Read file content     public static void readFile(String filePath) throws IOException {         List<String> lines = Files.readAllLines(Paths.get(filePath));         for (String line : lines) {             System.out.println(line);         }     }     // Write content to a file     public static void writeFile(String filePath, String content) throws IOException {         Files.write(Paths.get(filePath), content.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);     }     // Copy a file     public static void copyFile(String sourcePath, String destinationPath) throws IOException {         Files.copy(Paths.get(sourcePath), Paths.g...

2nd program

Image
2nd Program July 09, 2024  import java.lang.*; import java.io.*; class Questions{ public String [][]qpa; public String[][]qca;  Questions()throws IOException { qpa=new String[10][5]; /*questionsandobjectives*/ DataInputStream in=new DataInputStream(System.in); qpa[0][0]="keyboard?"; qpa[0][1]="1.input"; qpa[0][2]="2.java JavaProgram"; qpa[0][3]="3.javac JavaProgram.java";qpa[0][4]="4.No one"; qpa[1][0]="What is the use ofthe println method?"; qpa[1][1]="1.Itisusedtoprinttextonthescreen."; qpa[1][2]="2.Itisusedtoprinttextonthescreenwiththelinebreak."; qpa[1][3]="3.Itisusedtoreadtextfromkeyboard."; qpa[1][4]="4.Itisusedtoread textfromafile."; qpa[2][0]="Howtoreadacharacterfromthekeyboard?"; qpa[2][1]="1.char c=System.read()"; qpa[2][2]="2.char c=System.in.read()"; qpa[2][3]="3.char c=(char)System.read()"; qpa[2][4]="4.char c=(char)System.in.read...

Product calculation

Image
  Product calculation June 23, 2024  import java.util.Scanner; public class ProductDetails {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         // Prompt for product name         System.out.print("P-Name: ");         String productName = scanner.nextLine();         // Prompt for quantity         System.out.print("Qty: ");         int quantity = scanner.nextInt();         // Prompt for price         System.out.print("Price: ");         double price = scanner.nextDouble();         // Prompt for tax percentage         System.out.print("Tax (%): ");         double tax = scanner.nextDouble();         // Calculate tax amount       ...

Anbu

Image
 Name : Anbu M Reg no : P 23 CS 368 DOB : 15/02/2003 Blood group : O+ ve College : government arts college kumbakonam  Study : M.sc., computer science  Father name : MARIYAPPAN  Mother name : suba M  Hobbies : playing cricket  Address : 636, south Street,                   Mullangudi (po),                    Thiruvidaimaruthur (Tk),                   Thanjavur (Dt),                    612 502