# [Solved] Assignment 6: Fancy Timer

30 \$

SKU: [Solved] Assignment 6: Fancy Timer Category: Tag:

Assignment 6: Fancy Timer

IntroductionYou will write two programs: The rst program will display any digit from 0-9 in a fancy way. Thesecond program will be a countdown timer. You may work alone or in pairs for this assignment.In this assignment, you should write a javadoc comment at the top of each class and each method.You will need to write external documentation for the second program.1 Fancy digitsIn this part of the assignment, you will write a program called Fancy.java which displays a fancyversion of the input digit.1.1 Speci cationsInput: The program should accept as input: a single digit (as an int) { the user should be prompted until the number entered is asingle digit, however, you do not need to handle non-integer input a display character or sequence (as a String)Output: A fancy version of the digit, composed of the display character or sequence.Displaying fancy digits: If your display sequence is “*”, then here is what each of your fancydigits should look like:* ***** ***** * * ***** ***** ***** ***** ***** ****** * * * * * * * * * * * * ** ***** ***** ***** ***** ***** * ***** ***** * ** * * * * * * * * * * * ** ***** ***** * ***** ***** * ***** ***** *****Note that you will only need to print one digit at a time, not all on the same line. Theyare displayed here on the same line just to save space.If you look carefully at the digits, you will realize the following facts:1Assignment 6: Fancy TimerCPSC 1150-006/007, Fall 2016Instructor: Adina GoldbergLangara College1. Each fancy digit is made by printing ve lines.2. Each fancy digit is ve characters wide.3. There are only four possible types of lines that can make up a digit:(a) One * on the left, followed by four spaces.(b) Four spaces, followed by one * on the right.(c) One * on the left, followed by three spaces, followed by one * on the right.(d) A row of ve *s.Using methods: You must design and use the following methods to solve the problem. You willinvoke printDigit from main. Within each method, you will need to invoke some of theother methods. A method to print a fancy version of any digit:{ public static void printDigit (int digitToPrint, String disp) { displaysa fancy version of digitToPrint, using the display sequence disp A display method for each of the ten digits:{ public static void printZero (String disp) { displays a fancy version of thedigit 0, using the display sequence disp{ methods for digits 1-8 . . .{ public static void printNine (String disp) { displays a fancy version of thedigit 9, using the display sequence disp Four methods to display each type of line a digit may be composed of:{ public static void printLeft(String disp) { if disp is “*”, prints “* ”{ public static void printRight(String disp) { if disp is “*”, prints ” *”{ public static void printLR(String disp) { if disp is “*”, prints “* *”{ public static void printRow(String disp) { if disp is “*”, prints “*****” Method to generate spaces that match the length of disp:{ public static String getSpaces(int n, String disp) { returns a String com-prised of n * disp.length() spaces1.2 Sample outputSample 1Please enter a digit to display:6Please enter a display character or String:\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ \$\$\$\$\$\$\$\$\$\$\$\$