Java :: Aufgabe #261 :: Lösung #2
2 Lösungen

#261
Preise im Copy-Shop für Kopien
Anfänger - Java
von DragStar
- 20.03.2020 um 11:53 Uhr
In einem Copy-Shop gilt folgende Preisliste:
01 - 49 Seiten kostet 0,10 Euro pro Seite
50 - 99 Seiten kostet 0,09 Euro pro Seite
100 - 199 Seiten kostet 0,08 Euro pro Seite
ab 200 Seiten kostet 0,06 Euro pro Seite
Erstellen Sie ein Programm, welches nach Eingabe der Anzahl der Kopien den Gesamtpreis ausgibt.
01 - 49 Seiten kostet 0,10 Euro pro Seite
50 - 99 Seiten kostet 0,09 Euro pro Seite
100 - 199 Seiten kostet 0,08 Euro pro Seite
ab 200 Seiten kostet 0,06 Euro pro Seite
Erstellen Sie ein Programm, welches nach Eingabe der Anzahl der Kopien den Gesamtpreis ausgibt.
#2

von Meckel (350 Punkte)
- 12.04.2020 um 14:26 Uhr

import java.util.*; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Wie viele Kopien dürfen es sein?"); int anzahl = sc.nextInt(); if (anzahl < 50) { System.out.print("Das macht "+ anzahl*0.1 +" Euro!"); } else { if (anzahl < 100) { System.out.print("Das macht "+anzahl*0.09+" Euro!"); } else { if (anzahl < 200) { System.out.print("Das macht "+anzahl*0.08+" Euro!"); } else { System.out.print("Das macht "+anzahl*0.06+" Euro!"); } } } } }
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1