/* TrapezoidsTool.java ** ** Java application to serve as a tool by which to test some of the ** methods of the Trapezoids class. ** ** CMPS 134 - Fall 2024 ** Author: P. M. J. ** Last Modified: September 24, 2024 ** Collaborated with: R. W. M. ** Known flaws: None known. ** */ import java.util.Scanner; public class TrapezoidsTool { public static void main(String[] args) { Scanner input = new Scanner(System.in); int narrowMeasure = getInt("Enter narrow measure:>",input); int heightMeasure = getInt("Enter height measure:>",input); System.out.println("Line----top--------bot----"); System.out.println(" --BG--FG -BG--FG---"); for(int line=1; line<=heightMeasure; line++) { System.out.printf("%3d",line); System.out.printf(" %4d",Trapezoids.narrowTopBackgroundLength(heightMeasure,line)); System.out.printf("%4d",Trapezoids.narrowTopForegroundLength(narrowMeasure,line)); System.out.print(" "); System.out.printf("%4d",Trapezoids.narrowBottomBackgroundLength(line)); System.out.printf("%4d",Trapezoids.narrowBottomForegroundLength(narrowMeasure,heightMeasure,line)); System.out.println(); } } /* Prints the given string (intended to be a user prompt) and returns ** the response (interpreted to be of type int) entered at the keyboard. */ private static int getInt(String prompt, Scanner keyboard) { System.out.print(prompt); return keyboard.nextInt(); } }