/* * Intro to Programming CSE 1310 * University of Texas at Arlington */ package spr17test1qa; import java.util.Scanner; /** * * @author Dr. Carter Tiernan * jcmtiernan */ public class Spr17Test1QA { /** * This class is used as the code example for * Test 1 in the Spring 17 1310-05 class * * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); // a. What would be better, more meaningful names for the // variables below and why would you choose these // types of meaningful names? String moth; String a; int ear; int aBer = 0; // b. What does count tell you at the end of the program? int count = 0; int mthct = 0; System.out.println(); // c. Why is this output statement repeated later in the program? System.out.println("Give an input in the form of " + "\"Tuesday February 21, 2017\".\n " + "If finished, enter \"Done\" : "); a = input.next(); // d. Which Java control statement would you choose to use and why? // e. For this control statement,what test condition do you need? _____( !_________) //___d.___( !___e.___) { moth = input.next(); aBer = input.nextInt(); ear = input.nextInt(); switch (moth) { case "April": System.out.println("April showers"); mthct = 4; break; case "may": case "MAY": case "May" : // f. Add the missing action in the May case // so that it is like the April and June cases. // What does this added action accomplish? System.out.println("The merry month of May"); break; case "June": System.out.println("Moon, swoon, June"); mthct = 6; break; default : System.out.println("Not a month"); break; } // end switch System.out.println("Give an input in the form of " + "\"Tuesday February 21, 2017\".\n " + "If finished, enter \"Done\" : "); a = input.next(); count++; } // end control structure d. System.out.println("The value of count is "+count); } // end main // end class Spr17Test1QA }