/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package scannerpractice; import java.util.Scanner; /** * * @author jcmtiernan */ public class ScannerPractice { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); String word = "super"; String word2; int intA, intB, intC; double dbA, dbB, dbC; // I want the user to enter month, a day, amount of money, item purchased int month; int day; double amountSpent; String itemName; int testValue = 0; String testWord = ""; boolean continueProgram = true; // a simple loop structure System.out.println("Please enter the number of the month and the day, \nthen the cost " + "(in dollars and cents with no dollar symbol) \n" + "and the name of the item purchased: "); while(continueProgram) { continueProgram = false; System.out.print("Next inputs : "); // User enters: 9 10 780.43 washer dryer month = input.nextInt(); day = input.nextInt(); amountSpent = input.nextDouble(); itemName = input.nextLine(); System.out.printf("\nYou entered %2d %2d %10.2f %25s\t",month,day,amountSpent,itemName); System.out.printf("\nDo you want to run the program again? Enter 1 for Yes; 0 for No : "); testWord = input.next(); input.nextLine(); continueProgram = (testWord.equalsIgnoreCase("1")); //amountSpent = 65000.05; //System.out.println("\nYou entered "+month+" "+day+" "+amountSpent+" "+itemName); //testValue--; //testValue -= 1;//testValue = testValue - 1; } System.out.println("\nYou have completed running the program"); /* System.out.println("Please enter an \tinteger value: "); intA = input.nextInt(); System.out.println(intA); System.out.println("Please enter \n a floating point value: "); dbC = input.nextDouble(); System.out.println(dbC); input.nextLine(); System.out.println("Please enter a \"phrase of 2 or more words\": "); word2 = input.nextLine(); System.out.println(word2); */ /* System.out.println("Whoopee!"); System.out.println(word); word2 = "pineapple"; System.out.println(word2); word2 = word; System.out.println(word2); */ } }