Question: CS 1301- Intro to CS Week 4 Exercise public static void nain(Stringt) args) System.out.print In(Happy Valentine's day!) Scanner scanner new Scanner (Systen.); int nunkisses 3;
CS 1301- Intro to CS Week 4 Exercise public static void nain(Stringt) args) System.out.print In("Happy Valentine's day!) Scanner scanner new Scanner (Systen."); int nunkisses 3; int nunebsnacit askango 3 boolean keepGoing true: while (keepGoing) System.out.printin"numkisses nunkisses): System.out.print In("numReesesnunReeses); System.out.print In ("numRebanaditasMango"numRebanaditasMango): System.out.println("Enter if you want a kiss (Hershey's)"); System . out.println("Enter 1 if you want a reese's chocolate heart" System.out.print ln("Enter 2 if you want a rebanadita de mango"): System.out.printn"Enter 3 if you want to exit") int choice scanner.nextIntO: if (choice 0) nunkisses-1: else if (choice1) numReeses1: else if (choice2) numRebanaditasMango -1 else keepGo ingfalse A. B. Replace all the if statements with a switch statement Modify the code, so the none of the integer values becomes negative. When the user selects something you don't have, print a message letting the user know you ran out Modily the Boolean expression/ condition of the while loop, so the program terminates when you run out of candy. C
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
