Untitled
unknown
plain_text
a year ago
1.2 kB
11
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 doubledDinnerCost=dinnerCost*=2;
double doubledLaserTagCost=laserTagCost*=2;
double doubledTripleScoopCost=tripleScoopCost*=2;
// Display the doubled costs
System.out.println("Dinner (for 2 people): " + doubledDinnerCost);
System.out.println("Laser-Tag (for 2 people): " + doubledLaserTagCost);
System.out.println("Triple Scoop (for 2): " + doubledTripleScoopCost);
// Calculate grand total
double grandTotal=doubledDinnerCost+doubledLaserTagCost+doubledTripleScoopCost;
// Print the grand total
System.out.println("Grand Total: " + grandTotal);
// Close the Scanner
}
}Editor is loading...
Leave a Comment