Posts

FileOperationsProgram

 import java.io.File; import java.io.FileWriter; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class FileOperationsProgram{     public static void main(String[] args) {         File file = new File("example.txt");         // Create a file         try{             if (file.createNewFile()) {                 System.out.println("File created: " + file.getName());             } else {                 System.out.println("File already exists.");             }         } catch (IOException e) {             System.out.println("An error occurred while creating the file.");             e.printStackTrace();       ...

BIO DATA

 Name : C .Swathi Class  : ll M. Sc, Computer Science  Reg No: P 23 CS 397 DOB: 21/10/2002 Qualification: BSc, Computer Science  College Name: GACA KUM (A) Father's Name: S. Chandrasekaran Occupation: Farmer  Mother's Name: C. Chandra Occupation: House Wife Annual Income:72,000 Blood Group: B-ve Mobile number: 6381290353 E-mail I'd : swathichandrasekaran21@gmail.com

Java questions

 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()"; qpa[3][0]="...

Product calculation

 import java.text.DecimalFormat; // Product excluding tax class class ProductExcludingTax {     private String productName;     private int quantity;     private double price;     private double taxRate; // Tax rate as a decimal (e.g., 0.1 for 10% tax)     // Constructor     public ProductExcludingTax(String productName, int quantity, double price, double taxRate) {         this.productName = productName;         this.quantity = quantity;         this.price = price;         this.taxRate = taxRate;     }     // Calculate total amount including tax     public double calculateTotalAmount() {         double totalAmount = quantity * price;         double taxAmount = totalAmount * taxRate;         return totalAmount + taxAmount;     }     // ...