Question: modify the CarCareChoice 2 class so that as long as the user enters the first three characters of a service, the choice is considered valid:
modify the CarCareChoice class so that as long as the user enters the first three characters of a service, the choice is considered valid:
import java.util.;
public class CarCareChoice
public static void mainString args
Scanner inputnew ScannerSystemin;
String servicesoil change", "tire rotation", "battery check", "brake inspection";
double price;
Systemout.printlnAvailable Services";
forString ser:services
System.out.printlnser;
System.out.printlnPlease enter the name of the service you would like";
String serviceChoiceinput.nextLinetoLowerCase;
boolean foundfalse;
for int i ; i services.length; i
if servicesitoLowerCasestartsWithserviceChoice
System.out.printlnEnter selection servicesi;
System.out.printlnservicesi price is pricei;
found true;
break;
if found
System.out.printlnWrong service selected";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
