Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions