kramsuiluj
Honorary Poster
[XX='zackmark29, c: 417615, m: 77455'][/XX] hahaha boss maling room po ata na pasukan niyo, dun po dapat ata kayo sa kabila wala ka sa lista
public class test {
public static void main(String []args){
var input = new Scanner(System.in)
double softdrinksPrice = 10; // or sa given example 9.5
double sandwichPrice = 15; // or sa given example 24
double totalSoftDrinks = 0;
double totalSandwiches = 0;
double totalPrice = 0;
int softdrinks = 0;
int sandwiches = 0;
System.out.println("Softdrinks price: " + softdrinksPrice );
System.out.println("Sandwich price: " + sandwichPrice + "\n");
System.out.print(String.format("How many softdrinks do you want to buy? > "));
softdrinks = input.nextInt();
System.out.print(String.format("How many sandwiches do you want to buy? > "));
sandwiches = input.nextInt();
System.out.println("");
totalSoftDrinks = softdrinksPrice * softdrinks;
totalSandwiches = sandwichPrice * sandwiches;
totalPrice = totalSoftDrinks + totalSandwiches;
System.out.println(String.format("You ordered: %1$s Softdrinks which is cost: Php %2$s", softdrinks, totalSoftDrinks));
System.out.println(String.format("You ordered: %1$s Sandwiches which is cost: Php %2$s\n", sandwiches, totalSandwiches));
System.out.println(String.format("The Total amount of your Bill is: Php %1$s", totalPrice));
input.close():
}
}
package test;
import java.util.Scanner;
public class PabiliPo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int softdrinks = 10, sandwich = 15;
int numberOfSoftDrinks, numberOfSandwiches;
int totalCost, totalCostOfSoftdrinks, totalCostOfSandwich;
System.out.print("How many softdrinks do you want to buy: ");
numberOfSoftDrinks = input.nextInt();
System.out.print("How many sandwich do you want to buy: ");
numberOfSandwiches = input.nextInt();
totalCostOfSoftdrinks = softdrinks * numberOfSoftDrinks;
System.out.println("You ordered: " + numberOfSoftDrinks + " softdrinks which costs: " + totalCostOfSoftdrinks);
totalCostOfSandwich = sandwich * numberOfSandwiches;
System.out.println("You ordered: " + numberOfSandwiches + " sandwich which costs: " + totalCostOfSandwich);
totalCost = totalCostOfSoftdrinks + totalCostOfSandwich;
System.out.print("The total amount of your bill is: Php " + totalCost);
}
}
yung comment mo sa taas na java yun yung error
JAVA VERSION:
Java:public class test { public static void main(String []args){ var input = new Scanner(System.in) double softdrinksPrice = 10; // or sa given example 9.5 double sandwichPrice = 15; // or sa given example 24 double totalSoftDrinks = 0; double totalSandwiches = 0; double totalPrice = 0; int softdrinks = 0; int sandwiches = 0; System.out.println("Softdrinks price: " + softdrinksPrice ); System.out.println("Sandwich price: " + sandwichPrice + "\n"); System.out.print(String.format("How many softdrinks do you want to buy? > ")); softdrinks = input.nextInt(); System.out.print(String.format("How many sandwiches do you want to buy? > ")); sandwiches = input.nextInt(); System.out.println(""); totalSoftDrinks = softdrinksPrice * softdrinks; totalSandwiches = sandwichPrice * sandwiches; totalPrice = totalSoftDrinks + totalSandwiches; System.out.println(String.format("You ordered: %1$s Softdrinks which is cost: Php %2$s", softdrinks, totalSoftDrinks)); System.out.println(String.format("You ordered: %1$s Sandwiches which is cost: Php %2$s\n", sandwiches, totalSandwiches)); System.out.println(String.format("The Total amount of your Bill is: Php %1$s", totalPrice)); input.close(): } }