ACT4_1

mail@pastecode.io avatar
unknown
java
2 years ago
964 B
2
Indexable
Never
package com.ACT4_Mayor_3;

import java.util.Scanner;

public class ACT4_Mayor_3 {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        double totalAmount;
        double change;

        System.out.print("Input item1: ");
        Double item1 = scan.nextDouble();
        System.out.print("Input item2: ");
        Double item2 = scan.nextDouble();
        System.out.print("Input item3: ");
        Double item3 = scan.nextDouble();
        System.out.print("Input item4: ");
        Double item4 = scan.nextDouble();
        System.out.print("Input item5: ");
        Double item5 = scan.nextDouble();
        System.out.print("Input cash: ");
        Double cash = scan.nextDouble();

        totalAmount = item1 + item2 + item3 + item4 + item5;

        change = cash - totalAmount;

        System.out.println("TOTAL: " + totalAmount + "\nCASH: " + cash + "\nCHANGE: " + change);