Posts

Question.java program Prabha.P

 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]="number of primitive data type in java?"; qpa[0][1]="1.6"; qpa[0][2]="2.7"; qpa[0][3]="3.8";qpa[0][4]="4.9"; qpa[1][0]="What is the size of float and double in java?"; qpa[1][1]="1.32 and 64"; qpa[1][2]="2.32 and 32"; qpa[1][3]="3.64 and 64"; qpa[1][4]="4.64 and 32"; qpa[2][0]="arrays in java are?"; qpa[2][1]="1.object references"; qpa[2][2]="2.object"; qpa[2][3]="3.primitive data type"; qpa[2][4]="4.none"; qpa[3][0]="when is the object created with new keyword?"; qpa[3][1]="1.at run time"; qpa[3][2]="2.at compile time"; qpa[3][3]="3.depends on the code"; qp...

product excluding and product including P23CS391

 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;     }     // ...