All MCQ Answers sent💯💯
👍1
Share our channel screenshot in large groups ✅✅✅✅✅
For coding answers & Sql 🏃🏃🏃🏃
For coding answers & Sql 🏃🏃🏃🏃
👍2
import java.util.Scanner;
public class BankOperations implements IBankAccountOperation {
private int initialBalance = 0;
public static void main(String[] args) {
BankOperations bankOperations = new BankOperations();
bankOperations.showBalance();
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the amount to deposit: ");
int depositAmount = scanner.nextInt();
bankOperations.depositFunds(depositAmount);
System.out.print("Enter the amount to withdraw: ");
int withdrawAmount = scanner.nextInt();
bankOperations.withdrawFunds(withdrawAmount);
scanner.close();
}
@Override
public void showBalance() {
System.out.println("Your current balance is: " + initialBalance);
}
@Override
public void depositFunds(int amount) {
initialBalance += amount;
System.out.println("You have deposited " + amount + ". Your current balance is: " + initialBalance);
}
@Override
public void withdrawFunds(int amount) {
if (amount > initialBalance) {
System.out.println("Insufficient balance. Withdrawal canceled.");
} else {
initialBalance -= amount;
System.out.println("You have withdrawn " + amount + ". Your current balance is: " + initialBalance);
}
}
}
public class BankOperations implements IBankAccountOperation {
private int initialBalance = 0;
public static void main(String[] args) {
BankOperations bankOperations = new BankOperations();
bankOperations.showBalance();
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the amount to deposit: ");
int depositAmount = scanner.nextInt();
bankOperations.depositFunds(depositAmount);
System.out.print("Enter the amount to withdraw: ");
int withdrawAmount = scanner.nextInt();
bankOperations.withdrawFunds(withdrawAmount);
scanner.close();
}
@Override
public void showBalance() {
System.out.println("Your current balance is: " + initialBalance);
}
@Override
public void depositFunds(int amount) {
initialBalance += amount;
System.out.println("You have deposited " + amount + ". Your current balance is: " + initialBalance);
}
@Override
public void withdrawFunds(int amount) {
if (amount > initialBalance) {
System.out.println("Insufficient balance. Withdrawal canceled.");
} else {
initialBalance -= amount;
System.out.println("You have withdrawn " + amount + ". Your current balance is: " + initialBalance);
}
}
}
❤1👍1🔥1
Share our channel screenshot in large groups ✅✅✅✅✅
For coding answers & Sql 🏃🏃🏃🏃
For coding answers & Sql 🏃🏃🏃🏃
👍2
Give reactions guys..and share our channel...to get more solutions...❤️✅😁
❤2🔥1
public List<GroceryItem> calculateInvoice(List<GroceryItem> purchasedItems, Map<String, Double> prices, Map<String, Double> discounts) {
List<GroceryItem> invoiceItems = new ArrayList<>();
for (GroceryItem purchasedItem : purchasedItems) {
String itemName = purchasedItem.getItemName();
int quantity = purchasedItem.getQuantity();
// Calculate the total price for the item, including the discount.
double price = prices.get(itemName);
double discount = discounts.getOrDefault(itemName, 0.0);
double totalPrice = price * quantity - discount * quantity;
// Create a new GroceryItem object for the invoice.
GroceryItem invoiceItem = new GroceryItem(itemName, quantity, price, totalPrice);
invoiceItems.add(invoiceItem);
}
// Sort the invoice items in ascending order by product name.
invoiceItems.sort(Comparator.comparing(GroceryItem::getItemName));
return invoiceItems;
}
List<GroceryItem> invoiceItems = new ArrayList<>();
for (GroceryItem purchasedItem : purchasedItems) {
String itemName = purchasedItem.getItemName();
int quantity = purchasedItem.getQuantity();
// Calculate the total price for the item, including the discount.
double price = prices.get(itemName);
double discount = discounts.getOrDefault(itemName, 0.0);
double totalPrice = price * quantity - discount * quantity;
// Create a new GroceryItem object for the invoice.
GroceryItem invoiceItem = new GroceryItem(itemName, quantity, price, totalPrice);
invoiceItems.add(invoiceItem);
}
// Sort the invoice items in ascending order by product name.
invoiceItems.sort(Comparator.comparing(GroceryItem::getItemName));
return invoiceItems;
}
👍2🔥1
This media is not supported in your browser
VIEW IN TELEGRAM
Share our channel screenshot in large groups ✅✅✅✅✅
For coding answers & Sql 🏃🏃🏃🏃
For coding answers & Sql 🏃🏃🏃🏃
👍2
SELECT c.title AS category_title, p.title, SUM(p.stock_number) AS total_stock
FROM categories c
JOIN products p ON c.id = p.category_id
GROUP BY c.title, p.title
HAVING SUM(p.stock_number) > 10
ORDER BY category_title ASC, p.title ASC, total_stock
E commerce website
Share @coding_000✅
FROM categories c
JOIN products p ON c.id = p.category_id
GROUP BY c.title, p.title
HAVING SUM(p.stock_number) > 10
ORDER BY category_title ASC, p.title ASC, total_stock
E commerce website
Share @coding_000✅
👍3
SELECT
A.email AS "email account",
COUNT(O.account_id) AS "outputs",
SUM(LENGTH(O.output) - LENGTH(REPLACE(O.output, ' ', '')) + 1) AS "total words",
ROUND(SUM(LENGTH(O.output) - LENGTH(REPLACE(O.output, ' ', '')) + 1) / COUNT(O.account_id), 2) AS "avg words per output"
FROM accounts A
LEFT JOIN results O ON A.id = O.account_id
GROUP BY A.email
ORDER BY A.email ASC;
A.email AS "email account",
COUNT(O.account_id) AS "outputs",
SUM(LENGTH(O.output) - LENGTH(REPLACE(O.output, ' ', '')) + 1) AS "total words",
ROUND(SUM(LENGTH(O.output) - LENGTH(REPLACE(O.output, ' ', '')) + 1) / COUNT(O.account_id), 2) AS "avg words per output"
FROM accounts A
LEFT JOIN results O ON A.id = O.account_id
GROUP BY A.email
ORDER BY A.email ASC;
👍2