Posts

Question program

Image
 import java.lang.*; import java.io.*; class Questions {     public String[][] qpa;     public String[][] qca;     Questions() throws IOException {         qpa = new String[10][5];         // Updated questions and objectives         DataInputStream in = new DataInputStream(System.in);         qpa[0][0] = "What is the default value of an int variable in Java?";         qpa[0][1] = "1. 0.0";         qpa[0][2] = "2. null";         qpa[0][3] = "3. 0";         qpa[0][4] = "4. Undefined";         qpa[1][0] = "Which of these is a loop construct that will always execute at least once?";         qpa[1][1] = "1. for";         qpa[1][2] = "2. while";         qpa[1][3] = "3. do-while";         qpa[1][4] = "4....

AKASH.N,P23CS366

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.ge...
Image
Name: N.AKASH Father Name: G.Nagendheran DOB: 21/03/2002 Gender: Male  Nationality: Indian  Religion: Hindu  Marriage Status: Un married  Language Known : Tamil, English  Qualification: MSC(CS) Social Media:                  Instagram: this_ is_akash_03                   Twitter:akash.N Ambition : IT Address: Thiruppanandal 612504.                   Maariyamman Kovil Middle Street. Phone number:8940414064

product calculation using java

Image
 // Define the Product class class Product {     private String name;     private double price;     private int quantity;     private double taxRate; // Tax rate as a decimal (e.g., 0.08 for 8%)     // Constructor to initialize the product     public Product(String name, double price, int quantity, double taxRate) {         this.name = name;         this.price = price;         this.quantity = quantity;         this.taxRate = taxRate;     }     // Method to calculate the total cost including tax     public double calculateTotalCost() {         double subtotal = price * quantity;         double taxAmount = subtotal * taxRate;         double totalCost = subtotal + taxAmount;         return totalCost;     }     // Getter...