Untitled

mail@pastecode.io avatar
unknown
plain_text
4 months ago
1.5 kB
2
Indexable
import java.util.*;

public class NightOut
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);

        System.out.print("How much does dinner usually cost?");
        double dinnerCost = input.nextDouble();
        
        System.out.print("How much is laser tag for one person?");
        double laserTagCost = input.nextDouble();
        
        System.out.print("How much does a triple scoop cost?");
        double tripleScoopCost = input.nextDouble();
        
        // Multiply each cost by 2
        double friendsDinnerCost = dinnerCost * 2;
        double friendsLaserTagCost = laserTagCost;
        double friendsIceCreamCost = tripleScoopCost / 3;
        
        double totalDinnerCost = dinnerCost + friendsDinnerCost;
        double totalLaserTagCost = laserTagCost * 2;
        double totalIceCreamCost = tripleScoopCost + friendsIceCreamCost;
        
        // spacing in between
        
        System.out.println();
        
        // now we print the rest
        
        System.out.println("Dinner: $" + totalDinnerCost);
        System.out.println("Laser Tag: $" + totalLaserTagCost);
        System.out.println("Triple Scoop: $" + totalIceCreamCost);
        
        // Calculate grand total
        double grandTotal = totalDinnerCost + totalLaserTagCost + totalIceCreamCost;
        
        // Print the grand total
        System.out.println("Grand Total: $" + grandTotal);
        
    }
} 
Leave a Comment