Question
if (orderNumChiefs > 0) { System.out.print(Would you like to customize (y/n): ); String response = scan.next().toLowerCase(); if (response.equals(y)) { for (int i = 0; i
if (orderNumChiefs > 0) {
System.out.print("Would you like to customize (y/n): ");
String response = scan.next().toLowerCase();
if (response.equals("y")) {
for (int i = 0; i < ChiefsShirtOrder; i++) {
System.out.printf("What do you want to print on the back of shirt" + (i+1) + ":" );
String printedTextChiefs = scan.nextLine();
scan.nextLine();
String printedTextChiefs = "Chiefs printed letters" + printedLetters;
printedLetters += printedTextChiefs.replaceAll("\\s+","").length();
Context
I am trying to concatenate the number of characters that was printed at the back of the shirt in a system out print. A variable "int printedLetters = 0;" has been declared to keep count of the letters being printed.
Yet
When I try to print the number of characters that were printed at the back of the shirt using this code: System.out.println("Chiefs Printed letters: " + printedTextChiefs.length); I get an error ("printedTextChiefs") is underlined because "it cannot be resolved to a variable". I need to retrieve the number of letters that were printed on the shirt can someone please help me with the JAVA code, thanks!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started