Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

US FRQ (F): Digits Class Save Submit + Continue V/FIRST: You need to import the ArrayList class public class Digits 7/ONLY ONE FIELD ALLOWED! 1/An

image text in transcribed
image text in transcribed
image text in transcribed
US FRQ (F): Digits Class Save Submit + Continue V/FIRST: You need to import the ArrayList class public class Digits 7/ONLY ONE FIELD ALLOWED! 1/An ArrayList that holds individual Integer digits (e, 1, 2...etc.) //Digits Constructor 1/@param: int num (which will be >= e) 1/Store each individual digit from num in the ArrayList. //Example: num is 178, your ArrayList would look like [1, 7, 8] 1/Important: if num is e, simply add e in the ArrayList i.e. [@] 9 9 1 2 3 4 15 16 17 18 19 20 21 22 //Method: isStrictlyIncreasing) 7/@param: none 1/@returns: boolean 1/Return true if the numbers in the ArrayList field are STRICTLY increasing. 1/Example: [1, 3, 7] is strictly increasing...each number gets bigger! 7/Example: (1, 3, 3] is NOT strictly increasing. 1/Note: if the ArrayList field has only ONE digit, return true! 23 24 25 1/Method: shiftLeft() 26 1/@param: none 27 1/@return: void 28 1/This method shifts all digts to the left by one. 29 7/Example: [1, 3, 7] changes to [37, 1] 38 7/Example: (5, 7, 9, ] changes to [7, 9, 0, 5] 31 7/Example: [3] remains [3] 32 33 34 //Method: toString() 35 // See the description for toString() output 36 7/Example: Digits: 1 3 7 (Note: a space between each digit) 37 38 39 } // end class 40 12 points Status: Not Submitted YOUR OUTPUT SHOULD MATCH THE FOLLOWING: Digits: 713 Strictly increasing: false Digits: 137 Strictly increasing: true Digits: 1 2 3 4 5 Strictly increasing: true Digits: 2 3 4 5 1 Strictly increasing: false Digits: 0 Strictly increasing: true Digits: Strictly increasing: true Digits: 73 5 6 Strictly increasing: false Digits: 3 5 6 7 Strictly increasing: true Save Submit + Continue J5 FRQ (F): Digits Class ublic class MyProgram extends ConsoleProgram public void run() { 7/DO NOT CHANGE THIS CODE //YOU MAY COMMENT/UNCOMMENT FOR TESTING Digits di = new Digits (713); System.out.println(di); System.out.println("Strictly increasing: " + d1. isStrictlyIncreasing()); d1.shiftleft(: System.out.println(di); System.out.println("Strictly increasing: + 01. isStrictlyIncreasing()); System.out.println(); Digits d2 = new Digits(12345); System.out.println(d2); System.out.println("Strictly increasing: + d2. isStrictlyIncreasing(); d2. shiftLeft(); System.out.println(d2); System.out.println("Strictly increasing: + d2. isStrictlyIncreasing(); System.out.println(); Digits d3 = new Digits(); System.out.println(d3); System.out.println("Strictly increasing: + d3. isStrictlyIncreasing()); d3.shiftleft(); System.out.println(d3); System.out.println("Strictly increasing: + d3. isStrictlyIncreasing(); System.out.println(); Digits 04 - new Digits(7356); System.out.println(4); System.out.println("Strictly increasing: +d4. isStrictly Increasing d4.shiftLeft(); 28 29 30 31 32 33 34 35 36 37 38 39 40 41 A - net ninti

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions