Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Only 4 pennies You are programming a children s game where the most money they can hold is 4 pennies. Which of the following is
Only pennies
You are programming a childrens game where the most money they can hold is pennies. Which of the following is the most elegant way to print out a full list of store items the player can afford based on the number of pennies they have?
While elegant code has no firm definition, assume for now it means "uses cleverness to accomplish something in much less code, but in a way thats readable". It is also assumed that the code works as intended which some of the below do not
A switchpennies
case : System.out.printlnMarble penny; break;
case : System.out.printlnPet rock pennies;
System.out.printlnMarble penny; break;
case : System.out.printlnJump rope pennies;
System.out.printlnPet rock pennies;
System.out.printlnMarble penny; break;
case : System.out.printlnGoldfish pennies;
System.out.printlnJump rope pennies;
System.out.printlnPet rock pennies;
System.out.printlnMarble penny; break;
default: System.out.printlnIt looks like you need some pennies!";
B switchpennies
case : System.out.printlnMarble penny;
case : System.out.printlnPet rock pennies;
case : System.out.printlnJump rope pennies;
case : System.out.printlnGoldfish pennies; break;
default: System.out.printlnIt looks like you need some pennies!";
c switchpennies
case : System.out.printlnGoldfish pennies;
case : System.out.printlnJump rope pennies;
case : System.out.printlnPet rock pennies;
case : System.out.printlnMarble penny; break;
default: System.out.printlnIt looks like you need some pennies!";
D switchpennies
case : System.out.printlnGoldfish pennies; break;
case : System.out.printlnJump rope pennies; break;
case : System.out.printlnPet rock pennies; break;
case : System.out.printlnMarble penny; break;
default: System.out.printlnIt looks like you need some pennies!";
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