Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.util.Scanner;
  2. import static java.lang.System.out;
  3.  
  4. public class MainClass { //Changed 'Main Class' to 'MainClass'
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in); //Added the 'new Scanner' expression
  8.         //Removed the delimiter entirely
  9.         double cost = 4.20, tax = 0.07; //Removed the extra double
  10.  
  11.         out.println("Enter number of orders:");
  12.         int orders = scan.nextInt();
  13.  
  14.         scan.close();
  15.  
  16.         out.println();
  17.         out.print("Your total cost is: ");
  18.         out.print(String.format("$%2.2f", orders * (cost * (tax + 1)))); //Added parenthesis around 'tax + 1' for order of operations
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement