Question: Working on this recursion program, but having problems display the way I want it to be Please help, Thanks! package BowlingProblem; import java.util.Scanner; /** *

Working on this recursion program, but having problems display the way I want it to be Please help, Thanks! Working on this recursion program, but having problems display the way I package BowlingProblem; import java.util.Scanner; /**  * Created by EdwardLai on 2/26/17.  */ public class Bowling { public static void getPins (int numRows, int totalRows) { if (numRows==1) { System.out.print("\t\t"); for(int i =1; iout.println("* "); } } else { System.out.print("\t\t"); getPins(numRows-1,totalRows); for(int i=1; iout.print(""); } for (int i=1; iout.print("* "); //System.out.println(); } System.out.println(); } } public static void main(String[] args) { Scanner scanner= new Scanner(System.in); System.out.print("Enter number of rows of pins to set up:"); int num = scanner.nextInt(); getPins(num,num); } } 

Consider a frame of bowling pins shown below, where each represents a pin: There are 5 rows and a total of 15 pins. If we had only the top 4 rows, then there would be a total of 10 pins. If we had only the top three rows, then there would be a total of six pins. If we had only the top two rows, then there would be a total of three pins. If we had only the top row, then there would be a total of one pin

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!