我想创建一种方法,可以总计总价并创建收据作为示例:
product : price € (user input)
product : price € (user input)
-------------------
Total €..
这是我的代码。
public static void main(String[] args) {
Scanner invoer = new Scanner(System.in);
System.out.print("Wat is is het kortingsaantal(1...9)? ");
int kortingsaantal = invoer.nextInt();
System.out.print("Wat is het kortingspercentage (1...100)? ");
int kortingspercentage = invoer.nextInt();
System.out.print("Hoeveel artikelen heb je gekocht? ");
int quantity = invoer.nextInt();
for (int i = 1; i <= quantity; i++) {
System.out.print("Omschrijving van artikel #" + i + ": ");
String dummy = invoer.nextLine();
String product = invoer.nextLine();
System.out.print(" Prijs van " + product + ":");
double Price = invoer.nextDouble();