/* This class demonstrates input and output using the Scanner and System classes respectively */ // The Scanner class is not automatically added to the executable. We need to import it. import java.util.Scanner; class SpongeBob { public static void main (String [] args) { //create the Scanner object Scanner entries = new Scanner (System.in); int count; double todaysAmount; double price; // It is customary to prompt the user, so that they know what data to enter. System.out.print("What is the cost of 1 Krabby Patty? "); // Read in the cost price = entries.nextDouble(); String cashier; System.out.print("Who is the cashier? "); // Read the name of the current cashier. We are getting only the first name. cashier = entries.next(); System.out.print("Please enter number of Krabby Patties sold: "); // Read in the number of Krabby Patties already sold. count = entries.nextInt(); //we sold 5 more. So, we add 5 to count count = count + 5; // same as count+=5; //calculating the total sales for the day. todaysAmount = count * price; //printing the details. System.out.println("Today's cashier was "+cashier); System.out.printf("Today's sale was $%.2f\n",todaysAmount ); } }