0

I want to create a method which can sum the total price and create a receipt as example:

product : price € (user input)
product : price € (user input)
-------------------
Total €..

This my code.

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();
Jason Aller
  • 3,391
  • 28
  • 37
  • 36
B.Goos
  • 1
  • 1
  • Tell us which parts are not working. We won't do your homework here. – ByteBit Nov 14 '15 at 13:23
  • This is one of the problems https://stackoverflow.com/questions/13102045/skipping-nextline-after-using-next-nextint-or-other-nextfoo-methods. Possible other is that I don't see any variables outside loop which could sum values entered in loop. – Pshemo Nov 14 '15 at 13:31

0 Answers0